diff --git a/src/main/java/ru/betterend/util/StructureHelper.java b/src/main/java/ru/betterend/util/StructureHelper.java index 96446815..ff8ab86c 100644 --- a/src/main/java/ru/betterend/util/StructureHelper.java +++ b/src/main/java/ru/betterend/util/StructureHelper.java @@ -85,6 +85,18 @@ public class StructureHelper { return new BlockBox(min.add(pos), max.add(pos)); } + public static BlockBox intersectBoxes(BlockBox box1, BlockBox box2) { + int x1 = MHelper.max(box1.minX, box2.minX); + int y1 = MHelper.max(box1.minY, box2.minY); + int z1 = MHelper.max(box1.minZ, box2.minZ); + + int x2 = MHelper.min(box1.maxX, box2.maxX); + int y2 = MHelper.min(box1.maxY, box2.maxY); + int z2 = MHelper.min(box1.maxZ, box2.maxZ); + + return BlockBox.create(x1, y1, z1, x2, y2, z2); + } + public static void erode(StructureWorldAccess world, BlockBox bounds, int iterations, Random random) { Mutable mut = new Mutable(); boolean canDestruct = true; @@ -209,7 +221,7 @@ public class StructureHelper { } } } - else if (random.nextInt(8) == 0 && !world.getBlockState(mut.up()).isOf(EndBlocks.ETERNAL_PEDESTAL)) { + else if (random.nextInt(8) == 0) { BlocksHelper.setWithoutUpdate(world, mut, Blocks.AIR); } } @@ -307,7 +319,9 @@ public class StructureHelper { || state.isOf(EndBlocks.FLAVOLITE_RUNED_ETERNAL) || state.isIn(BlockTags.LOGS) || state.isIn(BlockTags.LEAVES) - || state.getMaterial().equals(Material.PLANT); + || state.getMaterial().equals(Material.PLANT) + || state.getMaterial().equals(Material.LEAVES) + || state.getMaterial().equals(Material.WOOD); } private static void shuffle(Random random) { diff --git a/src/main/java/ru/betterend/world/features/CrashedShipFeature.java b/src/main/java/ru/betterend/world/features/CrashedShipFeature.java index 3475e9d8..a69ba91d 100644 --- a/src/main/java/ru/betterend/world/features/CrashedShipFeature.java +++ b/src/main/java/ru/betterend/world/features/CrashedShipFeature.java @@ -27,9 +27,7 @@ public class CrashedShipFeature extends NBTStructureFeature { @Override protected boolean canSpawn(StructureWorldAccess world, BlockPos pos, Random random) { - int cx = pos.getX() >> 4; - int cz = pos.getZ() >> 4; - return ((cx + cz) & 1) == 0 && pos.getY() > 58 && world.getBlockState(pos.down()).isIn(EndTags.GEN_TERRAIN); + return pos.getY() > 58 && world.getBlockState(pos.down()).isIn(EndTags.GEN_TERRAIN); } @Override @@ -63,6 +61,8 @@ public class CrashedShipFeature extends NBTStructureFeature { return false; } + System.out.println(center); + Structure structure = getStructure(world, center, random); BlockRotation rotation = getRotation(world, center, random); BlockMirror mirror = getMirror(world, center, random); @@ -70,6 +70,9 @@ public class CrashedShipFeature extends NBTStructureFeature { center = center.add(0, getYOffset(structure, world, center, random) + 0.5, 0); BlockBox bounds = makeBox(center); + BlockBox structB = StructureHelper.getStructureBounds(center, structure, rotation, mirror); + bounds = StructureHelper.intersectBoxes(bounds, structB); + StructurePlacementData placementData = new StructurePlacementData().setRotation(rotation).setMirror(mirror).setBoundingBox(bounds); addStructureData(placementData); center = center.add(-offset.getX() * 0.5, 0, -offset.getZ() * 0.5); diff --git a/src/main/resources/assets/betterend/textures/block/helix_tree_trapdoor.png b/src/main/resources/assets/betterend/textures/block/helix_tree_trapdoor.png index 7f0f38c8..76dab50f 100644 Binary files a/src/main/resources/assets/betterend/textures/block/helix_tree_trapdoor.png and b/src/main/resources/assets/betterend/textures/block/helix_tree_trapdoor.png differ