From 34a32ad575a25670ff414575aeea3298582016de Mon Sep 17 00:00:00 2001 From: Kosma Moczek Date: Thu, 2 Dec 2021 21:17:07 +0100 Subject: [PATCH] fabric-1.18: implement FabricServer.isSignAt() --- .../java/org/dynmap/fabric_1_18/FabricServer.java | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) diff --git a/fabric-1.18/src/main/java/org/dynmap/fabric_1_18/FabricServer.java b/fabric-1.18/src/main/java/org/dynmap/fabric_1_18/FabricServer.java index a4f4aadf..2401bc2f 100644 --- a/fabric-1.18/src/main/java/org/dynmap/fabric_1_18/FabricServer.java +++ b/fabric-1.18/src/main/java/org/dynmap/fabric_1_18/FabricServer.java @@ -3,6 +3,7 @@ package org.dynmap.fabric_1_18; import com.mojang.authlib.GameProfile; import net.fabricmc.loader.api.FabricLoader; import net.fabricmc.loader.api.ModContainer; +import net.minecraft.block.AbstractSignBlock; import net.minecraft.block.Block; import net.minecraft.block.BlockState; import net.minecraft.network.MessageType; @@ -17,6 +18,7 @@ import net.minecraft.util.UserCache; import net.minecraft.util.Util; import net.minecraft.util.math.BlockPos; import net.minecraft.util.registry.Registry; +import net.minecraft.world.World; import net.minecraft.world.biome.Biome; import org.dynmap.DynmapChunk; import org.dynmap.DynmapCommonAPIListener; @@ -92,9 +94,17 @@ public class FabricServer extends DynmapServerInterface { return -1; } - @Override + @SuppressWarnings("deprecation") /* Not much I can do... fix this if it breaks. */ + @Override public int isSignAt(String wname, int x, int y, int z) { - return -1; + World world = plugin.getWorldByName(wname).getWorld(); + + BlockPos pos = new BlockPos(x, y, z); + if (!world.isChunkLoaded(pos)) + return -1; + + Block block = world.getBlockState(pos).getBlock(); + return (block instanceof AbstractSignBlock ? 1 : 0); } @Override