diff --git a/core/src/main/java/nl/matsv/viabackwards/protocol/protocol1_12_2to1_13/block_entity_handlers/BannerHandler.java b/core/src/main/java/nl/matsv/viabackwards/protocol/protocol1_12_2to1_13/block_entity_handlers/BannerHandler.java index dc51c327..11a50947 100644 --- a/core/src/main/java/nl/matsv/viabackwards/protocol/protocol1_12_2to1_13/block_entity_handlers/BannerHandler.java +++ b/core/src/main/java/nl/matsv/viabackwards/protocol/protocol1_12_2to1_13/block_entity_handlers/BannerHandler.java @@ -19,11 +19,11 @@ import us.myles.viaversion.libs.opennbt.tag.builtin.ListTag; import us.myles.viaversion.libs.opennbt.tag.builtin.Tag; public class BannerHandler implements BackwardsBlockEntityHandler { - private final int WALL_BANNER_START = 7110; // 4 each - private final int WALL_BANNER_STOP = 7173; + private static final int WALL_BANNER_START = 7110; // 4 each + private static final int WALL_BANNER_STOP = 7173; - private final int BANNER_START = 6854; // 16 each - private final int BANNER_STOP = 7109; + private static final int BANNER_START = 6854; // 16 each + private static final int BANNER_STOP = 7109; @Override public CompoundTag transform(UserConnection user, int blockId, CompoundTag tag) { diff --git a/core/src/main/java/nl/matsv/viabackwards/protocol/protocol1_12_2to1_13/block_entity_handlers/SkullHandler.java b/core/src/main/java/nl/matsv/viabackwards/protocol/protocol1_12_2to1_13/block_entity_handlers/SkullHandler.java index fd7b04f0..ea8ad321 100644 --- a/core/src/main/java/nl/matsv/viabackwards/protocol/protocol1_12_2to1_13/block_entity_handlers/SkullHandler.java +++ b/core/src/main/java/nl/matsv/viabackwards/protocol/protocol1_12_2to1_13/block_entity_handlers/SkullHandler.java @@ -16,12 +16,13 @@ import us.myles.viaversion.libs.opennbt.tag.builtin.ByteTag; import us.myles.viaversion.libs.opennbt.tag.builtin.CompoundTag; public class SkullHandler implements BackwardsBlockEntityHandler { - private final int SKULL_START = 5447; + private static final int SKULL_START = 5447; @Override public CompoundTag transform(UserConnection user, int blockId, CompoundTag tag) { - int pos = (blockId - SKULL_START) % 20; - byte type = (byte) Math.floor((blockId - SKULL_START) / 20); + int diff = blockId - SKULL_START; + int pos = diff % 20; + byte type = (byte) Math.floor(diff / 20f); // Set type tag.put(new ByteTag("SkullType", type)); diff --git a/core/src/main/java/nl/matsv/viabackwards/protocol/protocol1_12_2to1_13/data/BackwardsMappings.java b/core/src/main/java/nl/matsv/viabackwards/protocol/protocol1_12_2to1_13/data/BackwardsMappings.java index f6544550..dfb15f3a 100644 --- a/core/src/main/java/nl/matsv/viabackwards/protocol/protocol1_12_2to1_13/data/BackwardsMappings.java +++ b/core/src/main/java/nl/matsv/viabackwards/protocol/protocol1_12_2to1_13/data/BackwardsMappings.java @@ -36,18 +36,6 @@ public class BackwardsMappings { blockMappings = new BlockMappingsShortArray(mapping1_13.getAsJsonObject("blocks"), mapping1_12.getAsJsonObject("blocks"), mapping1_12_2to1_13.getAsJsonObject("blockstates")); ViaBackwards.getPlatform().getLogger().info("Loading 1.13 -> 1.12.2 sound mapping..."); soundMappings = new VBMappings(mapping1_13.getAsJsonArray("sounds"), mapping1_12.getAsJsonArray("sounds"), mapping1_12_2to1_13.getAsJsonObject("sounds")); - - /* - // Simulate some trident sounds - SOUNDS[628] = 138; // throw -> shoot - SOUNDS[629] = 137; // hit -> hit_player - SOUNDS[630] = 137; // hit_ground -> hit - SOUNDS[631] = 139; // riptide_1 -> shoot - SOUNDS[632] = 139; // riptide_2 - SOUNDS[633] = 139; // riptide_3 - SOUNDS[634] = 139; // throw -> shoot - // no fitting thunder remap - */ } // Has lots of compat layers, so we can't use the default Via method @@ -55,6 +43,7 @@ public class BackwardsMappings { for (Map.Entry entry : newIdentifiers.entrySet()) { String key = entry.getValue().getAsString(); Map.Entry value = MappingDataLoader.findValue(oldIdentifiers, key); + short hardId = -1; if (value == null) { JsonPrimitive replacement = mapping.getAsJsonPrimitive(key); if (replacement == null && key.contains("[")) { @@ -63,6 +52,7 @@ public class BackwardsMappings { if (replacement != null) { if (replacement.getAsString().startsWith("id:")) { String id = replacement.getAsString().replace("id:", ""); + hardId = Short.parseShort(id); value = MappingDataLoader.findValue(oldIdentifiers, oldIdentifiers.getAsJsonPrimitive(id).getAsString()); } else { value = MappingDataLoader.findValue(oldIdentifiers, replacement.getAsString()); @@ -79,7 +69,7 @@ public class BackwardsMappings { continue; } } - output[Integer.parseInt(entry.getKey())] = Short.parseShort(value.getKey()); + output[Integer.parseInt(entry.getKey())] = hardId != -1 ? hardId : Short.parseShort(value.getKey()); } }