Skip to content

Unable to find MultiBlockChangeInfo #3562

@kauansousaq12

Description

@kauansousaq12

Make sure you're doing the following

  • You're using the latest build for your server version
  • This isn't an issue caused by another plugin (tested on a clean server)
  • You've checked for duplicate issues
  • You didn't use /reload

Describe the question
ProtocolLib fails to initialize on a LeafSpigot 1.21.4 server, causing an ExceptionInInitializerError. This happens when a plugin attempts to use or create a MULTI_BLOCK_CHANGE packet, as ProtocolLib cannot find the internal NMS class for MultiBlockChangeInfo.

API method(s) used

  • ProtocolManager#createPacket(PacketType.Play.Server.MULTI_BLOCK_CHANGE)
  • PacketContainer#getMultiBlockChangeInfoArrays()
  • new MultiBlockChangeInfo(...)

Expected behavior
ProtocolLib should initialize correctly on the server and allow for the creation and sending of MULTI_BLOCK_CHANGE packets.

Code
This is a minimal example of the code that triggers the error. The error occurs when the MultiBlockChangeInfo class is first accessed.

// Simplified example from the project
Map<ChunkCoordIntPair, List<MultiBlockChangeInfo>> changesByChunk = new HashMap<>();
World world = player.getWorld();

for (int x = 0; x < 10; x++) {
    for (int y = 60; y < 70; y++) {
        for (int z = 0; z < 10; z++) {
            Location blockLocation = new Location(world, x, y, z);
            WrappedBlockData blockData = WrappedBlockData.createData(Material.STONE);

            // This line eventually causes the ExceptionInInitializerError
            MultiBlockChangeInfo changeInfo = new MultiBlockChangeInfo(blockLocation, blockData); 
            
            ChunkCoordIntPair chunkCoords = new ChunkCoordIntPair(x >> 4, z >> 4);
            changesByChunk.computeIfAbsent(chunkCoords, k -> new ArrayList<>()).add(changeInfo);
        }
    }
}
// The code crashes before the packet is even created or sent.

Additional context
java.lang.ExceptionInInitializerError: null
	at com.mina.packets.MinePacketManager.buildPacketsForMine(MinePacketManager.java:96)
	at com.mina.MinaPlugin.precomputeThemePackets(MinaPlugin.java:171)
	at com.mina.MinaPlugin.onEnable(MinaPlugin.java:103)
	... 12 more
Caused by: java.lang.RuntimeException: Unable to find MultiBlockChangeInfo (PacketPlayOutMultiBlockChange$MultiBlockChangeInfo)
	at com.comphenix.protocol.utility.MinecraftReflection.lambda$getMinecraftClass$5(MinecraftReflection.java:1582)
	at java.base.java.util.Optional.orElseThrow(Optional.java:403)
	at com.comphenix.protocol.utility.MinecraftReflection.getMinecraftClass(MinecraftReflection.java:1582)
	at com.comphenix.protocol.utility.MinecraftReflection.getMultiBlockChangeInfoClass(MinecraftReflection.java:1311)
	at com.comphenix.protocol.wrappers.MultiBlockChangeInfo.<clinit>(MultiBlockChangeInfo.java:37)
	... 15 more

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions