Skip to content

Commit b268342

Browse files
authored
Fix frog and cat variant mapping in 1.21.5->1.21.4 (#1183)
1 parent bb61f4d commit b268342

1 file changed

Lines changed: 30 additions & 0 deletions

File tree

common/src/main/java/com/viaversion/viabackwards/protocol/v1_21_5to1_21_4/rewriter/EntityPacketRewriter1_21_5.java

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -168,6 +168,36 @@ protected void registerRewrites() {
168168
final Holder<WolfVariant> variant = Holder.of(type);
169169
data.setTypeAndValue(mappedEntityDataTypes.wolfVariantType, variant);
170170
return;
171+
} else if (id == entityDataTypes.frogVariantType.typeId()) {
172+
final int value = data.value();
173+
final String variantKey = protocol.getRegistryDataRewriter().getMappings("frog_variant").idToKey(value);
174+
final int newValue = (variantKey == null) ? 0 : switch (variantKey) {
175+
case "cold" -> 2;
176+
case "temperate" -> 0;
177+
case "warm" -> 1;
178+
default -> 0;
179+
};
180+
data.setTypeAndValue(mappedEntityDataTypes.frogVariantType, newValue);
181+
return;
182+
} else if (id == entityDataTypes.catVariantType.typeId()) {
183+
final int value = data.value();
184+
final String variantKey = protocol.getRegistryDataRewriter().getMappings("cat_variant").idToKey(value);
185+
final int newValue = (variantKey == null) ? 1 : switch (variantKey) {
186+
case "all_black" -> 10;
187+
case "black" -> 1;
188+
case "british_shorthair" -> 4;
189+
case "calico" -> 5;
190+
case "jellie" -> 9;
191+
case "persian" -> 6;
192+
case "ragdoll" -> 7;
193+
case "red" -> 2;
194+
case "siamese" -> 3;
195+
case "tabby" -> 0;
196+
case "white" -> 8;
197+
default -> 1;
198+
};
199+
data.setTypeAndValue(mappedEntityDataTypes.catVariantType, newValue);
200+
return;
171201
}
172202

173203
int mappedId = id;

0 commit comments

Comments
 (0)