Skip to content

Commit

Permalink
Update to 1.17 and remove config support for now
Browse files Browse the repository at this point in the history
  • Loading branch information
sammko committed Jun 8, 2021
1 parent 1c13749 commit 984533f
Show file tree
Hide file tree
Showing 7 changed files with 43 additions and 65 deletions.
67 changes: 31 additions & 36 deletions build.gradle
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
plugins {
id 'fabric-loom' version '0.4-SNAPSHOT'
id 'fabric-loom' version '0.8-SNAPSHOT'
id 'maven-publish'
}

sourceCompatibility = JavaVersion.VERSION_1_8
targetCompatibility = JavaVersion.VERSION_1_8
sourceCompatibility = JavaVersion.VERSION_16
targetCompatibility = JavaVersion.VERSION_16

archivesBaseName = "${project.archives_base_name}-mc${project.minecraft_version}"
version = project.mod_version
Expand All @@ -17,43 +17,38 @@ dependencies {
modImplementation "net.fabricmc:fabric-loader:${project.loader_version}"

modImplementation "net.fabricmc.fabric-api:fabric-api:${project.fabric_version}"

modApi("me.sargunvohra.mcmods:autoconfig1u:${autoconfig_version}") {
exclude(group: "net.fabricmc.fabric-api")
}
include "me.sargunvohra.mcmods:autoconfig1u:${autoconfig_version}"
}

processResources {
inputs.property "version", project.version

from(sourceSets.main.resources.srcDirs) {
include "fabric.mod.json"
filesMatching("fabric.mod.json") {
expand "version": project.version
}

from(sourceSets.main.resources.srcDirs) {
exclude "fabric.mod.json"
}
}

// ensure that the encoding is set to UTF-8, no matter what the system default is
// this fixes some edge cases with special characters not displaying correctly
// see http://yodaconditions.net/blog/fix-for-java-file-encoding-problems-with-gradle.html
tasks.withType(JavaCompile) {
options.encoding = "UTF-8"
tasks.withType(JavaCompile).configureEach {
// ensure that the encoding is set to UTF-8, no matter what the system default is
// this fixes some edge cases with special characters not displaying correctly
// see http://yodaconditions.net/blog/fix-for-java-file-encoding-problems-with-gradle.html
// If Javadoc is generated, this must be specified in that task too.
it.options.encoding = "UTF-8"

// Minecraft 1.17 (21w19a) upwards uses Java 16.
it.options.release = 16
}

// Loom will automatically attach sourcesJar to a RemapSourcesJar task and to the "build" task
// if it is present.
// If you remove this task, sources will not be generated.
task sourcesJar(type: Jar, dependsOn: classes) {
classifier = "sources"
from sourceSets.main.allSource
java {
// Loom will automatically attach sourcesJar to a RemapSourcesJar task and to the "build" task
// if it is present.
// If you remove this line, sources will not be generated.
withSourcesJar()
}

jar {
from "LICENSE"
from("LICENSE") {
rename { "${it}_${project.archivesBaseName}"}
}
}

publishing {
Expand All @@ -67,14 +62,14 @@ publishing {
}
}
}

repositories {
maven {
url = mavenUrl
credentials {
username mavenUser
password mavenPassword
}
}
}
//
// repositories {
// maven {
// url = mavenUrl
// credentials {
// username mavenUser
// password mavenPassword
// }
// }
// }
}
14 changes: 6 additions & 8 deletions gradle.properties
Original file line number Diff line number Diff line change
Expand Up @@ -2,16 +2,14 @@
org.gradle.jvmargs=-Xmx1G

# Fabric Properties
minecraft_version=1.16.5
yarn_mappings=1.16.5+build.3
loader_version=0.11.1
minecraft_version=1.17
yarn_mappings=1.17+build.1
loader_version=0.11.3

#Fabric api
fabric_version=0.30.0+1.16
fabric_version=0.34.9+1.17

# Mod Properties
mod_version = 1.4
mod_version = 1.5
maven_group = net.cavoj
archives_base_name = servertick

autoconfig_version=3.3.1
archives_base_name = servertick
1 change: 0 additions & 1 deletion settings.gradle
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
pluginManagement {
repositories {
jcenter()
maven {
name = 'Fabric'
url = 'https://maven.fabricmc.net/'
Expand Down
9 changes: 0 additions & 9 deletions src/main/java/net/cavoj/servertick/ModConfig.java

This file was deleted.

10 changes: 2 additions & 8 deletions src/main/java/net/cavoj/servertick/ServerTick.java
Original file line number Diff line number Diff line change
@@ -1,8 +1,5 @@
package net.cavoj.servertick;

import me.sargunvohra.mcmods.autoconfig1u.AutoConfig;
import me.sargunvohra.mcmods.autoconfig1u.ConfigHolder;
import me.sargunvohra.mcmods.autoconfig1u.serializer.Toml4jConfigSerializer;
import net.cavoj.servertick.extensions.MinecraftServerWithST;
import net.fabricmc.api.EnvType;
import net.fabricmc.api.ModInitializer;
Expand All @@ -17,23 +14,20 @@
import net.minecraft.server.network.ServerPlayerEntity;

public class ServerTick implements ModInitializer {
private ConfigHolder<ModConfig> configHolder;

@Override
public void onInitialize() {
ServerPlayNetworking.registerGlobalReceiver(NetworkC2S.PACKET_ENABLED, this::processTogglePacket);
ServerTickEvents.END_SERVER_TICK.register((minecraftServer -> {
((MinecraftServerWithST)minecraftServer).tickST();
}));
if (FabricLoader.getInstance().getEnvironmentType() == EnvType.SERVER) {
AutoConfig.register(ModConfig.class, Toml4jConfigSerializer::new);
this.configHolder = AutoConfig.getConfigHolder(ModConfig.class);
// TODO Load server config
}
}

private boolean checkPlayerPrivilege(PlayerEntity player) {
// TODO check server config
return (player.getServer() != null && !player.getServer().isDedicated()) ||
(this.configHolder != null && !this.configHolder.getConfig().requireOP) ||
player.hasPermissionLevel(4);
}

Expand Down
5 changes: 3 additions & 2 deletions src/main/resources/fabric.mod.json
Original file line number Diff line number Diff line change
Expand Up @@ -27,8 +27,9 @@
"servertick.mixins.json"
],
"depends": {
"fabricloader": ">=0.7.4",
"fabricloader": ">=0.11.3",
"fabric": "*",
"minecraft": "1.16.x"
"minecraft": "1.17.x",
"java": ">=16"
}
}
2 changes: 1 addition & 1 deletion src/main/resources/servertick.mixins.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
"required": true,
"minVersion": "0.8",
"package": "net.cavoj.servertick.mixin",
"compatibilityLevel": "JAVA_8",
"compatibilityLevel": "JAVA_16",
"client": [
"client.ClientPlayNetworkHandlerMixin",
"client.DebugHudMixin",
Expand Down

0 comments on commit 984533f

Please sign in to comment.