From 78a667c5b9df7f8d5b7e171247c108550053452f Mon Sep 17 00:00:00 2001 From: FlorianMichael <60033407+FlorianMichael@users.noreply.github.com> Date: Fri, 26 Apr 2024 15:15:24 +0200 Subject: [PATCH] Add constructors to LegacyBlockItemRewriter to define item types --- .../api/rewriters/LegacyBlockItemRewriter.java | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/common/src/main/java/com/viaversion/viabackwards/api/rewriters/LegacyBlockItemRewriter.java b/common/src/main/java/com/viaversion/viabackwards/api/rewriters/LegacyBlockItemRewriter.java index ef3da73b..b4240e0e 100644 --- a/common/src/main/java/com/viaversion/viabackwards/api/rewriters/LegacyBlockItemRewriter.java +++ b/common/src/main/java/com/viaversion/viabackwards/api/rewriters/LegacyBlockItemRewriter.java @@ -59,14 +59,22 @@ public abstract class LegacyBlockItemRewriter replacementData = new Int2ObjectOpenHashMap<>(8); // Raw id -> mapped data - protected LegacyBlockItemRewriter(T protocol, String name) { - super(protocol, Type.ITEM1_8, Type.ITEM1_8_SHORT_ARRAY, false); + protected LegacyBlockItemRewriter(T protocol, String name, Type itemType, Type itemArrayType, Type mappedItemType, Type mappedItemArrayType) { + super(protocol, itemType, itemArrayType, mappedItemType, mappedItemArrayType, false); final JsonObject jsonObject = readMappingsFile("item-mappings-" + name + ".json"); for (final MappedLegacyBlockItem.Type value : MappedLegacyBlockItem.Type.values()) { addMappings(value, jsonObject, replacementData); } } + protected LegacyBlockItemRewriter(T protocol, String name, Type itemType, Type itemArrayType) { + this(protocol, name, itemType, itemArrayType, itemType, itemArrayType); + } + + protected LegacyBlockItemRewriter(T protocol, String name) { + this(protocol, name, Type.ITEM1_8, Type.ITEM1_8_SHORT_ARRAY); + } + private void addMappings(MappedLegacyBlockItem.Type type, JsonObject object, Int2ObjectMap mappings) { if (object.has(type.getName())) { final JsonObject mappingsObject = object.getAsJsonObject(type.getName());