From 9ffa737a4d2aacf4f2e57eabced39236361b3b59 Mon Sep 17 00:00:00 2001 From: Nassim Jahnke Date: Thu, 16 Sep 2021 14:19:45 +0200 Subject: [PATCH] Implement BlockEntity sectionX/Z methods --- .../viaversion/api/minecraft/blockentity/BlockEntity.java | 8 ++++---- .../protocols/protocol1_18to1_17_1/BlockEntityIds.java | 4 ++++ .../protocol1_18to1_17_1/packets/WorldPackets.java | 1 - 3 files changed, 8 insertions(+), 5 deletions(-) diff --git a/api/src/main/java/com/viaversion/viaversion/api/minecraft/blockentity/BlockEntity.java b/api/src/main/java/com/viaversion/viaversion/api/minecraft/blockentity/BlockEntity.java index ba6a3a1bc..5cd78634d 100644 --- a/api/src/main/java/com/viaversion/viaversion/api/minecraft/blockentity/BlockEntity.java +++ b/api/src/main/java/com/viaversion/viaversion/api/minecraft/blockentity/BlockEntity.java @@ -27,12 +27,12 @@ import org.checkerframework.checker.nullness.qual.Nullable; public interface BlockEntity { - default byte relX() { - return -1; //TODO + default byte sectionX() { + return (byte) ((packedXZ() >> 4) & 15); } - default byte relZ() { - return -1; //TODO + default byte sectionZ() { + return (byte) (packedXZ() & 15); } byte packedXZ(); diff --git a/common/src/main/java/com/viaversion/viaversion/protocols/protocol1_18to1_17_1/BlockEntityIds.java b/common/src/main/java/com/viaversion/viaversion/protocols/protocol1_18to1_17_1/BlockEntityIds.java index 70cf47bf4..83e53c2eb 100644 --- a/common/src/main/java/com/viaversion/viaversion/protocols/protocol1_18to1_17_1/BlockEntityIds.java +++ b/common/src/main/java/com/viaversion/viaversion/protocols/protocol1_18to1_17_1/BlockEntityIds.java @@ -50,4 +50,8 @@ public final class BlockEntityIds { } return newId; } + + public static int[] getIds() { + return IDS; + } } diff --git a/common/src/main/java/com/viaversion/viaversion/protocols/protocol1_18to1_17_1/packets/WorldPackets.java b/common/src/main/java/com/viaversion/viaversion/protocols/protocol1_18to1_17_1/packets/WorldPackets.java index 77062e658..6587a13e3 100644 --- a/common/src/main/java/com/viaversion/viaversion/protocols/protocol1_18to1_17_1/packets/WorldPackets.java +++ b/common/src/main/java/com/viaversion/viaversion/protocols/protocol1_18to1_17_1/packets/WorldPackets.java @@ -144,7 +144,6 @@ public final class WorldPackets { } // Fill biome palette - //TODO Use single value palette if given the possibility final DataPaletteImpl biomePalette = new DataPaletteImpl(); section.addPalette(PaletteType.BIOMES, biomePalette); for (int biomeIndex = i * BIOMES_PER_CHUNK; biomeIndex < (i * BIOMES_PER_CHUNK) + BIOMES_PER_CHUNK; biomeIndex++) {