From 63fd178ee21d69a69b4223629918fd9ee458cd8b Mon Sep 17 00:00:00 2001 From: drullkus Date: Mon, 18 Dec 2023 20:22:36 -0800 Subject: [PATCH] Fix startup crashes --- build.gradle | 31 +++++++++++++------ gradle.properties | 10 +++--- .../worldedit/forge/ThreadSafeCache.java | 4 +-- 3 files changed, 28 insertions(+), 17 deletions(-) diff --git a/build.gradle b/build.gradle index ee43d08..a4bbe2f 100644 --- a/build.gradle +++ b/build.gradle @@ -29,6 +29,17 @@ minecraft.accessTransformers.file rootProject.file('src/main/resources/META-INF/ runs { // applies to all the run configs below configureEach { + dependencies { + runtime "net.kyori:text-api:${TEXT}" + runtime "net.kyori:text-serializer-gson:${TEXT}" + runtime "net.kyori:text-serializer-legacy:${TEXT}" + runtime "net.kyori:text-serializer-plain:${TEXT}" + + runtime "org.enginehub.piston:core:${PISTON}" + runtime "org.enginehub.piston.core-ap:runtime:${PISTON}" + runtime "org.enginehub.piston:default-impl:${PISTON}" + } + // Recommended logging data for a userdev environment // The markers can be added/remove as needed separated by commas. // "SCAN": For mods scan. @@ -89,27 +100,27 @@ dependencies { // For all intends and purposes: You can treat this dependency as if it is a normal library you would use. implementation "net.neoforged:neoforge:${neo_version}" - implementation("net.kyori:text-api:${TEXT}") - implementation("net.kyori:text-serializer-gson:${TEXT}") - implementation("net.kyori:text-serializer-legacy:${TEXT}") - implementation("net.kyori:text-serializer-plain:${TEXT}") + implementation "net.kyori:text-api:${TEXT}" + implementation "net.kyori:text-serializer-gson:${TEXT}" + implementation "net.kyori:text-serializer-legacy:${TEXT}" + implementation "net.kyori:text-serializer-plain:${TEXT}" implementation "com.sk89q.lib:jlibnoise:1.0.0" implementation "org.enginehub.piston:core:${PISTON}" implementation "org.enginehub.piston.core-ap:runtime:${PISTON}" implementation "org.enginehub.piston:default-impl:${PISTON}" implementation "org.yaml:snakeyaml:2.0" - implementation("org.enginehub.piston.core-ap:annotations:${PISTON}") - implementation("org.enginehub.piston.core-ap:processor:${PISTON}") - annotationProcessor("org.enginehub.piston.core-ap:annotations:${PISTON}") - annotationProcessor("org.enginehub.piston.core-ap:processor:${PISTON}") + implementation "org.enginehub.piston.core-ap:annotations:${PISTON}" + implementation "org.enginehub.piston.core-ap:processor:${PISTON}" + annotationProcessor "org.enginehub.piston.core-ap:annotations:${PISTON}" + annotationProcessor "org.enginehub.piston.core-ap:processor:${PISTON}" implementation ("com.sk89q:jchronic:0.2.4a") { exclude group: "junit", module: "junit" } - compileOnly("com.google.auto.value:auto-value-annotations:${AUTO_VALUE}") + implementation("com.google.auto.value:auto-value-annotations:${AUTO_VALUE}") annotationProcessor("com.google.auto.value:auto-value:${AUTO_VALUE}") antlr("org.antlr:antlr4:4.9.1") implementation("org.antlr:antlr4-runtime:4.9.1") - compileOnly("de.schlichtherle:truezip:6.8.4") + implementation("de.schlichtherle:truezip:6.8.4") implementation("org.mozilla:rhino-runtime:1.7.13") // Example mod dependency with JEI diff --git a/gradle.properties b/gradle.properties index 7aa6c32..95b0ba6 100644 --- a/gradle.properties +++ b/gradle.properties @@ -23,9 +23,9 @@ loader_version_range=[1,) # The unique mod identifier for the mod. Must be lowercase in English locale. Must fit the regex [a-z][a-z0-9_]{1,63} # Must match the String constant located in the main mod class annotated with @Mod. -mod_id=examplemod +mod_id=worldedit # The human-readable display name for the mod. -mod_name=Example Mod +mod_name=World Edit # The license of the mod. Review your options at https://choosealicense.com/. All Rights Reserved is the default. mod_license=All Rights Reserved # The mod version. See https://semver.org/ @@ -33,11 +33,11 @@ mod_version=1.0.0 # The group ID for the mod. It is only important when publishing as an artifact to a Maven repository. # This should match the base package used for the mod sources. # See https://maven.apache.org/guides/mini/guide-naming-conventions.html -mod_group_id=com.example.examplemod +mod_group_id=com.sk89 # The authors of the mod. This is a simple text string that is used for display purposes in the mod list. -mod_authors=YourNameHere, OtherNameHere +mod_authors=EngineHub # The description of the mod. This is a simple multiline text string that is used for display purposes in the mod list. -mod_description=Example mod description.\nNewline characters can be used and will be replaced properly. +mod_description=Ported to NeoForged by Drullkus # Pack version - this changes each minecraft release, in general. pack_format_number=18 diff --git a/src/main/java/com/sk89q/worldedit/forge/ThreadSafeCache.java b/src/main/java/com/sk89q/worldedit/forge/ThreadSafeCache.java index 36d5ea3..2d43179 100644 --- a/src/main/java/com/sk89q/worldedit/forge/ThreadSafeCache.java +++ b/src/main/java/com/sk89q/worldedit/forge/ThreadSafeCache.java @@ -51,13 +51,13 @@ public Set getOnlineIds() { } @SubscribeEvent - public void tickStart(TickEvent event) { + public void tickStart(TickEvent.ServerTickEvent event) { long now = System.currentTimeMillis(); if (now - lastRefresh > REFRESH_DELAY) { Set onlineIds = new HashSet<>(); - MinecraftServer server = ServerLifecycleHooks.getCurrentServer(); + MinecraftServer server = event.getServer(); if (server == null) { return; }