From 1b4dbc13887286dd066fa13cf35277957f16f834 Mon Sep 17 00:00:00 2001 From: Nassim Jahnke Date: Thu, 2 Feb 2023 12:10:50 +0100 Subject: [PATCH] Fix comparator directions in 1.13->1.12 Fixes #524 --- .../data/BackwardsMappings.java | 16 ++++++++++++++-- 1 file changed, 14 insertions(+), 2 deletions(-) diff --git a/common/src/main/java/com/viaversion/viabackwards/protocol/protocol1_12_2to1_13/data/BackwardsMappings.java b/common/src/main/java/com/viaversion/viabackwards/protocol/protocol1_12_2to1_13/data/BackwardsMappings.java index 6299dbf3..8a0020c2 100644 --- a/common/src/main/java/com/viaversion/viabackwards/protocol/protocol1_12_2to1_13/data/BackwardsMappings.java +++ b/common/src/main/java/com/viaversion/viabackwards/protocol/protocol1_12_2to1_13/data/BackwardsMappings.java @@ -32,11 +32,10 @@ import com.viaversion.viaversion.libs.gson.JsonObject; import com.viaversion.viaversion.libs.gson.JsonPrimitive; import com.viaversion.viaversion.protocols.protocol1_13to1_12_2.Protocol1_13To1_12_2; import com.viaversion.viaversion.protocols.protocol1_13to1_12_2.data.StatisticMappings; -import org.checkerframework.checker.nullness.qual.Nullable; - import java.util.Arrays; import java.util.HashMap; import java.util.Map; +import org.checkerframework.checker.nullness.qual.Nullable; public class BackwardsMappings extends com.viaversion.viabackwards.api.data.BackwardsMappings { private final Int2ObjectMap statisticMappings = new Int2ObjectOpenHashMap<>(); @@ -109,6 +108,19 @@ public class BackwardsMappings extends com.viaversion.viabackwards.api.data.Back @Override public int getNewBlockStateId(int id) { + // Comparator funkyness: https://github.com/ViaVersion/ViaBackwards/issues/524 + if (id >= 5635 && id <= 5650) { + if (id < 5639) { + id += 4; + } else if (id < 5643) { + id -= 4; + } else if (id < 5647) { + id += 4; + } else { + id -= 4; + } + } + int mappedId = super.getNewBlockStateId(id); // https://github.com/ViaVersion/ViaBackwards/issues/290