From 5ed8e517e408f1daafab069568aed283e7e4269c Mon Sep 17 00:00:00 2001 From: Unknown Date: Sun, 29 Dec 2019 16:47:44 -0500 Subject: [PATCH] optimized buried treasure finder --- .../finder/structure/BuriedTreasureFinder.java | 13 ++++--------- 1 file changed, 4 insertions(+), 9 deletions(-) diff --git a/src/main/java/kaptainwutax/seedcracker/finder/structure/BuriedTreasureFinder.java b/src/main/java/kaptainwutax/seedcracker/finder/structure/BuriedTreasureFinder.java index 270a9d4..88d7b88 100644 --- a/src/main/java/kaptainwutax/seedcracker/finder/structure/BuriedTreasureFinder.java +++ b/src/main/java/kaptainwutax/seedcracker/finder/structure/BuriedTreasureFinder.java @@ -26,7 +26,7 @@ public class BuriedTreasureFinder extends BlockFinder { int localX = pos.getX() & 15; int localZ = pos.getZ() & 15; if(localX != 9 || localZ != 9)return true; - + if(pos.getY() > 90)return true; return false; }); @@ -55,23 +55,18 @@ public class BuriedTreasureFinder extends BlockFinder { @Override public List findInChunk() { - //Gets all the positions with a chest in the chunk. + Biome biome = world.getBiome(this.chunkPos.getCenterBlockPos().add(9, 0, 9)); + if(!biome.hasStructureFeature(Feature.BURIED_TREASURE))return new ArrayList<>(); + List result = super.findInChunk(); result.removeIf(pos -> { - //Chest can't be waterlogged! BlockState chest = world.getBlockState(pos); if(chest.get(ChestBlock.WATERLOGGED))return true; - //Only so many blocks can hold a treasure chest. BlockState chestHolder = world.getBlockState(pos.down()); if(!CHEST_HOLDERS.contains(chestHolder))return true; - //Check if the biome contains the buried treasure feature. - Biome biome = world.getBiome(pos); - if(!biome.hasStructureFeature(Feature.BURIED_TREASURE))return true; - - //Damn that chest be lucky! return false; });