Skip to content

Commit 31211c2

Browse files
committed
Fix tipped arrow and area effect cloud color
1 parent cb5fc9f commit 31211c2

File tree

1 file changed

+15
-1
lines changed

1 file changed

+15
-1
lines changed

common/src/main/java/com/viaversion/viaversion/protocols/protocol1_20_5to1_20_3/rewriter/EntityPacketRewriter1_20_5.java

Lines changed: 15 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -444,7 +444,14 @@ protected void registerRewrites() {
444444
if (metaIndex == 9) {
445445
// If the color is found first
446446
final Metadata particleData = event.metaAtIndex(11);
447-
addColor(particleData, meta.value());
447+
if (particleData == null) {
448+
// Add default particle with data
449+
final Particle particle = new Particle(protocol.getMappingData().getParticleMappings().mappedId("entity_effect"));
450+
particle.add(Type.INT, withAlpha(meta.value()));
451+
event.createExtraMeta(new Metadata(10, Types1_20_5.META_TYPES.particleType, particle));
452+
} else {
453+
addColor(particleData, meta.value());
454+
}
448455

449456
event.cancel();
450457
return;
@@ -463,6 +470,13 @@ protected void registerRewrites() {
463470
}
464471
});
465472

473+
filter().type(EntityTypes1_20_5.ARROW).index(10).handler((event, meta) -> {
474+
final int color = meta.value();
475+
if (color != -1) {
476+
meta.setValue(withAlpha(color));
477+
}
478+
});
479+
466480
filter().type(EntityTypes1_20_5.MINECART_ABSTRACT).index(11).handler((event, meta) -> {
467481
final int blockState = meta.value();
468482
meta.setValue(protocol.getMappingData().getNewBlockStateId(blockState));

0 commit comments

Comments
 (0)