Fix tipped arrow and area effect cloud color

This commit is contained in:
Nassim Jahnke 2024-05-08 20:28:55 +02:00
parent cb5fc9fb08
commit 31211c2214
No known key found for this signature in database
GPG Key ID: EF6771C01F6EF02F

View File

@ -444,7 +444,14 @@ public final class EntityPacketRewriter1_20_5 extends EntityRewriter<Clientbound
if (metaIndex == 9) { if (metaIndex == 9) {
// If the color is found first // If the color is found first
final Metadata particleData = event.metaAtIndex(11); final Metadata particleData = event.metaAtIndex(11);
addColor(particleData, 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));
} else {
addColor(particleData, meta.value());
}
event.cancel(); event.cancel();
return; return;
@ -463,6 +470,13 @@ public final class EntityPacketRewriter1_20_5 extends EntityRewriter<Clientbound
} }
}); });
filter().type(EntityTypes1_20_5.ARROW).index(10).handler((event, meta) -> {
final int color = meta.value();
if (color != -1) {
meta.setValue(withAlpha(color));
}
});
filter().type(EntityTypes1_20_5.MINECART_ABSTRACT).index(11).handler((event, meta) -> { filter().type(EntityTypes1_20_5.MINECART_ABSTRACT).index(11).handler((event, meta) -> {
final int blockState = meta.value(); final int blockState = meta.value();
meta.setValue(protocol.getMappingData().getNewBlockStateId(blockState)); meta.setValue(protocol.getMappingData().getNewBlockStateId(blockState));