From c2d72214de586f9641620cac19e98f500bb52eb0 Mon Sep 17 00:00:00 2001 From: Marco Date: Thu, 30 May 2019 15:36:11 +0200 Subject: [PATCH] impl first block id remaps --- .../Protocol1_13_2To1_14.java | 16 ++++++++++++++-- .../data/BackwardsMappings.java | 4 +++- .../packets/BlockItemPackets1_14.java | 2 +- 3 files changed, 18 insertions(+), 4 deletions(-) diff --git a/core/src/main/java/nl/matsv/viabackwards/protocol/protocol1_13_2to1_14/Protocol1_13_2To1_14.java b/core/src/main/java/nl/matsv/viabackwards/protocol/protocol1_13_2to1_14/Protocol1_13_2To1_14.java index 9ce4f822..38999475 100644 --- a/core/src/main/java/nl/matsv/viabackwards/protocol/protocol1_13_2to1_14/Protocol1_13_2To1_14.java +++ b/core/src/main/java/nl/matsv/viabackwards/protocol/protocol1_13_2to1_14/Protocol1_13_2To1_14.java @@ -16,6 +16,7 @@ import us.myles.ViaVersion.api.remapper.PacketHandler; import us.myles.ViaVersion.api.remapper.PacketRemapper; import us.myles.ViaVersion.api.type.Type; import us.myles.ViaVersion.packets.State; +import us.myles.ViaVersion.protocols.protocol1_14to1_13_2.data.MappingData; import us.myles.ViaVersion.protocols.protocol1_9_3to1_9_1_2.storage.ClientWorld; @Getter @@ -266,14 +267,25 @@ public class Protocol1_13_2To1_14 extends BackwardsProtocol { } public static int getNewBlockStateId(int id) { - int newId = BackwardsMappings.blockMappings.getNewBlock(id); + int newId = BackwardsMappings.blockStateMappings.getNewBlock(id); if (newId == -1) { - ViaBackwards.getPlatform().getLogger().warning("Missing 1.14 block for 1.13.2 block " + id); + ViaBackwards.getPlatform().getLogger().warning("Missing 1.14 blockstate id for 1.13.2 block " + id); return 0; } return newId; } + + public static int getNewBlockId(int id) { + int newId = BackwardsMappings.blockMappings.getNewBlock(id); + if (newId == -1) { + ViaBackwards.getPlatform().getLogger().warning("Missing 1.14 block id for 1.13.2 block " + id); + return 0; + } + return newId; + } + + @Override public void init(UserConnection user) { // Register ClientWorld diff --git a/core/src/main/java/nl/matsv/viabackwards/protocol/protocol1_13_2to1_14/data/BackwardsMappings.java b/core/src/main/java/nl/matsv/viabackwards/protocol/protocol1_13_2to1_14/data/BackwardsMappings.java index cf11e798..9a8ba24b 100644 --- a/core/src/main/java/nl/matsv/viabackwards/protocol/protocol1_13_2to1_14/data/BackwardsMappings.java +++ b/core/src/main/java/nl/matsv/viabackwards/protocol/protocol1_13_2to1_14/data/BackwardsMappings.java @@ -14,6 +14,7 @@ import java.util.Arrays; import java.util.Map; public class BackwardsMappings { + public static BlockMappings blockStateMappings; public static BlockMappings blockMappings; public static void init() { @@ -22,7 +23,8 @@ public class BackwardsMappings { JsonObject mapping1_13_2to1_14 = loadData("mapping-1.13.2to1.14.json"); ViaBackwards.getPlatform().getLogger().info("Loading 1.14 -> 1.13.2 block mapping..."); - blockMappings = new BlockMappingsShortArray(mapping1_14.getAsJsonObject("blockstates"), mapping1_13_2.getAsJsonObject("blockstates"), mapping1_13_2to1_14.getAsJsonObject("blockstates")); + blockStateMappings = new BlockMappingsShortArray(mapping1_14.getAsJsonObject("blockstates"), mapping1_13_2.getAsJsonObject("blockstates"), mapping1_13_2to1_14.getAsJsonObject("blockstates")); + blockMappings = new BlockMappingsShortArray(mapping1_14.getAsJsonObject("blocks"), mapping1_13_2.getAsJsonObject("blocks"), mapping1_13_2to1_14.getAsJsonObject("blocks")); } diff --git a/core/src/main/java/nl/matsv/viabackwards/protocol/protocol1_13_2to1_14/packets/BlockItemPackets1_14.java b/core/src/main/java/nl/matsv/viabackwards/protocol/protocol1_13_2to1_14/packets/BlockItemPackets1_14.java index 8bbf8ed1..c5aafe1f 100644 --- a/core/src/main/java/nl/matsv/viabackwards/protocol/protocol1_13_2to1_14/packets/BlockItemPackets1_14.java +++ b/core/src/main/java/nl/matsv/viabackwards/protocol/protocol1_13_2to1_14/packets/BlockItemPackets1_14.java @@ -449,7 +449,7 @@ public class BlockItemPackets1_14 extends BlockItemRewriter