Fix finish configuration state change

This commit is contained in:
Nassim Jahnke 2024-10-14 15:13:46 +02:00
parent 84bd1d0782
commit 6fd421d36e
No known key found for this signature in database
GPG Key ID: EF6771C01F6EF02F
4 changed files with 11 additions and 3 deletions

View File

@ -198,6 +198,14 @@ public abstract class AbstractProtocol<CU extends ClientboundPacketType, CM exte
}
}
public void registerFinishConfiguration(final CU packetType, final PacketHandler handler) {
registerClientbound(packetType, wrapper -> {
// TODO Temporary solution to handle the finish configuration packet already having changed our tracked protocol state in a previous handler
wrapper.user().getProtocolInfo().setServerState(State.CONFIGURATION);
handler.handle(wrapper);
});
}
@Override
public final void loadMappingData() {
getMappingData().load();

View File

@ -70,7 +70,7 @@ public final class EntityPacketRewriter1_21 extends EntityRewriter<ClientboundPa
}
});
protocol.registerClientbound(ClientboundConfigurationPackets1_20_5.FINISH_CONFIGURATION, wrapper -> {
protocol.registerFinishConfiguration(ClientboundConfigurationPackets1_20_5.FINISH_CONFIGURATION, wrapper -> {
// Add new registries
final PacketWrapper paintingRegistryPacket = wrapper.create(ClientboundConfigurationPackets1_20_5.REGISTRY_DATA);
paintingRegistryPacket.write(Types.STRING, "minecraft:painting_variant");

View File

@ -129,7 +129,7 @@ public final class Protocol1_21To1_21_2 extends AbstractProtocol<ClientboundPack
wrapper.passthrough(Types.BYTE); // View distance
wrapper.passthrough(Types.VAR_INT); // Chat visibility
wrapper.passthrough(Types.BOOLEAN); // Chat colors
wrapper.passthrough(Types.BYTE); // Skin parts
wrapper.passthrough(Types.UNSIGNED_BYTE); // Skin parts
wrapper.passthrough(Types.VAR_INT); // Main hand
wrapper.passthrough(Types.BOOLEAN); // Text filtering enabled
wrapper.passthrough(Types.BOOLEAN); // Allow listing

View File

@ -60,7 +60,7 @@ public final class EntityPacketRewriter1_21_2 extends EntityRewriter<Clientbound
registerSetEntityData(ClientboundPackets1_21.SET_ENTITY_DATA, Types1_21.ENTITY_DATA_LIST, Types1_21_2.ENTITY_DATA_LIST);
registerRemoveEntities(ClientboundPackets1_21.REMOVE_ENTITIES);
protocol.registerClientbound(ClientboundConfigurationPackets1_21.FINISH_CONFIGURATION, wrapper -> {
protocol.registerFinishConfiguration(ClientboundConfigurationPackets1_21.FINISH_CONFIGURATION, wrapper -> {
final PacketWrapper instrumentsPacket = wrapper.create(ClientboundConfigurationPackets1_21.REGISTRY_DATA);
instrumentsPacket.write(Types.STRING, "minecraft:instrument");
final RegistryEntry[] entries = new RegistryEntry[GOAT_HORN_INSTRUMENTS.length];