From b146c9928fbd03cc510d6f0aa64fb93cb4cc8761 Mon Sep 17 00:00:00 2001 From: YoyoNow Date: Sat, 16 May 2026 14:08:29 +0200 Subject: [PATCH 1/2] Fix FlatteningWrapper --- .../src/de/steamwar/core/FlatteningWrapper.java | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-) diff --git a/SpigotCore/SpigotCore_Main/src/de/steamwar/core/FlatteningWrapper.java b/SpigotCore/SpigotCore_Main/src/de/steamwar/core/FlatteningWrapper.java index a9375b7a..e08b9a9e 100644 --- a/SpigotCore/SpigotCore_Main/src/de/steamwar/core/FlatteningWrapper.java +++ b/SpigotCore/SpigotCore_Main/src/de/steamwar/core/FlatteningWrapper.java @@ -329,10 +329,6 @@ public class FlatteningWrapper { } } - public void setNamedSpawnPacketDataWatcher(Object packet) { - // field not present - } - public Object formatDisplayName(String displayName) { return displayName != null ? Optional.of(ChatWrapper.impl.stringToChatComponent(displayName)) : Optional.empty(); } @@ -340,7 +336,7 @@ public class FlatteningWrapper { private static final Reflection.Field spawnType = Reflection.getField(ProtocolWrapper.spawnPacket, net.minecraft.world.entity.EntityType.class, 0); public void setSpawnPacketType(Object packet, EntityType type) { ResourceLocation key = CraftNamespacedKey.toMinecraft(type.getKey()); - spawnType.set(packet, BuiltInRegistries.ENTITY_TYPE.get(key)); + spawnType.set(packet, BuiltInRegistries.ENTITY_TYPE.get(key).get().value()); } public int getViewDistance(Player player) { From f1fbe14e60132c28054e31bbf9a4995e09941494 Mon Sep 17 00:00:00 2001 From: YoyoNow Date: Sat, 16 May 2026 14:27:07 +0200 Subject: [PATCH 2/2] Fix ChunkHider --- .../SpigotCore_Main/src/de/steamwar/Reflection.java | 4 ++++ .../src/de/steamwar/techhider/ChunkHider.java | 8 +++++++- 2 files changed, 11 insertions(+), 1 deletion(-) diff --git a/SpigotCore/SpigotCore_Main/src/de/steamwar/Reflection.java b/SpigotCore/SpigotCore_Main/src/de/steamwar/Reflection.java index 602c1681..3230e84e 100644 --- a/SpigotCore/SpigotCore_Main/src/de/steamwar/Reflection.java +++ b/SpigotCore/SpigotCore_Main/src/de/steamwar/Reflection.java @@ -202,6 +202,10 @@ public final class Reflection { } } + public static Field getField(Class target, String name, Class fieldType) { + return getField(target, name, fieldType, 0); + } + public static Field getField(Class target, Class fieldType, int index) { return getField(target, null, fieldType, index); } diff --git a/SpigotCore/SpigotCore_Main/src/de/steamwar/techhider/ChunkHider.java b/SpigotCore/SpigotCore_Main/src/de/steamwar/techhider/ChunkHider.java index 112970cf..65143215 100644 --- a/SpigotCore/SpigotCore_Main/src/de/steamwar/techhider/ChunkHider.java +++ b/SpigotCore/SpigotCore_Main/src/de/steamwar/techhider/ChunkHider.java @@ -23,9 +23,11 @@ import de.steamwar.Reflection; import io.netty.buffer.ByteBuf; import io.netty.buffer.Unpooled; import lombok.Getter; +import net.minecraft.core.Registry; import net.minecraft.core.registries.BuiltInRegistries; import net.minecraft.network.protocol.game.ClientboundLevelChunkPacketData; import net.minecraft.network.protocol.game.ClientboundLevelChunkWithLightPacket; +import net.minecraft.resources.ResourceLocation; import net.minecraft.util.SimpleBitStorage; import net.minecraft.world.level.block.entity.BlockEntityType; import org.bukkit.entity.Player; @@ -90,10 +92,14 @@ public class ChunkHider { }; } + private static final Registry> registry = Reflection.getField(BuiltInRegistries.class, "BLOCK_ENTITY_TYPE", Registry.class).get(null); + private static final Reflection.Method getKey = Reflection.getTypedMethod(Reflection.getClass("net.minecraft.core.Registry"), "getKey", ResourceLocation.class, Object.class); public static final Class tileEntity = Reflection.getClass("net.minecraft.network.protocol.game.ClientboundLevelChunkPacketData$BlockEntityInfo"); protected static final Reflection.Field entityType = Reflection.getField(tileEntity, BlockEntityType.class, 0); protected boolean tileEntityVisible(Set hiddenBlockEntities, Object tile) { - return !hiddenBlockEntities.contains(BuiltInRegistries.BLOCK_ENTITY_TYPE.getKey(entityType.get(tile)).getPath()); + BlockEntityType type = entityType.get(tile); + String path = ((ResourceLocation) getKey.invoke(registry, type)).getPath(); + return !hiddenBlockEntities.contains(path); } private void blocks(SectionHider section) {