From 590e8d00961ff9d9152c39329da8fa8f9705e32e Mon Sep 17 00:00:00 2001 From: paulevsGitch Date: Mon, 3 May 2021 23:52:12 +0300 Subject: [PATCH] End cave exit fixes --- .../features/terrain/caves/TunelCaveFeature.java | 15 ++++++++++----- 1 file changed, 10 insertions(+), 5 deletions(-) diff --git a/src/main/java/ru/betterend/world/features/terrain/caves/TunelCaveFeature.java b/src/main/java/ru/betterend/world/features/terrain/caves/TunelCaveFeature.java index b3d8c9dd..ff5dddf8 100644 --- a/src/main/java/ru/betterend/world/features/terrain/caves/TunelCaveFeature.java +++ b/src/main/java/ru/betterend/world/features/terrain/caves/TunelCaveFeature.java @@ -88,12 +88,16 @@ public class TunelCaveFeature extends EndCaveFeature { Set floorPositions = Sets.newHashSet(); Set ceilPositions = Sets.newHashSet(); MutableBlockPos mut = new MutableBlockPos(); + Set remove = Sets.newHashSet(); caveBlocks.forEach((bpos) -> { mut.set(bpos); - if (world.getBlockState(mut).getMaterial().isReplaceable()) { + int height = world.getHeight(Types.WORLD_SURFACE, bpos.getX(), bpos.getZ()); + if (mut.getY() >= height) { + remove.add(bpos); + } + else if (world.getBlockState(mut).getMaterial().isReplaceable()) { mut.setY(bpos.getY() - 1); - int height = world.getHeight(Types.WORLD_SURFACE, pos.getX(), pos.getZ()); - if (world.getBlockState(mut).is(EndTags.GEN_TERRAIN) && mut.getY() < height) { + if (world.getBlockState(mut).is(EndTags.GEN_TERRAIN)) { floorPositions.add(mut.immutable()); } mut.setY(bpos.getY() + 1); @@ -105,6 +109,7 @@ public class TunelCaveFeature extends EndCaveFeature { BlockState surfaceBlock = biome.getBiome().getGenerationSettings().getSurfaceBuilderConfig().getTopMaterial(); placeFloor(world, biome, floorPositions, random, surfaceBlock); placeCeil(world, biome, ceilPositions, random); + caveBlocks.removeAll(remove); placeWalls(world, biome, caveBlocks, random); } fixBlocks(world, preCaveBlocks); @@ -116,8 +121,8 @@ public class TunelCaveFeature extends EndCaveFeature { private Set mutateBlocks(Set caveBlocks) { Set result = Sets.newHashSet(); caveBlocks.forEach(pos -> { - int dx = pos.getX() + (int) (BIOME_NOISE_X.eval(pos.getX() * 0.2, pos.getZ() * 0.2) * 5); - int dz = pos.getZ() + (int) (BIOME_NOISE_Z.eval(pos.getX() * 0.2, pos.getZ() * 0.2) * 5); + int dx = pos.getX() + (int) (BIOME_NOISE_X.eval(pos.getX() * 0.3, pos.getZ() * 0.3) * 10); + int dz = pos.getZ() + (int) (BIOME_NOISE_Z.eval(pos.getX() * 0.3, pos.getZ() * 0.3) * 10); if ((dx >> 4) == (pos.getX() >> 4) && (dz >> 4) == (pos.getZ() >> 4)) { result.add(pos); }