Actually add properties tag in 1.20.5->1.20.4 item handler

This commit is contained in:
Nassim Jahnke 2024-05-09 17:21:53 +02:00
parent 69b33dc2d2
commit 3dfc3bb15b
No known key found for this signature in database
GPG Key ID: EF6771C01F6EF02F
2 changed files with 9 additions and 5 deletions

View File

@ -444,13 +444,16 @@ public final class EntityPacketRewriter1_20_5 extends EntityRewriter<Clientbound
if (metaIndex == 9) {
// If the color is found first
final Metadata particleData = event.metaAtIndex(11);
final int color = meta.value();
if (particleData == null) {
// Add default particle with data
final Particle particle = new Particle(protocol.getMappingData().getParticleMappings().mappedId("entity_effect"));
particle.add(Type.INT, withAlpha(meta.value()));
event.createExtraMeta(new Metadata(10, Types1_20_5.META_TYPES.particleType, particle));
if (color != 0) {
// Add default particle with data
final Particle particle = new Particle(protocol.getMappingData().getParticleMappings().mappedId("entity_effect"));
particle.add(Type.INT, withAlpha(color));
event.createExtraMeta(new Metadata(10, Types1_20_5.META_TYPES.particleType, particle));
}
} else {
addColor(particleData, meta.value());
addColor(particleData, color);
}
event.cancel();

View File

@ -264,6 +264,7 @@ public final class StructuredDataConverter {
values.add(propertyTag);
propertiesTag.put(property.name(), values);
}
profileTag.put("Properties", propertiesTag);
});
register(StructuredDataKey.INSTRUMENT, (data, tag) -> {
// Can't do anything with direct values