comment out netty code

It broke MC 1.16
This commit is contained in:
James Seibel
2023-08-05 22:32:57 -05:00
parent ea9cb7fcac
commit 9f0378f969
3 changed files with 42 additions and 39 deletions
+3 -1
View File
@@ -31,6 +31,7 @@ def writeBuildGradlePredefine(List<String> 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") {
@@ -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()
@@ -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)