From 7fac94e2763c0bbd7f8371f675c8e304bca2182e Mon Sep 17 00:00:00 2001 From: nea Date: Wed, 26 Apr 2023 01:24:22 +0200 Subject: add build height limit --- .../notenoughupdates/miscfeatures/CustomItemEffects.java | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/src/main/java/io/github/moulberry/notenoughupdates/miscfeatures/CustomItemEffects.java b/src/main/java/io/github/moulberry/notenoughupdates/miscfeatures/CustomItemEffects.java index 242fce4e..55dedadf 100644 --- a/src/main/java/io/github/moulberry/notenoughupdates/miscfeatures/CustomItemEffects.java +++ b/src/main/java/io/github/moulberry/notenoughupdates/miscfeatures/CustomItemEffects.java @@ -1005,6 +1005,11 @@ public class CustomItemEffects { event.target.typeOfHit == MovingObjectPosition.MovingObjectType.BLOCK && NotEnoughUpdates.INSTANCE.config.itemOverlays.enableDirtWandOverlay) { BlockPos hover = event.target.getBlockPos().offset(event.target.sideHit, 1); + if ("garden".equals(SBInfo.getInstance().getLocation()) && + (hover.getX() > 239 || hover.getX() < -240 || hover.getZ() > 239 || hover.getZ() < -240 || + hover.getY() <= 66 || hover.getY() > 76)) { + return; + } IBlockState hoverState = Minecraft.getMinecraft().theWorld.getBlockState(event.target .getBlockPos() .offset(event.target.sideHit, 1)); @@ -1579,6 +1584,9 @@ public class CustomItemEffects { (candidate.getY() + 0.5f - d1 - player.getEyeHeight()) * (candidate.getY() + 0.5f - d1 - player.getEyeHeight()) + (candidate.getZ() + 0.5f - d2) * (candidate.getZ() + 0.5f - d2)); + if (candidate.getY() < 66 || candidate.getY() >= 76) { + continue; + } candidatesOldSorted.computeIfAbsent(distSq, k -> new HashSet<>()).add(candidate); candidatesOld.add(candidate); @@ -1598,6 +1606,9 @@ public class CustomItemEffects { if (plotX != plotXNew || plotZ != plotZNew) { continue; } + if (2 < plotXNew || plotXNew < -2 || 2 < plotZNew || plotZNew < -2) { + continue; + } } if (!sneaking) { if (Minecraft.getMinecraft().theWorld.getBlockState(candidate.add(xOff, 1, zOff)).getBlock() == Blocks.air) { -- cgit