diff options
author | Juuxel <6596629+Juuxel@users.noreply.github.com> | 2020-12-21 17:14:12 +0200 |
---|---|---|
committer | Juuxel <6596629+Juuxel@users.noreply.github.com> | 2020-12-21 17:14:12 +0200 |
commit | 866c869187dbd7759637f8009686d560032a54b6 (patch) | |
tree | 662a78bb41755c11a9145b1e8fb5f88dd481d4e4 | |
parent | a608419e38cf02362df4cfb77a3587108f76bfc6 (diff) | |
parent | ea894bba3b8056740af61635139023ccf0756ded (diff) | |
download | LibGui-866c869187dbd7759637f8009686d560032a54b6.tar.gz LibGui-866c869187dbd7759637f8009686d560032a54b6.tar.bz2 LibGui-866c869187dbd7759637f8009686d560032a54b6.zip |
Merge branch 'master' into unstable/4.0
# Conflicts:
# gradle.properties
# src/main/java/io/github/cottonmc/cotton/gui/SyncedGuiDescription.java
# src/main/java/io/github/cottonmc/cotton/gui/impl/ScreenNetworkingImpl.java
# src/main/java/io/github/cottonmc/cotton/gui/impl/client/LibGuiClient.java
# src/main/resources/fabric.mod.json
-rw-r--r-- | build.gradle | 2 | ||||
-rw-r--r-- | src/main/java/io/github/cottonmc/cotton/gui/impl/ScreenNetworkingImpl.java | 12 | ||||
-rw-r--r-- | src/main/java/io/github/cottonmc/cotton/gui/impl/client/LibGuiClient.java | 8 |
3 files changed, 8 insertions, 14 deletions
diff --git a/build.gradle b/build.gradle index 074acc2..acb42bf 100644 --- a/build.gradle +++ b/build.gradle @@ -133,4 +133,4 @@ artifactory { } else { println "Cannot configure artifactory; please define ext.artifactoryUsername and ext.artifactoryPassword before running artifactoryPublish" } -}
\ No newline at end of file +} diff --git a/src/main/java/io/github/cottonmc/cotton/gui/impl/ScreenNetworkingImpl.java b/src/main/java/io/github/cottonmc/cotton/gui/impl/ScreenNetworkingImpl.java index a8d8921..58c7831 100644 --- a/src/main/java/io/github/cottonmc/cotton/gui/impl/ScreenNetworkingImpl.java +++ b/src/main/java/io/github/cottonmc/cotton/gui/impl/ScreenNetworkingImpl.java @@ -1,8 +1,5 @@ package io.github.cottonmc.cotton.gui.impl; -import net.fabricmc.api.EnvType; -import net.fabricmc.api.Environment; -import net.fabricmc.fabric.api.client.networking.v1.ClientPlayNetworking; import net.fabricmc.fabric.api.networking.v1.PacketByteBufs; import net.fabricmc.fabric.api.networking.v1.ServerPlayNetworking; import net.minecraft.entity.player.PlayerEntity; @@ -73,14 +70,7 @@ public class ScreenNetworkingImpl implements ScreenNetworking { }); } - @Environment(EnvType.CLIENT) - public static void initClient() { - ClientPlayNetworking.registerGlobalReceiver(SCREEN_MESSAGE_S2C, (client, networkHandler, buf, responseSender) -> { - handle(client, client.player, buf); - }); - } - - private static void handle(Executor executor, PlayerEntity player, PacketByteBuf buf) { + public static void handle(Executor executor, PlayerEntity player, PacketByteBuf buf) { ScreenHandler screenHandler = player.currentScreenHandler; // Packet data diff --git a/src/main/java/io/github/cottonmc/cotton/gui/impl/client/LibGuiClient.java b/src/main/java/io/github/cottonmc/cotton/gui/impl/client/LibGuiClient.java index 91ce7b7..ccb4a0a 100644 --- a/src/main/java/io/github/cottonmc/cotton/gui/impl/client/LibGuiClient.java +++ b/src/main/java/io/github/cottonmc/cotton/gui/impl/client/LibGuiClient.java @@ -1,6 +1,7 @@ package io.github.cottonmc.cotton.gui.impl.client; import net.fabricmc.api.ClientModInitializer; +import net.fabricmc.fabric.api.client.networking.v1.ClientPlayNetworking; import net.fabricmc.fabric.api.resource.ResourceManagerHelper; import net.fabricmc.loader.api.FabricLoader; import net.minecraft.resource.ResourceType; @@ -8,8 +9,8 @@ import net.minecraft.resource.ResourceType; import blue.endless.jankson.Jankson; import blue.endless.jankson.JsonElement; import blue.endless.jankson.JsonObject; -import io.github.cottonmc.cotton.gui.impl.ScreenNetworkingImpl; import io.github.cottonmc.jankson.JanksonFactory; +import io.github.cottonmc.cotton.gui.impl.ScreenNetworkingImpl; import org.apache.logging.log4j.LogManager; import org.apache.logging.log4j.Logger; @@ -28,8 +29,11 @@ public class LibGuiClient implements ClientModInitializer { public void onInitializeClient() { config = loadConfig(); - ScreenNetworkingImpl.initClient(); ResourceManagerHelper.get(ResourceType.CLIENT_RESOURCES).registerReloadListener(NinePatchInternals.MetadataLoader.INSTANCE); + + ClientPlayNetworking.registerGlobalReceiver(ScreenNetworkingImpl.SCREEN_MESSAGE_S2C, (client, networkHandler, buf, responseSender) -> { + ScreenNetworkingImpl.handle(client, client.player, buf); + }); } public static LibGuiConfig loadConfig() { |