From 6a6eadb937f844d1833d3fec7e51f7306d721211 Mon Sep 17 00:00:00 2001 From: yoyosource Date: Sun, 28 Aug 2022 17:15:39 +0200 Subject: [PATCH] Closes: #121 Signed-off-by: yoyosource --- .../features/techhider/TechHiderCommand.java | 2 +- .../bausystem/features/xray/XrayCommand.java | 2 +- .../src/de/steamwar/bausystem/region/Region.java | 14 +++++++++++--- 3 files changed, 13 insertions(+), 5 deletions(-) diff --git a/BauSystem_Main/src/de/steamwar/bausystem/features/techhider/TechHiderCommand.java b/BauSystem_Main/src/de/steamwar/bausystem/features/techhider/TechHiderCommand.java index 798c9d02..4f150ef3 100644 --- a/BauSystem_Main/src/de/steamwar/bausystem/features/techhider/TechHiderCommand.java +++ b/BauSystem_Main/src/de/steamwar/bausystem/features/techhider/TechHiderCommand.java @@ -81,7 +81,7 @@ public class TechHiderCommand extends SWCommand implements Listener { Set hiddenBlockEntities = Collections.unmodifiableSet(new HashSet<>(config.getStringList("Techhider.HiddenBlockEntities"))); TechHider current = new TechHider((p, cX, cY) -> { - if (rg.chunkOutside(cX, cY)) return true; + if (rg.buildChunkOutside(cX, cY)) return true; return !hidden.get(rg).contains(p); }, Material.valueOf(obfuscateWith.toUpperCase()), hiddenBlocks.stream().map(String::toUpperCase).map(Material::valueOf).collect(Collectors.toSet()), hiddenBlockEntities); current.enable(); diff --git a/BauSystem_Main/src/de/steamwar/bausystem/features/xray/XrayCommand.java b/BauSystem_Main/src/de/steamwar/bausystem/features/xray/XrayCommand.java index 88f2cae5..d0483885 100644 --- a/BauSystem_Main/src/de/steamwar/bausystem/features/xray/XrayCommand.java +++ b/BauSystem_Main/src/de/steamwar/bausystem/features/xray/XrayCommand.java @@ -148,7 +148,7 @@ public class XrayCommand extends SWCommand implements Listener { private TechHider createXray(Region rg, Set obfuscate) { TechHider current = new TechHider((p, cX, cY) -> { - if (rg.chunkOutside(cX, cY)) return true; + if (rg.buildChunkOutside(cX, cY)) return true; return !hidden.get(rg).contains(p); }, Material.STRUCTURE_VOID, obfuscate, new HashSet<>()); current.enable(); diff --git a/BauSystem_Main/src/de/steamwar/bausystem/region/Region.java b/BauSystem_Main/src/de/steamwar/bausystem/region/Region.java index ef66d4c8..cec37575 100644 --- a/BauSystem_Main/src/de/steamwar/bausystem/region/Region.java +++ b/BauSystem_Main/src/de/steamwar/bausystem/region/Region.java @@ -576,9 +576,17 @@ public class Region { } } - public boolean chunkOutside(int chunkX, int chunkY) { - return Math.floor(minPoint.getX() / 16.0) > chunkX || chunkX >= Math.ceil(maxPoint.getX() / 16.0) || - Math.floor(minPoint.getZ() / 16.0) > chunkY || chunkY >= Math.ceil(maxPoint.getZ() / 16.0); + public boolean buildChunkOutside(int chunkX, int chunkY) { + if (!hasType(RegionType.BUILD)) { + return Math.floor(minPoint.getX() / 16.0) > chunkX || chunkX >= Math.ceil(maxPoint.getX() / 16.0) || + Math.floor(minPoint.getZ() / 16.0) > chunkY || chunkY >= Math.ceil(maxPoint.getZ() / 16.0); + } + if (!hasExtensionType(RegionType.BUILD)) { + return Math.floor(minPointBuild.getX() / 16.0) > chunkX || chunkX >= Math.ceil(maxPointBuild.getX() / 16.0) || + Math.floor(minPointBuild.getZ() / 16.0) > chunkY || chunkY >= Math.ceil(maxPointBuild.getZ() / 16.0); + } + return Math.floor(minPointBuildExtension.getX() / 16.0) > chunkX || chunkX >= Math.ceil(maxPointBuildExtension.getX() / 16.0) || + Math.floor(minPointBuildExtension.getZ() / 16.0) > chunkY || chunkY >= Math.ceil(maxPointBuildExtension.getZ() / 16.0); } public File gameModeConfig() {