Skip to content

Commit 5374c3b

Browse files
committed
Fix avatar arm handling in 1.21.11->1.21.9
1 parent 96e0d85 commit 5374c3b

File tree

1 file changed

+12
-8
lines changed

1 file changed

+12
-8
lines changed

common/src/main/java/com/viaversion/viabackwards/protocol/v1_21_11to1_21_9/rewriter/EntityPacketRewriter1_21_11.java

Lines changed: 12 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -54,15 +54,23 @@ public void registerPackets() {
5454
protected void registerRewrites() {
5555
final EntityDataTypes1_21_11 unmappedDataTypes = VersionedTypes.V1_21_11.entityDataTypes;
5656
final EntityDataTypes1_21_9 entityDataTypes = VersionedTypes.V1_21_9.entityDataTypes;
57-
filter().mapDataType(id -> {
58-
if (id == unmappedDataTypes.humanoidArmType.typeId() || id == unmappedDataTypes.zombieNautilusVariantType.typeId()) {
59-
return null;
57+
filter().handler((event, data) -> {
58+
if (data.dataType() == unmappedDataTypes.humanoidArmType) {
59+
final int arm = data.value();
60+
data.setTypeAndValue(entityDataTypes.byteType, (byte) arm);
61+
return;
62+
} else if (data.dataType() == unmappedDataTypes.zombieNautilusVariantType) {
63+
event.cancel();
64+
return;
6065
}
66+
67+
int id = data.dataType().typeId();
6168
if (id > unmappedDataTypes.zombieNautilusVariantType.typeId()) {
6269
id--;
6370
}
64-
return entityDataTypes.byId(id);
71+
data.setDataType(entityDataTypes.byId(id));
6572
});
73+
6674
registerEntityDataTypeHandler1_20_3(
6775
entityDataTypes.itemType,
6876
entityDataTypes.blockStateType,
@@ -73,10 +81,6 @@ protected void registerRewrites() {
7381
entityDataTypes.optionalComponentType
7482
);
7583

76-
filter().type(EntityTypes1_21_11.AVATAR).index(15).handler(((event, data) -> {
77-
final int arm = data.value();
78-
data.setTypeAndValue(entityDataTypes.byteType, (byte) arm);
79-
}));
8084
filter().type(EntityTypes1_21_11.WOLF).index(21).handler(this::absoluteToRelativeTicks);
8185
filter().type(EntityTypes1_21_11.BEE).index(18).handler(this::absoluteToRelativeTicks);
8286

0 commit comments

Comments
 (0)