Skip to content

Commit 44dbbf3

Browse files
committed
Remove saddle slot group from enchantments in 1.21.5->1.21.4
Fixes #1033
1 parent def010c commit 44dbbf3

File tree

1 file changed

+20
-0
lines changed

1 file changed

+20
-0
lines changed

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

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -119,6 +119,12 @@ public RegistryEntry[] handle(final UserConnection connection, final String key,
119119
updateTrim(entries, trimPatternRegistry ? "template_item" : "ingredient");
120120
return super.handle(connection, key, entries);
121121
}
122+
123+
if (key.equals("enchantment")) {
124+
updateEnchantment(entries);
125+
return super.handle(connection, key, entries);
126+
}
127+
122128
if (!key.equals("wolf_variant")) {
123129
return super.handle(connection, key, entries);
124130
}
@@ -209,6 +215,20 @@ private void updateTrim(final RegistryEntry[] entries, final String itemKey) {
209215
});
210216
}
211217

218+
private void updateEnchantment(final RegistryEntry[] entries) {
219+
for (final RegistryEntry entry : entries) {
220+
if (entry.tag() == null) {
221+
continue;
222+
}
223+
224+
final CompoundTag enchantment = (CompoundTag) entry.tag();
225+
final ListTag<StringTag> slots = enchantment.getListTag("slots", StringTag.class);
226+
if (slots != null) {
227+
slots.getValue().removeIf(tag -> tag.getValue().equals("saddle")); // Remove saddle slot
228+
}
229+
}
230+
}
231+
212232
private String visibility(final int id) {
213233
return switch (id) {
214234
case 0 -> "always";

0 commit comments

Comments
 (0)