From 9f0378f969dc2cbd5256b20e3dbe10d75741c904 Mon Sep 17 00:00:00 2001 From: James Seibel Date: Sat, 5 Aug 2023 22:32:57 -0500 Subject: [PATCH] comment out netty code It broke MC 1.16 --- build.gradle | 4 +- .../fabric/FabricClientProxy.java | 25 ++++----- .../forge/ForgeClientProxy.java | 52 +++++++++---------- 3 files changed, 42 insertions(+), 39 deletions(-) diff --git a/build.gradle b/build.gradle index 5de3df15a..eb6d75521 100644 --- a/build.gradle +++ b/build.gradle @@ -31,6 +31,7 @@ def writeBuildGradlePredefine(List mcVers, int mcIndex) { if (mcIndex < i) { // exclusive before + // FIXME doesn't function correctly for 1.16.5 (IE the first item in the list) redefineList.add("PRE_MC_" + mcStr) } if (mcIndex <= i) { @@ -230,7 +231,8 @@ subprojects { p -> forgeShadowMe("com.formdev:flatlaf-extras:${rootProject.flatlaf_version}") // Netty - forgeShadowMe("io.netty:netty-all:${rootProject.netty_version}") + // Breaks 1.16.5 + //forgeShadowMe("io.netty:netty-all:${rootProject.netty_version}") // Remember, for lwjgl dependencies that arent included in Minecraft, you need to also need to add it to the ShadowJar thing forgeShadowMe("org.lwjgl:lwjgl-jawt:3.2.2") { diff --git a/fabric/src/main/java/com/seibel/distanthorizons/fabric/FabricClientProxy.java b/fabric/src/main/java/com/seibel/distanthorizons/fabric/FabricClientProxy.java index 9b4b90f0f..f0bebd978 100644 --- a/fabric/src/main/java/com/seibel/distanthorizons/fabric/FabricClientProxy.java +++ b/fabric/src/main/java/com/seibel/distanthorizons/fabric/FabricClientProxy.java @@ -37,7 +37,7 @@ import com.seibel.distanthorizons.core.wrapperInterfaces.world.IClientLevelWrapp import com.seibel.distanthorizons.coreapi.ModInfo; import com.seibel.distanthorizons.fabric.wrappers.modAccessor.ImmersivePortalsAccessor; import com.seibel.distanthorizons.fabric.wrappers.modAccessor.SodiumAccessor; -import io.netty.buffer.ByteBuf; +//import io.netty.buffer.ByteBuf; import net.fabricmc.api.EnvType; import net.fabricmc.api.Environment; import net.fabricmc.fabric.api.client.event.lifecycle.v1.ClientChunkEvents; @@ -218,6 +218,7 @@ public class FabricClientProxy GL15.glPopMatrix(); GL15.glPushMatrix(); + // TODO this doesn't work in 1.16 GL15.glLoadMatrixf(matrixFloatArray); GL15.glMatrixMode(glMatrixMode); @@ -251,17 +252,17 @@ public class FabricClientProxy // networking event // //==================// - ClientPlayNetworking.registerGlobalReceiver(new ResourceLocation(ModInfo.NETWORKING_RESOURCE_NAMESPACE, ModInfo.MULTIVERSE_PLUGIN_NAMESPACE), - (Minecraft client, ClientPacketListener handler, FriendlyByteBuf friendlyByteBuf, PacketSender responseSender) -> - { - // converting to a ByteBuf is necessary otherwise Fabric will complain when the game boots - ByteBuf nettyByteBuf = friendlyByteBuf.asByteBuf(); - - // remove the Bukkit/Forge packet ID byte - nettyByteBuf.readByte(); - - ClientApi.INSTANCE.serverMessageReceived(nettyByteBuf); - }); +// ClientPlayNetworking.registerGlobalReceiver(new ResourceLocation(ModInfo.NETWORKING_RESOURCE_NAMESPACE, ModInfo.MULTIVERSE_PLUGIN_NAMESPACE), +// (Minecraft client, ClientPacketListener handler, FriendlyByteBuf friendlyByteBuf, PacketSender responseSender) -> +// { +// // converting to a ByteBuf is necessary otherwise Fabric will complain when the game boots +// ByteBuf nettyByteBuf = friendlyByteBuf.asByteBuf(); +// +// // remove the Bukkit/Forge packet ID byte +// nettyByteBuf.readByte(); +// +// ClientApi.INSTANCE.serverMessageReceived(nettyByteBuf); +// }); } public void onKeyInput() diff --git a/forge/src/main/java/com/seibel/distanthorizons/forge/ForgeClientProxy.java b/forge/src/main/java/com/seibel/distanthorizons/forge/ForgeClientProxy.java index 5a92eab0a..7e088cce5 100644 --- a/forge/src/main/java/com/seibel/distanthorizons/forge/ForgeClientProxy.java +++ b/forge/src/main/java/com/seibel/distanthorizons/forge/ForgeClientProxy.java @@ -28,7 +28,7 @@ import com.seibel.distanthorizons.core.wrapperInterfaces.chunk.IChunkWrapper; import com.seibel.distanthorizons.core.wrapperInterfaces.minecraft.IMinecraftClientWrapper; import com.seibel.distanthorizons.core.wrapperInterfaces.world.IClientLevelWrapper; import com.seibel.distanthorizons.coreapi.ModInfo; -import io.netty.buffer.ByteBuf; +//import io.netty.buffer.ByteBuf; import net.minecraft.resources.ResourceLocation; import net.minecraft.world.level.LevelAccessor; @@ -45,8 +45,8 @@ import net.minecraftforge.event.entity.player.PlayerInteractEvent; import net.minecraft.world.level.chunk.ChunkAccess; import net.minecraftforge.fml.event.lifecycle.FMLClientSetupEvent; -import net.minecraftforge.network.NetworkRegistry; -import net.minecraftforge.network.simple.SimpleChannel; +//import net.minecraftforge.network.NetworkRegistry; +//import net.minecraftforge.network.simple.SimpleChannel; import org.apache.logging.log4j.Logger; import org.lwjgl.glfw.GLFW; @@ -69,7 +69,7 @@ public class ForgeClientProxy private static final IMinecraftClientWrapper MC = SingletonInjector.INSTANCE.get(IMinecraftClientWrapper.class); private static final Logger LOGGER = DhLoggerBuilder.getLogger(); - private static SimpleChannel multiversePluginChannel; +// private static SimpleChannel multiversePluginChannel; #if PRE_MC_1_19_2 @@ -248,28 +248,28 @@ public class ForgeClientProxy /** @param event this is just to ensure the event is called at the right time, if it is called outside the {@link FMLClientSetupEvent} event, the binding may fail */ public static void setupNetworkingListeners(FMLClientSetupEvent event) { - multiversePluginChannel = NetworkRegistry.newSimpleChannel( - new ResourceLocation(ModInfo.NETWORKING_RESOURCE_NAMESPACE, ModInfo.MULTIVERSE_PLUGIN_NAMESPACE), - // network protocol version - () -> ModInfo.MULTIVERSE_PLUGIN_PROTOCOL_VERSION +"", - // client accepted versions - ForgeClientProxy::isReceivedProtocolVersionAcceptable, - // server accepted versions - ForgeClientProxy::isReceivedProtocolVersionAcceptable - ); - - multiversePluginChannel.registerMessage(0/*should be incremented for each simple channel we listen to*/, ByteBuf.class, - // encoder - (pack, friendlyByteBuf) -> { }, - // decoder - (friendlyByteBuf) -> friendlyByteBuf.asByteBuf(), - // message consumer - (nettyByteBuf, contextRef) -> - { - ClientApi.INSTANCE.serverMessageReceived(nettyByteBuf); - contextRef.get().setPacketHandled(true); - } - ); +// multiversePluginChannel = NetworkRegistry.newSimpleChannel( +// new ResourceLocation(ModInfo.NETWORKING_RESOURCE_NAMESPACE, ModInfo.MULTIVERSE_PLUGIN_NAMESPACE), +// // network protocol version +// () -> ModInfo.MULTIVERSE_PLUGIN_PROTOCOL_VERSION +"", +// // client accepted versions +// ForgeClientProxy::isReceivedProtocolVersionAcceptable, +// // server accepted versions +// ForgeClientProxy::isReceivedProtocolVersionAcceptable +// ); +// +// multiversePluginChannel.registerMessage(0/*should be incremented for each simple channel we listen to*/, ByteBuf.class, +// // encoder +// (pack, friendlyByteBuf) -> { }, +// // decoder +// (friendlyByteBuf) -> friendlyByteBuf.asByteBuf(), +// // message consumer +// (nettyByteBuf, contextRef) -> +// { +// ClientApi.INSTANCE.serverMessageReceived(nettyByteBuf); +// contextRef.get().setPacketHandled(true); +// } +// ); } public static boolean isReceivedProtocolVersionAcceptable(String versionString)