Add missing dust_color_transition data remapping (changed in 24w03a)

This commit is contained in:
Gero 2024-04-19 11:02:01 +02:00
parent 1bb85b11e9
commit e08c263ced
2 changed files with 10 additions and 1 deletions

View File

@ -80,7 +80,7 @@ public class ParticleType extends DynamicType<Particle> {
particle.add(Type.FLOAT, Type.FLOAT.readPrimitive(buf)); // Red 0-1
particle.add(Type.FLOAT, Type.FLOAT.readPrimitive(buf)); // Green 0-1
particle.add(Type.FLOAT, Type.FLOAT.readPrimitive(buf)); // Blue 0-1
particle.add(Type.FLOAT, Type.FLOAT.readPrimitive(buf)); // Scale 0.01-4
particle.add(Type.FLOAT, Type.FLOAT.readPrimitive(buf)); // Scale 0.01-4 (moved to the end as of 24w03a / 1.20.5)
particle.add(Type.FLOAT, Type.FLOAT.readPrimitive(buf)); // Red
particle.add(Type.FLOAT, Type.FLOAT.readPrimitive(buf)); // Green
particle.add(Type.FLOAT, Type.FLOAT.readPrimitive(buf)); // Blue

View File

@ -214,6 +214,13 @@ public final class BlockItemPacketRewriter1_20_5 extends ItemRewriter<Clientboun
if (particle.id() == protocol.getMappingData().getParticleMappings().mappedId("entity_effect")) {
particle.add(Type.INT, data != 0 ? ThreadLocalRandom.current().nextInt() : 0); // rgb
}
if (particle.id() == protocol.getMappingData().getParticleMappings().mappedId("dust_color_transition")) {
for (int i = 0; i < 7; i++) {
particle.add(Type.FLOAT, wrapper.read(Type.FLOAT));
}
// fromColor, scale, toColor -> fromColor, toColor, scale
particle.add(Type.FLOAT, particle.<Float> removeArgument(3).getValue());
}
if (mappings.isBlockParticle(particleId)) {
final int blockStateId = wrapper.read(Type.VAR_INT);
@ -223,6 +230,8 @@ public final class BlockItemPacketRewriter1_20_5 extends ItemRewriter<Clientboun
particle.add(Types1_20_5.ITEM, item);
}
// TODO: We should read the particle data of every particle.
// Otherwise reading the particle type in future versions will be broken.
wrapper.write(Types1_20_5.PARTICLE, particle);
});