Class LoginPacketSplitTest

java.lang.Object
net.neoforged.neoforge.oldtest.world.LoginPacketSplitTest

public class LoginPacketSplitTest extends Object
A test mod used to test splitting the ClientboundLoginPacket.
In order to test this works, first enable the packet. Start a local server and client. In the server console you should see how big the registryaccess in the packet would be, and how much % of the packet limit is represents.
Connect to the server from the client, and if you successfully connect and the /big_data command reports 50000 entries then the packet has been successfully split.

To test if the packet is too large simply remove the login packet from the GenericPacketSplitter and try connecting again. You should see the connection fail.
  • Field Details

    • LOG

      public static final org.slf4j.Logger LOG
    • MOD_ID

      public static final String MOD_ID
      See Also:
    • ENABLED

      public static final boolean ENABLED
      See Also:
    • GSON

      private static final com.google.gson.Gson GSON
    • BIG_DATA

      public static final net.minecraft.resources.ResourceKey<net.minecraft.core.Registry<LoginPacketSplitTest.BigData>> BIG_DATA
  • Constructor Details

    • LoginPacketSplitTest

      public LoginPacketSplitTest(net.neoforged.bus.api.IEventBus bus)
  • Method Details

    • generateEntries

      private void generateEntries(LoginPacketSplitTest.InMemoryResourcePack pack)
    • randomString

      private String randomString(Random random, int length)
    • writeJsonWithCodec

      public <T> void writeJsonWithCodec(net.minecraft.network.FriendlyByteBuf buf, com.mojang.serialization.Codec<T> codec, T instance)