| 1 | package net.minecraft.world.level.levelgen.structure.structures;
|
| 2 |
|
| 3 | import com.google.common.collect.Lists;
|
| 4 | import java.util.ArrayList;
|
| 5 | import java.util.List;
|
| 6 | import net.minecraft.core.BlockPos;
|
| 7 | import net.minecraft.core.Direction;
|
| 8 | import net.minecraft.nbt.CompoundTag;
|
| 9 | import net.minecraft.util.RandomSource;
|
| 10 | import net.minecraft.world.entity.EntityTypes;
|
| 11 | import net.minecraft.world.level.ChunkPos;
|
| 12 | import net.minecraft.world.level.StructureManager;
|
| 13 | import net.minecraft.world.level.WorldGenLevel;
|
| 14 | import net.minecraft.world.level.block.Blocks;
|
| 15 | import net.minecraft.world.level.block.FenceBlock;
|
| 16 | import net.minecraft.world.level.block.StairBlock;
|
| 17 | import net.minecraft.world.level.block.entity.SpawnerBlockEntity;
|
| 18 | import net.minecraft.world.level.block.state.BlockState;
|
| 19 | import net.minecraft.world.level.chunk.ChunkGenerator;
|
| 20 | import net.minecraft.world.level.levelgen.structure.BoundingBox;
|
| 21 | import net.minecraft.world.level.levelgen.structure.StructurePiece;
|
| 22 | import net.minecraft.world.level.levelgen.structure.pieces.StructurePieceSerializationContext;
|
| 23 | import net.minecraft.world.level.levelgen.structure.pieces.StructurePieceType;
|
| 24 | import net.minecraft.world.level.levelgen.structure.pieces.StructurePiecesBuilder;
|
| 25 | import net.minecraft.world.level.material.Fluids;
|
| 26 | import net.minecraft.world.level.storage.loot.BuiltInLootTables;
|
| 27 | import org.jspecify.annotations.Nullable;
|
| 28 |
|
| 29 | public class NetherFortressPieces {
|
| 30 | private static final int MAX_DEPTH = 30;
|
| 31 | private static final int LOWEST_Y_POSITION = 10;
|
| 32 | public static final int MAGIC_START_Y = 64;
|
| 33 | private static final NetherFortressPieces.PieceWeight[] BRIDGE_PIECE_WEIGHTS = new NetherFortressPieces.PieceWeight[]{
|
| 34 | new NetherFortressPieces.PieceWeight(NetherFortressPieces.BridgeStraight.class, 30, 0, true),
|
| 35 | new NetherFortressPieces.PieceWeight(NetherFortressPieces.BridgeCrossing.class, 10, 4),
|
| 36 | new NetherFortressPieces.PieceWeight(NetherFortressPieces.RoomCrossing.class, 10, 4),
|
| 37 | new NetherFortressPieces.PieceWeight(NetherFortressPieces.StairsRoom.class, 10, 3),
|
| 38 | new NetherFortressPieces.PieceWeight(NetherFortressPieces.MonsterThrone.class, 5, 2),
|
| 39 | new NetherFortressPieces.PieceWeight(NetherFortressPieces.CastleEntrance.class, 5, 1)
|
| 40 | };
|
| 41 | private static final NetherFortressPieces.PieceWeight[] CASTLE_PIECE_WEIGHTS = new NetherFortressPieces.PieceWeight[]{
|
| 42 | new NetherFortressPieces.PieceWeight(NetherFortressPieces.CastleSmallCorridorPiece.class, 25, 0, true),
|
| 43 | new NetherFortressPieces.PieceWeight(NetherFortressPieces.CastleSmallCorridorCrossingPiece.class, 15, 5),
|
| 44 | new NetherFortressPieces.PieceWeight(NetherFortressPieces.CastleSmallCorridorRightTurnPiece.class, 5, 10),
|
| 45 | new NetherFortressPieces.PieceWeight(NetherFortressPieces.CastleSmallCorridorLeftTurnPiece.class, 5, 10),
|
| 46 | new NetherFortressPieces.PieceWeight(NetherFortressPieces.CastleCorridorStairsPiece.class, 10, 3, true),
|
| 47 | new NetherFortressPieces.PieceWeight(NetherFortressPieces.CastleCorridorTBalconyPiece.class, 7, 2),
|
| 48 | new NetherFortressPieces.PieceWeight(NetherFortressPieces.CastleStalkRoom.class, 5, 2)
|
| 49 | };
|
| 50 |
|
| 51 | private static NetherFortressPieces.@Nullable NetherBridgePiece findAndCreateBridgePieceFactory(
|
| 52 | final NetherFortressPieces.PieceWeight piece,
|
| 53 | final StructurePiecesBuilder builder,
|
| 54 | final RandomSource random,
|
| 55 | final int footX,
|
| 56 | final int footY,
|
| 57 | final int footZ,
|
| 58 | final Direction direction,
|
| 59 | final int depth
|
| 60 | ) {
|
| 61 | Class<? extends NetherFortressPieces.NetherBridgePiece> pieceClass = piece.pieceClass;
|
| 62 | NetherFortressPieces.NetherBridgePiece structurePiece = null;
|
| 63 | if (pieceClass == NetherFortressPieces.BridgeStraight.class) {
|
| 64 | structurePiece = NetherFortressPieces.BridgeStraight.createPiece(builder, random, footX, footY, footZ, direction, depth);
|
| 65 | } else if (pieceClass == NetherFortressPieces.BridgeCrossing.class) {
|
| 66 | structurePiece = NetherFortressPieces.BridgeCrossing.createPiece(builder, footX, footY, footZ, direction, depth);
|
| 67 | } else if (pieceClass == NetherFortressPieces.RoomCrossing.class) {
|
| 68 | structurePiece = NetherFortressPieces.RoomCrossing.createPiece(builder, footX, footY, footZ, direction, depth);
|
| 69 | } else if (pieceClass == NetherFortressPieces.StairsRoom.class) {
|
| 70 | structurePiece = NetherFortressPieces.StairsRoom.createPiece(builder, footX, footY, footZ, depth, direction);
|
| 71 | } else if (pieceClass == NetherFortressPieces.MonsterThrone.class) {
|
| 72 | structurePiece = NetherFortressPieces.MonsterThrone.createPiece(builder, footX, footY, footZ, depth, direction);
|
| 73 | } else if (pieceClass == NetherFortressPieces.CastleEntrance.class) {
|
| 74 | structurePiece = NetherFortressPieces.CastleEntrance.createPiece(builder, random, footX, footY, footZ, direction, depth);
|
| 75 | } else if (pieceClass == NetherFortressPieces.CastleSmallCorridorPiece.class) {
|
| 76 | structurePiece = NetherFortressPieces.CastleSmallCorridorPiece.createPiece(builder, footX, footY, footZ, direction, depth);
|
| 77 | } else if (pieceClass == NetherFortressPieces.CastleSmallCorridorRightTurnPiece.class) {
|
| 78 | structurePiece = NetherFortressPieces.CastleSmallCorridorRightTurnPiece.createPiece(builder, random, footX, footY, footZ, direction, depth);
|
| 79 | } else if (pieceClass == NetherFortressPieces.CastleSmallCorridorLeftTurnPiece.class) {
|
| 80 | structurePiece = NetherFortressPieces.CastleSmallCorridorLeftTurnPiece.createPiece(builder, random, footX, footY, footZ, direction, depth);
|
| 81 | } else if (pieceClass == NetherFortressPieces.CastleCorridorStairsPiece.class) {
|
| 82 | structurePiece = NetherFortressPieces.CastleCorridorStairsPiece.createPiece(builder, footX, footY, footZ, direction, depth);
|
| 83 | } else if (pieceClass == NetherFortressPieces.CastleCorridorTBalconyPiece.class) {
|
| 84 | structurePiece = NetherFortressPieces.CastleCorridorTBalconyPiece.createPiece(builder, footX, footY, footZ, direction, depth);
|
| 85 | } else if (pieceClass == NetherFortressPieces.CastleSmallCorridorCrossingPiece.class) {
|
| 86 | structurePiece = NetherFortressPieces.CastleSmallCorridorCrossingPiece.createPiece(builder, footX, footY, footZ, direction, depth);
|
| 87 | } else if (pieceClass == NetherFortressPieces.CastleStalkRoom.class) {
|
| 88 | structurePiece = NetherFortressPieces.CastleStalkRoom.createPiece(builder, footX, footY, footZ, direction, depth);
|
| 89 | }
|
| 90 |
|
| 91 | return structurePiece;
|
| 92 | }
|
| 93 |
|
| 94 | public static class BridgeCrossing extends NetherFortressPieces.NetherBridgePiece {
|
| 95 | private static final int WIDTH = 19;
|
| 96 | private static final int HEIGHT = 10;
|
| 97 | private static final int DEPTH = 19;
|
| 98 |
|
| 99 | public BridgeCrossing(final int genDepth, final BoundingBox boundingBox, final Direction direction) {
|
| 100 | super(StructurePieceType.NETHER_FORTRESS_BRIDGE_CROSSING, genDepth, boundingBox);
|
| 101 | this.setOrientation(direction);
|
| 102 | }
|
| 103 |
|
| 104 | protected BridgeCrossing(final int west, final int north, final Direction direction) {
|
| 105 | super(StructurePieceType.NETHER_FORTRESS_BRIDGE_CROSSING, 0, StructurePiece.makeBoundingBox(west, 64, north, direction, 19, 10, 19));
|
| 106 | this.setOrientation(direction);
|
| 107 | }
|
| 108 |
|
| 109 | protected BridgeCrossing(final StructurePieceType type, final CompoundTag tag) {
|
| 110 | super(type, tag);
|
| 111 | }
|
| 112 |
|
| 113 | public BridgeCrossing(final CompoundTag tag) {
|
| 114 | this(StructurePieceType.NETHER_FORTRESS_BRIDGE_CROSSING, tag);
|
| 115 | }
|
| 116 |
|
| 117 | @Override
|
| 118 | public void addChildren(final StructurePiece startPiece, final StructurePiecesBuilder builder, final RandomSource random) {
|
| 119 | this.generateChildForward((NetherFortressPieces.StartPiece)startPiece, builder, random, 8, 3, false);
|
| 120 | this.generateChildLeft((NetherFortressPieces.StartPiece)startPiece, builder, random, 3, 8, false);
|
| 121 | this.generateChildRight((NetherFortressPieces.StartPiece)startPiece, builder, random, 3, 8, false);
|
| 122 | }
|
| 123 |
|
| 124 | public static NetherFortressPieces.@Nullable BridgeCrossing createPiece(
|
| 125 | final StructurePiecesBuilder builder, final int footX, final int footY, final int footZ, final Direction direction, final int genDepth
|
| 126 | ) {
|
| 127 | BoundingBox box = BoundingBox.orientBox(footX, footY, footZ, -8, -3, 0, 19, 10, 19, direction);
|
| 128 | return isOkBox(box) && builder.findCollisionPiece(box) == null ? new NetherFortressPieces.BridgeCrossing(genDepth, box, direction) : null;
|
| 129 | }
|
| 130 |
|
| 131 | @Override
|
| 132 | public void postProcess(
|
| 133 | final WorldGenLevel level,
|
| 134 | final StructureManager structureManager,
|
| 135 | final ChunkGenerator generator,
|
| 136 | final RandomSource random,
|
| 137 | final BoundingBox chunkBB,
|
| 138 | final ChunkPos chunkPos,
|
| 139 | final BlockPos referencePos
|
| 140 | ) {
|
| 141 | this.generateBox(level, chunkBB, 7, 3, 0, 11, 4, 18, Blocks.NETHER_BRICKS.defaultBlockState(), Blocks.NETHER_BRICKS.defaultBlockState(), false);
|
| 142 | this.generateBox(level, chunkBB, 0, 3, 7, 18, 4, 11, Blocks.NETHER_BRICKS.defaultBlockState(), Blocks.NETHER_BRICKS.defaultBlockState(), false);
|
| 143 | this.generateBox(level, chunkBB, 8, 5, 0, 10, 7, 18, Blocks.AIR.defaultBlockState(), Blocks.AIR.defaultBlockState(), false);
|
| 144 | this.generateBox(level, chunkBB, 0, 5, 8, 18, 7, 10, Blocks.AIR.defaultBlockState(), Blocks.AIR.defaultBlockState(), false);
|
| 145 | this.generateBox(level, chunkBB, 7, 5, 0, 7, 5, 7, Blocks.NETHER_BRICKS.defaultBlockState(), Blocks.NETHER_BRICKS.defaultBlockState(), false);
|
| 146 | this.generateBox(level, chunkBB, 7, 5, 11, 7, 5, 18, Blocks.NETHER_BRICKS.defaultBlockState(), Blocks.NETHER_BRICKS.defaultBlockState(), false);
|
| 147 | this.generateBox(level, chunkBB, 11, 5, 0, 11, 5, 7, Blocks.NETHER_BRICKS.defaultBlockState(), Blocks.NETHER_BRICKS.defaultBlockState(), false);
|
| 148 | this.generateBox(level, chunkBB, 11, 5, 11, 11, 5, 18, Blocks.NETHER_BRICKS.defaultBlockState(), Blocks.NETHER_BRICKS.defaultBlockState(), false);
|
| 149 | this.generateBox(level, chunkBB, 0, 5, 7, 7, 5, 7, Blocks.NETHER_BRICKS.defaultBlockState(), Blocks.NETHER_BRICKS.defaultBlockState(), false);
|
| 150 | this.generateBox(level, chunkBB, 11, 5, 7, 18, 5, 7, Blocks.NETHER_BRICKS.defaultBlockState(), Blocks.NETHER_BRICKS.defaultBlockState(), false);
|
| 151 | this.generateBox(level, chunkBB, 0, 5, 11, 7, 5, 11, Blocks.NETHER_BRICKS.defaultBlockState(), Blocks.NETHER_BRICKS.defaultBlockState(), false);
|
| 152 | this.generateBox(level, chunkBB, 11, 5, 11, 18, 5, 11, Blocks.NETHER_BRICKS.defaultBlockState(), Blocks.NETHER_BRICKS.defaultBlockState(), false);
|
| 153 | this.generateBox(level, chunkBB, 7, 2, 0, 11, 2, 5, Blocks.NETHER_BRICKS.defaultBlockState(), Blocks.NETHER_BRICKS.defaultBlockState(), false);
|
| 154 | this.generateBox(level, chunkBB, 7, 2, 13, 11, 2, 18, Blocks.NETHER_BRICKS.defaultBlockState(), Blocks.NETHER_BRICKS.defaultBlockState(), false);
|
| 155 | this.generateBox(level, chunkBB, 7, 0, 0, 11, 1, 3, Blocks.NETHER_BRICKS.defaultBlockState(), Blocks.NETHER_BRICKS.defaultBlockState(), false);
|
| 156 | this.generateBox(level, chunkBB, 7, 0, 15, 11, 1, 18, Blocks.NETHER_BRICKS.defaultBlockState(), Blocks.NETHER_BRICKS.defaultBlockState(), false);
|
| 157 |
|
| 158 | for (int x = 7; x <= 11; x++) {
|
| 159 | for (int z = 0; z <= 2; z++) {
|
| 160 | this.fillColumnDown(level, Blocks.NETHER_BRICKS.defaultBlockState(), x, -1, z, chunkBB);
|
| 161 | this.fillColumnDown(level, Blocks.NETHER_BRICKS.defaultBlockState(), x, -1, 18 - z, chunkBB);
|
| 162 | }
|
| 163 | }
|
| 164 |
|
| 165 | this.generateBox(level, chunkBB, 0, 2, 7, 5, 2, 11, Blocks.NETHER_BRICKS.defaultBlockState(), Blocks.NETHER_BRICKS.defaultBlockState(), false);
|
| 166 | this.generateBox(level, chunkBB, 13, 2, 7, 18, 2, 11, Blocks.NETHER_BRICKS.defaultBlockState(), Blocks.NETHER_BRICKS.defaultBlockState(), false);
|
| 167 | this.generateBox(level, chunkBB, 0, 0, 7, 3, 1, 11, Blocks.NETHER_BRICKS.defaultBlockState(), Blocks.NETHER_BRICKS.defaultBlockState(), false);
|
| 168 | this.generateBox(level, chunkBB, 15, 0, 7, 18, 1, 11, Blocks.NETHER_BRICKS.defaultBlockState(), Blocks.NETHER_BRICKS.defaultBlockState(), false);
|
| 169 |
|
| 170 | for (int x = 0; x <= 2; x++) {
|
| 171 | for (int z = 7; z <= 11; z++) {
|
| 172 | this.fillColumnDown(level, Blocks.NETHER_BRICKS.defaultBlockState(), x, -1, z, chunkBB);
|
| 173 | this.fillColumnDown(level, Blocks.NETHER_BRICKS.defaultBlockState(), 18 - x, -1, z, chunkBB);
|
| 174 | }
|
| 175 | }
|
| 176 | }
|
| 177 | }
|
| 178 |
|
| 179 | public static class BridgeEndFiller extends NetherFortressPieces.NetherBridgePiece {
|
| 180 | private static final int WIDTH = 5;
|
| 181 | private static final int HEIGHT = 10;
|
| 182 | private static final int DEPTH = 8;
|
| 183 | private final int selfSeed;
|
| 184 |
|
| 185 | public BridgeEndFiller(final int genDepth, final RandomSource random, final BoundingBox boundingBox, final Direction direction) {
|
| 186 | super(StructurePieceType.NETHER_FORTRESS_BRIDGE_END_FILLER, genDepth, boundingBox);
|
| 187 | this.setOrientation(direction);
|
| 188 | this.selfSeed = random.nextInt();
|
| 189 | }
|
| 190 |
|
| 191 | public BridgeEndFiller(final CompoundTag tag) {
|
| 192 | super(StructurePieceType.NETHER_FORTRESS_BRIDGE_END_FILLER, tag);
|
| 193 | this.selfSeed = tag.getIntOr("Seed", 0);
|
| 194 | }
|
| 195 |
|
| 196 | public static NetherFortressPieces.@Nullable BridgeEndFiller createPiece(
|
| 197 | final StructurePiecesBuilder builder,
|
| 198 | final RandomSource random,
|
| 199 | final int footX,
|
| 200 | final int footY,
|
| 201 | final int footZ,
|
| 202 | final Direction direction,
|
| 203 | final int genDepth
|
| 204 | ) {
|
| 205 | BoundingBox box = BoundingBox.orientBox(footX, footY, footZ, -1, -3, 0, 5, 10, 8, direction);
|
| 206 | return isOkBox(box) && builder.findCollisionPiece(box) == null ? new NetherFortressPieces.BridgeEndFiller(genDepth, random, box, direction) : null;
|
| 207 | }
|
| 208 |
|
| 209 | @Override
|
| 210 | protected void addAdditionalSaveData(final StructurePieceSerializationContext context, final CompoundTag tag) {
|
| 211 | super.addAdditionalSaveData(context, tag);
|
| 212 | tag.putInt("Seed", this.selfSeed);
|
| 213 | }
|
| 214 |
|
| 215 | @Override
|
| 216 | public void postProcess(
|
| 217 | final WorldGenLevel level,
|
| 218 | final StructureManager structureManager,
|
| 219 | final ChunkGenerator generator,
|
| 220 | final RandomSource random,
|
| 221 | final BoundingBox chunkBB,
|
| 222 | final ChunkPos chunkPos,
|
| 223 | final BlockPos referencePos
|
| 224 | ) {
|
| 225 | RandomSource selfRandom = RandomSource.createThreadLocalInstance(this.selfSeed);
|
| 226 |
|
| 227 | for (int x = 0; x <= 4; x++) {
|
| 228 | for (int y = 3; y <= 4; y++) {
|
| 229 | int z = selfRandom.nextInt(8);
|
| 230 | this.generateBox(level, chunkBB, x, y, 0, x, y, z, Blocks.NETHER_BRICKS.defaultBlockState(), Blocks.NETHER_BRICKS.defaultBlockState(), false);
|
| 231 | }
|
| 232 | }
|
| 233 |
|
| 234 | int z = selfRandom.nextInt(8);
|
| 235 | this.generateBox(level, chunkBB, 0, 5, 0, 0, 5, z, Blocks.NETHER_BRICKS.defaultBlockState(), Blocks.NETHER_BRICKS.defaultBlockState(), false);
|
| 236 | z = selfRandom.nextInt(8);
|
| 237 | this.generateBox(level, chunkBB, 4, 5, 0, 4, 5, z, Blocks.NETHER_BRICKS.defaultBlockState(), Blocks.NETHER_BRICKS.defaultBlockState(), false);
|
| 238 |
|
| 239 | for (int x = 0; x <= 4; x++) {
|
| 240 | int zx = selfRandom.nextInt(5);
|
| 241 | this.generateBox(level, chunkBB, x, 2, 0, x, 2, zx, Blocks.NETHER_BRICKS.defaultBlockState(), Blocks.NETHER_BRICKS.defaultBlockState(), false);
|
| 242 | }
|
| 243 |
|
| 244 | for (int x = 0; x <= 4; x++) {
|
| 245 | for (int y = 0; y <= 1; y++) {
|
| 246 | int zx = selfRandom.nextInt(3);
|
| 247 | this.generateBox(level, chunkBB, x, y, 0, x, y, zx, Blocks.NETHER_BRICKS.defaultBlockState(), Blocks.NETHER_BRICKS.defaultBlockState(), false);
|
| 248 | }
|
| 249 | }
|
| 250 | }
|
| 251 | }
|
| 252 |
|
| 253 | public static class BridgeStraight extends NetherFortressPieces.NetherBridgePiece {
|
| 254 | private static final int WIDTH = 5;
|
| 255 | private static final int HEIGHT = 10;
|
| 256 | private static final int DEPTH = 19;
|
| 257 |
|
| 258 | public BridgeStraight(final int genDepth, final RandomSource random, final BoundingBox boundingBox, final Direction direction) {
|
| 259 | super(StructurePieceType.NETHER_FORTRESS_BRIDGE_STRAIGHT, genDepth, boundingBox);
|
| 260 | this.setOrientation(direction);
|
| 261 | }
|
| 262 |
|
| 263 | public BridgeStraight(final CompoundTag tag) {
|
| 264 | super(StructurePieceType.NETHER_FORTRESS_BRIDGE_STRAIGHT, tag);
|
| 265 | }
|
| 266 |
|
| 267 | @Override
|
| 268 | public void addChildren(final StructurePiece startPiece, final StructurePiecesBuilder builder, final RandomSource random) {
|
| 269 | this.generateChildForward((NetherFortressPieces.StartPiece)startPiece, builder, random, 1, 3, false);
|
| 270 | }
|
| 271 |
|
| 272 | public static NetherFortressPieces.@Nullable BridgeStraight createPiece(
|
| 273 | final StructurePiecesBuilder builder,
|
| 274 | final RandomSource random,
|
| 275 | final int footX,
|
| 276 | final int footY,
|
| 277 | final int footZ,
|
| 278 | final Direction direction,
|
| 279 | final int genDepth
|
| 280 | ) {
|
| 281 | BoundingBox box = BoundingBox.orientBox(footX, footY, footZ, -1, -3, 0, 5, 10, 19, direction);
|
| 282 | return isOkBox(box) && builder.findCollisionPiece(box) == null ? new NetherFortressPieces.BridgeStraight(genDepth, random, box, direction) : null;
|
| 283 | }
|
| 284 |
|
| 285 | @Override
|
| 286 | public void postProcess(
|
| 287 | final WorldGenLevel level,
|
| 288 | final StructureManager structureManager,
|
| 289 | final ChunkGenerator generator,
|
| 290 | final RandomSource random,
|
| 291 | final BoundingBox chunkBB,
|
| 292 | final ChunkPos chunkPos,
|
| 293 | final BlockPos referencePos
|
| 294 | ) {
|
| 295 | this.generateBox(level, chunkBB, 0, 3, 0, 4, 4, 18, Blocks.NETHER_BRICKS.defaultBlockState(), Blocks.NETHER_BRICKS.defaultBlockState(), false);
|
| 296 | this.generateBox(level, chunkBB, 1, 5, 0, 3, 7, 18, Blocks.AIR.defaultBlockState(), Blocks.AIR.defaultBlockState(), false);
|
| 297 | this.generateBox(level, chunkBB, 0, 5, 0, 0, 5, 18, Blocks.NETHER_BRICKS.defaultBlockState(), Blocks.NETHER_BRICKS.defaultBlockState(), false);
|
| 298 | this.generateBox(level, chunkBB, 4, 5, 0, 4, 5, 18, Blocks.NETHER_BRICKS.defaultBlockState(), Blocks.NETHER_BRICKS.defaultBlockState(), false);
|
| 299 | this.generateBox(level, chunkBB, 0, 2, 0, 4, 2, 5, Blocks.NETHER_BRICKS.defaultBlockState(), Blocks.NETHER_BRICKS.defaultBlockState(), false);
|
| 300 | this.generateBox(level, chunkBB, 0, 2, 13, 4, 2, 18, Blocks.NETHER_BRICKS.defaultBlockState(), Blocks.NETHER_BRICKS.defaultBlockState(), false);
|
| 301 | this.generateBox(level, chunkBB, 0, 0, 0, 4, 1, 3, Blocks.NETHER_BRICKS.defaultBlockState(), Blocks.NETHER_BRICKS.defaultBlockState(), false);
|
| 302 | this.generateBox(level, chunkBB, 0, 0, 15, 4, 1, 18, Blocks.NETHER_BRICKS.defaultBlockState(), Blocks.NETHER_BRICKS.defaultBlockState(), false);
|
| 303 |
|
| 304 | for (int x = 0; x <= 4; x++) {
|
| 305 | for (int z = 0; z <= 2; z++) {
|
| 306 | this.fillColumnDown(level, Blocks.NETHER_BRICKS.defaultBlockState(), x, -1, z, chunkBB);
|
| 307 | this.fillColumnDown(level, Blocks.NETHER_BRICKS.defaultBlockState(), x, -1, 18 - z, chunkBB);
|
| 308 | }
|
| 309 | }
|
| 310 |
|
| 311 | BlockState nsFence = Blocks.NETHER_BRICK_FENCE.defaultBlockState().setValue(FenceBlock.NORTH, true).setValue(FenceBlock.SOUTH, true);
|
| 312 | BlockState nseFence = nsFence.setValue(FenceBlock.EAST, true);
|
| 313 | BlockState nswFence = nsFence.setValue(FenceBlock.WEST, true);
|
| 314 | this.generateBox(level, chunkBB, 0, 1, 1, 0, 4, 1, nseFence, nseFence, false);
|
| 315 | this.generateBox(level, chunkBB, 0, 3, 4, 0, 4, 4, nseFence, nseFence, false);
|
| 316 | this.generateBox(level, chunkBB, 0, 3, 14, 0, 4, 14, nseFence, nseFence, false);
|
| 317 | this.generateBox(level, chunkBB, 0, 1, 17, 0, 4, 17, nseFence, nseFence, false);
|
| 318 | this.generateBox(level, chunkBB, 4, 1, 1, 4, 4, 1, nswFence, nswFence, false);
|
| 319 | this.generateBox(level, chunkBB, 4, 3, 4, 4, 4, 4, nswFence, nswFence, false);
|
| 320 | this.generateBox(level, chunkBB, 4, 3, 14, 4, 4, 14, nswFence, nswFence, false);
|
| 321 | this.generateBox(level, chunkBB, 4, 1, 17, 4, 4, 17, nswFence, nswFence, false);
|
| 322 | }
|
| 323 | }
|
| 324 |
|
| 325 | public static class CastleCorridorStairsPiece extends NetherFortressPieces.NetherBridgePiece {
|
| 326 | private static final int WIDTH = 5;
|
| 327 | private static final int HEIGHT = 14;
|
| 328 | private static final int DEPTH = 10;
|
| 329 |
|
| 330 | public CastleCorridorStairsPiece(final int genDepth, final BoundingBox boundingBox, final Direction direction) {
|
| 331 | super(StructurePieceType.NETHER_FORTRESS_CASTLE_CORRIDOR_STAIRS, genDepth, boundingBox);
|
| 332 | this.setOrientation(direction);
|
| 333 | }
|
| 334 |
|
| 335 | public CastleCorridorStairsPiece(final CompoundTag tag) {
|
| 336 | super(StructurePieceType.NETHER_FORTRESS_CASTLE_CORRIDOR_STAIRS, tag);
|
| 337 | }
|
| 338 |
|
| 339 | @Override
|
| 340 | public void addChildren(final StructurePiece startPiece, final StructurePiecesBuilder builder, final RandomSource random) {
|
| 341 | this.generateChildForward((NetherFortressPieces.StartPiece)startPiece, builder, random, 1, 0, true);
|
| 342 | }
|
| 343 |
|
| 344 | public static NetherFortressPieces.@Nullable CastleCorridorStairsPiece createPiece(
|
| 345 | final StructurePiecesBuilder builder, final int footX, final int footY, final int footZ, final Direction direction, final int genDepth
|
| 346 | ) {
|
| 347 | BoundingBox box = BoundingBox.orientBox(footX, footY, footZ, -1, -7, 0, 5, 14, 10, direction);
|
| 348 | return isOkBox(box) && builder.findCollisionPiece(box) == null ? new NetherFortressPieces.CastleCorridorStairsPiece(genDepth, box, direction) : null;
|
| 349 | }
|
| 350 |
|
| 351 | @Override
|
| 352 | public void postProcess(
|
| 353 | final WorldGenLevel level,
|
| 354 | final StructureManager structureManager,
|
| 355 | final ChunkGenerator generator,
|
| 356 | final RandomSource random,
|
| 357 | final BoundingBox chunkBB,
|
| 358 | final ChunkPos chunkPos,
|
| 359 | final BlockPos referencePos
|
| 360 | ) {
|
| 361 | BlockState stairs = Blocks.NETHER_BRICK_STAIRS.defaultBlockState().setValue(StairBlock.FACING, Direction.SOUTH);
|
| 362 | BlockState nsFence = Blocks.NETHER_BRICK_FENCE.defaultBlockState().setValue(FenceBlock.NORTH, true).setValue(FenceBlock.SOUTH, true);
|
| 363 |
|
| 364 | for (int step = 0; step <= 9; step++) {
|
| 365 | int floor = Math.max(1, 7 - step);
|
| 366 | int roof = Math.min(Math.max(floor + 5, 14 - step), 13);
|
| 367 | int z = step;
|
| 368 | this.generateBox(level, chunkBB, 0, 0, z, 4, floor, z, Blocks.NETHER_BRICKS.defaultBlockState(), Blocks.NETHER_BRICKS.defaultBlockState(), false);
|
| 369 | this.generateBox(level, chunkBB, 1, floor + 1, z, 3, roof - 1, z, Blocks.AIR.defaultBlockState(), Blocks.AIR.defaultBlockState(), false);
|
| 370 | if (step <= 6) {
|
| 371 | this.placeBlock(level, stairs, 1, floor + 1, z, chunkBB);
|
| 372 | this.placeBlock(level, stairs, 2, floor + 1, z, chunkBB);
|
| 373 | this.placeBlock(level, stairs, 3, floor + 1, z, chunkBB);
|
| 374 | }
|
| 375 |
|
| 376 | this.generateBox(level, chunkBB, 0, roof, z, 4, roof, z, Blocks.NETHER_BRICKS.defaultBlockState(), Blocks.NETHER_BRICKS.defaultBlockState(), false);
|
| 377 | this.generateBox(level, chunkBB, 0, floor + 1, z, 0, roof - 1, z, Blocks.NETHER_BRICKS.defaultBlockState(), Blocks.NETHER_BRICKS.defaultBlockState(), false);
|
| 378 | this.generateBox(level, chunkBB, 4, floor + 1, z, 4, roof - 1, z, Blocks.NETHER_BRICKS.defaultBlockState(), Blocks.NETHER_BRICKS.defaultBlockState(), false);
|
| 379 | if ((step & 1) == 0) {
|
| 380 | this.generateBox(level, chunkBB, 0, floor + 2, z, 0, floor + 3, z, nsFence, nsFence, false);
|
| 381 | this.generateBox(level, chunkBB, 4, floor + 2, z, 4, floor + 3, z, nsFence, nsFence, false);
|
| 382 | }
|
| 383 |
|
| 384 | for (int x = 0; x <= 4; x++) {
|
| 385 | this.fillColumnDown(level, Blocks.NETHER_BRICKS.defaultBlockState(), x, -1, z, chunkBB);
|
| 386 | }
|
| 387 | }
|
| 388 | }
|
| 389 | }
|
| 390 |
|
| 391 | public static class CastleCorridorTBalconyPiece extends NetherFortressPieces.NetherBridgePiece {
|
| 392 | private static final int WIDTH = 9;
|
| 393 | private static final int HEIGHT = 7;
|
| 394 | private static final int DEPTH = 9;
|
| 395 |
|
| 396 | public CastleCorridorTBalconyPiece(final int genDepth, final BoundingBox boundingBox, final Direction direction) {
|
| 397 | super(StructurePieceType.NETHER_FORTRESS_CASTLE_CORRIDOR_T_BALCONY, genDepth, boundingBox);
|
| 398 | this.setOrientation(direction);
|
| 399 | }
|
| 400 |
|
| 401 | public CastleCorridorTBalconyPiece(final CompoundTag tag) {
|
| 402 | super(StructurePieceType.NETHER_FORTRESS_CASTLE_CORRIDOR_T_BALCONY, tag);
|
| 403 | }
|
| 404 |
|
| 405 | @Override
|
| 406 | public void addChildren(final StructurePiece startPiece, final StructurePiecesBuilder builder, final RandomSource random) {
|
| 407 | int zOff = 1;
|
| 408 | Direction orientation = this.getOrientation();
|
| 409 | if (orientation == Direction.WEST || orientation == Direction.NORTH) {
|
| 410 | zOff = 5;
|
| 411 | }
|
| 412 |
|
| 413 | this.generateChildLeft((NetherFortressPieces.StartPiece)startPiece, builder, random, 0, zOff, random.nextInt(8) > 0);
|
| 414 | this.generateChildRight((NetherFortressPieces.StartPiece)startPiece, builder, random, 0, zOff, random.nextInt(8) > 0);
|
| 415 | }
|
| 416 |
|
| 417 | public static NetherFortressPieces.@Nullable CastleCorridorTBalconyPiece createPiece(
|
| 418 | final StructurePiecesBuilder builder, final int footX, final int footY, final int footZ, final Direction direction, final int genDepth
|
| 419 | ) {
|
| 420 | BoundingBox box = BoundingBox.orientBox(footX, footY, footZ, -3, 0, 0, 9, 7, 9, direction);
|
| 421 | return isOkBox(box) && builder.findCollisionPiece(box) == null ? new NetherFortressPieces.CastleCorridorTBalconyPiece(genDepth, box, direction) : null;
|
| 422 | }
|
| 423 |
|
| 424 | @Override
|
| 425 | public void postProcess(
|
| 426 | final WorldGenLevel level,
|
| 427 | final StructureManager structureManager,
|
| 428 | final ChunkGenerator generator,
|
| 429 | final RandomSource random,
|
| 430 | final BoundingBox chunkBB,
|
| 431 | final ChunkPos chunkPos,
|
| 432 | final BlockPos referencePos
|
| 433 | ) {
|
| 434 | BlockState nsFence = Blocks.NETHER_BRICK_FENCE.defaultBlockState().setValue(FenceBlock.NORTH, true).setValue(FenceBlock.SOUTH, true);
|
| 435 | BlockState weFence = Blocks.NETHER_BRICK_FENCE.defaultBlockState().setValue(FenceBlock.WEST, true).setValue(FenceBlock.EAST, true);
|
| 436 | this.generateBox(level, chunkBB, 0, 0, 0, 8, 1, 8, Blocks.NETHER_BRICKS.defaultBlockState(), Blocks.NETHER_BRICKS.defaultBlockState(), false);
|
| 437 | this.generateBox(level, chunkBB, 0, 2, 0, 8, 5, 8, Blocks.AIR.defaultBlockState(), Blocks.AIR.defaultBlockState(), false);
|
| 438 | this.generateBox(level, chunkBB, 0, 6, 0, 8, 6, 5, Blocks.NETHER_BRICKS.defaultBlockState(), Blocks.NETHER_BRICKS.defaultBlockState(), false);
|
| 439 | this.generateBox(level, chunkBB, 0, 2, 0, 2, 5, 0, Blocks.NETHER_BRICKS.defaultBlockState(), Blocks.NETHER_BRICKS.defaultBlockState(), false);
|
| 440 | this.generateBox(level, chunkBB, 6, 2, 0, 8, 5, 0, Blocks.NETHER_BRICKS.defaultBlockState(), Blocks.NETHER_BRICKS.defaultBlockState(), false);
|
| 441 | this.generateBox(level, chunkBB, 1, 3, 0, 1, 4, 0, weFence, weFence, false);
|
| 442 | this.generateBox(level, chunkBB, 7, 3, 0, 7, 4, 0, weFence, weFence, false);
|
| 443 | this.generateBox(level, chunkBB, 0, 2, 4, 8, 2, 8, Blocks.NETHER_BRICKS.defaultBlockState(), Blocks.NETHER_BRICKS.defaultBlockState(), false);
|
| 444 | this.generateBox(level, chunkBB, 1, 1, 4, 2, 2, 4, Blocks.AIR.defaultBlockState(), Blocks.AIR.defaultBlockState(), false);
|
| 445 | this.generateBox(level, chunkBB, 6, 1, 4, 7, 2, 4, Blocks.AIR.defaultBlockState(), Blocks.AIR.defaultBlockState(), false);
|
| 446 | this.generateBox(level, chunkBB, 1, 3, 8, 7, 3, 8, weFence, weFence, false);
|
| 447 | this.placeBlock(level, Blocks.NETHER_BRICK_FENCE.defaultBlockState().setValue(FenceBlock.EAST, true).setValue(FenceBlock.SOUTH, true), 0, 3, 8, chunkBB);
|
| 448 | this.placeBlock(level, Blocks.NETHER_BRICK_FENCE.defaultBlockState().setValue(FenceBlock.WEST, true).setValue(FenceBlock.SOUTH, true), 8, 3, 8, chunkBB);
|
| 449 | this.generateBox(level, chunkBB, 0, 3, 6, 0, 3, 7, nsFence, nsFence, false);
|
| 450 | this.generateBox(level, chunkBB, 8, 3, 6, 8, 3, 7, nsFence, nsFence, false);
|
| 451 | this.generateBox(level, chunkBB, 0, 3, 4, 0, 5, 5, Blocks.NETHER_BRICKS.defaultBlockState(), Blocks.NETHER_BRICKS.defaultBlockState(), false);
|
| 452 | this.generateBox(level, chunkBB, 8, 3, 4, 8, 5, 5, Blocks.NETHER_BRICKS.defaultBlockState(), Blocks.NETHER_BRICKS.defaultBlockState(), false);
|
| 453 | this.generateBox(level, chunkBB, 1, 3, 5, 2, 5, 5, Blocks.NETHER_BRICKS.defaultBlockState(), Blocks.NETHER_BRICKS.defaultBlockState(), false);
|
| 454 | this.generateBox(level, chunkBB, 6, 3, 5, 7, 5, 5, Blocks.NETHER_BRICKS.defaultBlockState(), Blocks.NETHER_BRICKS.defaultBlockState(), false);
|
| 455 | this.generateBox(level, chunkBB, 1, 4, 5, 1, 5, 5, weFence, weFence, false);
|
| 456 | this.generateBox(level, chunkBB, 7, 4, 5, 7, 5, 5, weFence, weFence, false);
|
| 457 |
|
| 458 | for (int z = 0; z <= 5; z++) {
|
| 459 | for (int x = 0; x <= 8; x++) {
|
| 460 | this.fillColumnDown(level, Blocks.NETHER_BRICKS.defaultBlockState(), x, -1, z, chunkBB);
|
| 461 | }
|
| 462 | }
|
| 463 | }
|
| 464 | }
|
| 465 |
|
| 466 | public static class CastleEntrance extends NetherFortressPieces.NetherBridgePiece {
|
| 467 | private static final int WIDTH = 13;
|
| 468 | private static final int HEIGHT = 14;
|
| 469 | private static final int DEPTH = 13;
|
| 470 |
|
| 471 | public CastleEntrance(final int genDepth, final RandomSource random, final BoundingBox boundingBox, final Direction direction) {
|
| 472 | super(StructurePieceType.NETHER_FORTRESS_CASTLE_ENTRANCE, genDepth, boundingBox);
|
| 473 | this.setOrientation(direction);
|
| 474 | }
|
| 475 |
|
| 476 | public CastleEntrance(final CompoundTag tag) {
|
| 477 | super(StructurePieceType.NETHER_FORTRESS_CASTLE_ENTRANCE, tag);
|
| 478 | }
|
| 479 |
|
| 480 | @Override
|
| 481 | public void addChildren(final StructurePiece startPiece, final StructurePiecesBuilder builder, final RandomSource random) {
|
| 482 | this.generateChildForward((NetherFortressPieces.StartPiece)startPiece, builder, random, 5, 3, true);
|
| 483 | }
|
| 484 |
|
| 485 | public static NetherFortressPieces.@Nullable CastleEntrance createPiece(
|
| 486 | final StructurePiecesBuilder builder,
|
| 487 | final RandomSource random,
|
| 488 | final int footX,
|
| 489 | final int footY,
|
| 490 | final int footZ,
|
| 491 | final Direction direction,
|
| 492 | final int genDepth
|
| 493 | ) {
|
| 494 | BoundingBox box = BoundingBox.orientBox(footX, footY, footZ, -5, -3, 0, 13, 14, 13, direction);
|
| 495 | return isOkBox(box) && builder.findCollisionPiece(box) == null ? new NetherFortressPieces.CastleEntrance(genDepth, random, box, direction) : null;
|
| 496 | }
|
| 497 |
|
| 498 | @Override
|
| 499 | public void postProcess(
|
| 500 | final WorldGenLevel level,
|
| 501 | final StructureManager structureManager,
|
| 502 | final ChunkGenerator generator,
|
| 503 | final RandomSource random,
|
| 504 | final BoundingBox chunkBB,
|
| 505 | final ChunkPos chunkPos,
|
| 506 | final BlockPos referencePos
|
| 507 | ) {
|
| 508 | this.generateBox(level, chunkBB, 0, 3, 0, 12, 4, 12, Blocks.NETHER_BRICKS.defaultBlockState(), Blocks.NETHER_BRICKS.defaultBlockState(), false);
|
| 509 | this.generateBox(level, chunkBB, 0, 5, 0, 12, 13, 12, Blocks.AIR.defaultBlockState(), Blocks.AIR.defaultBlockState(), false);
|
| 510 | this.generateBox(level, chunkBB, 0, 5, 0, 1, 12, 12, Blocks.NETHER_BRICKS.defaultBlockState(), Blocks.NETHER_BRICKS.defaultBlockState(), false);
|
| 511 | this.generateBox(level, chunkBB, 11, 5, 0, 12, 12, 12, Blocks.NETHER_BRICKS.defaultBlockState(), Blocks.NETHER_BRICKS.defaultBlockState(), false);
|
| 512 | this.generateBox(level, chunkBB, 2, 5, 11, 4, 12, 12, Blocks.NETHER_BRICKS.defaultBlockState(), Blocks.NETHER_BRICKS.defaultBlockState(), false);
|
| 513 | this.generateBox(level, chunkBB, 8, 5, 11, 10, 12, 12, Blocks.NETHER_BRICKS.defaultBlockState(), Blocks.NETHER_BRICKS.defaultBlockState(), false);
|
| 514 | this.generateBox(level, chunkBB, 5, 9, 11, 7, 12, 12, Blocks.NETHER_BRICKS.defaultBlockState(), Blocks.NETHER_BRICKS.defaultBlockState(), false);
|
| 515 | this.generateBox(level, chunkBB, 2, 5, 0, 4, 12, 1, Blocks.NETHER_BRICKS.defaultBlockState(), Blocks.NETHER_BRICKS.defaultBlockState(), false);
|
| 516 | this.generateBox(level, chunkBB, 8, 5, 0, 10, 12, 1, Blocks.NETHER_BRICKS.defaultBlockState(), Blocks.NETHER_BRICKS.defaultBlockState(), false);
|
| 517 | this.generateBox(level, chunkBB, 5, 9, 0, 7, 12, 1, Blocks.NETHER_BRICKS.defaultBlockState(), Blocks.NETHER_BRICKS.defaultBlockState(), false);
|
| 518 | this.generateBox(level, chunkBB, 2, 11, 2, 10, 12, 10, Blocks.NETHER_BRICKS.defaultBlockState(), Blocks.NETHER_BRICKS.defaultBlockState(), false);
|
| 519 | this.generateBox(level, chunkBB, 5, 8, 0, 7, 8, 0, Blocks.NETHER_BRICK_FENCE.defaultBlockState(), Blocks.NETHER_BRICK_FENCE.defaultBlockState(), false);
|
| 520 | BlockState weFence = Blocks.NETHER_BRICK_FENCE.defaultBlockState().setValue(FenceBlock.WEST, true).setValue(FenceBlock.EAST, true);
|
| 521 | BlockState nsFence = Blocks.NETHER_BRICK_FENCE.defaultBlockState().setValue(FenceBlock.NORTH, true).setValue(FenceBlock.SOUTH, true);
|
| 522 |
|
| 523 | for (int i = 1; i <= 11; i += 2) {
|
| 524 | this.generateBox(level, chunkBB, i, 10, 0, i, 11, 0, weFence, weFence, false);
|
| 525 | this.generateBox(level, chunkBB, i, 10, 12, i, 11, 12, weFence, weFence, false);
|
| 526 | this.generateBox(level, chunkBB, 0, 10, i, 0, 11, i, nsFence, nsFence, false);
|
| 527 | this.generateBox(level, chunkBB, 12, 10, i, 12, 11, i, nsFence, nsFence, false);
|
| 528 | this.placeBlock(level, Blocks.NETHER_BRICKS.defaultBlockState(), i, 13, 0, chunkBB);
|
| 529 | this.placeBlock(level, Blocks.NETHER_BRICKS.defaultBlockState(), i, 13, 12, chunkBB);
|
| 530 | this.placeBlock(level, Blocks.NETHER_BRICKS.defaultBlockState(), 0, 13, i, chunkBB);
|
| 531 | this.placeBlock(level, Blocks.NETHER_BRICKS.defaultBlockState(), 12, 13, i, chunkBB);
|
| 532 | if (i != 11) {
|
| 533 | this.placeBlock(level, weFence, i + 1, 13, 0, chunkBB);
|
| 534 | this.placeBlock(level, weFence, i + 1, 13, 12, chunkBB);
|
| 535 | this.placeBlock(level, nsFence, 0, 13, i + 1, chunkBB);
|
| 536 | this.placeBlock(level, nsFence, 12, 13, i + 1, chunkBB);
|
| 537 | }
|
| 538 | }
|
| 539 |
|
| 540 | this.placeBlock(level, Blocks.NETHER_BRICK_FENCE.defaultBlockState().setValue(FenceBlock.NORTH, true).setValue(FenceBlock.EAST, true), 0, 13, 0, chunkBB);
|
| 541 | this.placeBlock(level, Blocks.NETHER_BRICK_FENCE.defaultBlockState().setValue(FenceBlock.SOUTH, true).setValue(FenceBlock.EAST, true), 0, 13, 12, chunkBB);
|
| 542 | this.placeBlock(level, Blocks.NETHER_BRICK_FENCE.defaultBlockState().setValue(FenceBlock.SOUTH, true).setValue(FenceBlock.WEST, true), 12, 13, 12, chunkBB);
|
| 543 | this.placeBlock(level, Blocks.NETHER_BRICK_FENCE.defaultBlockState().setValue(FenceBlock.NORTH, true).setValue(FenceBlock.WEST, true), 12, 13, 0, chunkBB);
|
| 544 |
|
| 545 | for (int z = 3; z <= 9; z += 2) {
|
| 546 | this.generateBox(level, chunkBB, 1, 7, z, 1, 8, z, nsFence.setValue(FenceBlock.WEST, true), nsFence.setValue(FenceBlock.WEST, true), false);
|
| 547 | this.generateBox(level, chunkBB, 11, 7, z, 11, 8, z, nsFence.setValue(FenceBlock.EAST, true), nsFence.setValue(FenceBlock.EAST, true), false);
|
| 548 | }
|
| 549 |
|
| 550 | this.generateBox(level, chunkBB, 4, 2, 0, 8, 2, 12, Blocks.NETHER_BRICKS.defaultBlockState(), Blocks.NETHER_BRICKS.defaultBlockState(), false);
|
| 551 | this.generateBox(level, chunkBB, 0, 2, 4, 12, 2, 8, Blocks.NETHER_BRICKS.defaultBlockState(), Blocks.NETHER_BRICKS.defaultBlockState(), false);
|
| 552 | this.generateBox(level, chunkBB, 4, 0, 0, 8, 1, 3, Blocks.NETHER_BRICKS.defaultBlockState(), Blocks.NETHER_BRICKS.defaultBlockState(), false);
|
| 553 | this.generateBox(level, chunkBB, 4, 0, 9, 8, 1, 12, Blocks.NETHER_BRICKS.defaultBlockState(), Blocks.NETHER_BRICKS.defaultBlockState(), false);
|
| 554 | this.generateBox(level, chunkBB, 0, 0, 4, 3, 1, 8, Blocks.NETHER_BRICKS.defaultBlockState(), Blocks.NETHER_BRICKS.defaultBlockState(), false);
|
| 555 | this.generateBox(level, chunkBB, 9, 0, 4, 12, 1, 8, Blocks.NETHER_BRICKS.defaultBlockState(), Blocks.NETHER_BRICKS.defaultBlockState(), false);
|
| 556 |
|
| 557 | for (int x = 4; x <= 8; x++) {
|
| 558 | for (int z = 0; z <= 2; z++) {
|
| 559 | this.fillColumnDown(level, Blocks.NETHER_BRICKS.defaultBlockState(), x, -1, z, chunkBB);
|
| 560 | this.fillColumnDown(level, Blocks.NETHER_BRICKS.defaultBlockState(), x, -1, 12 - z, chunkBB);
|
| 561 | }
|
| 562 | }
|
| 563 |
|
| 564 | for (int x = 0; x <= 2; x++) {
|
| 565 | for (int z = 4; z <= 8; z++) {
|
| 566 | this.fillColumnDown(level, Blocks.NETHER_BRICKS.defaultBlockState(), x, -1, z, chunkBB);
|
| 567 | this.fillColumnDown(level, Blocks.NETHER_BRICKS.defaultBlockState(), 12 - x, -1, z, chunkBB);
|
| 568 | }
|
| 569 | }
|
| 570 |
|
| 571 | this.generateBox(level, chunkBB, 5, 5, 5, 7, 5, 7, Blocks.NETHER_BRICKS.defaultBlockState(), Blocks.NETHER_BRICKS.defaultBlockState(), false);
|
| 572 | this.generateBox(level, chunkBB, 6, 1, 6, 6, 4, 6, Blocks.AIR.defaultBlockState(), Blocks.AIR.defaultBlockState(), false);
|
| 573 | this.placeBlock(level, Blocks.NETHER_BRICKS.defaultBlockState(), 6, 0, 6, chunkBB);
|
| 574 | this.placeBlock(level, Blocks.LAVA.defaultBlockState(), 6, 5, 6, chunkBB);
|
| 575 | BlockPos pos = this.getWorldPos(6, 5, 6);
|
| 576 | if (chunkBB.isInside(pos)) {
|
| 577 | level.scheduleTick(pos, Fluids.LAVA, 0);
|
| 578 | }
|
| 579 | }
|
| 580 | }
|
| 581 |
|
| 582 | public static class CastleSmallCorridorCrossingPiece extends NetherFortressPieces.NetherBridgePiece {
|
| 583 | private static final int WIDTH = 5;
|
| 584 | private static final int HEIGHT = 7;
|
| 585 | private static final int DEPTH = 5;
|
| 586 |
|
| 587 | public CastleSmallCorridorCrossingPiece(final int genDepth, final BoundingBox boundingBox, final Direction direction) {
|
| 588 | super(StructurePieceType.NETHER_FORTRESS_CASTLE_SMALL_CORRIDOR_CROSSING, genDepth, boundingBox);
|
| 589 | this.setOrientation(direction);
|
| 590 | }
|
| 591 |
|
| 592 | public CastleSmallCorridorCrossingPiece(final CompoundTag tag) {
|
| 593 | super(StructurePieceType.NETHER_FORTRESS_CASTLE_SMALL_CORRIDOR_CROSSING, tag);
|
| 594 | }
|
| 595 |
|
| 596 | @Override
|
| 597 | public void addChildren(final StructurePiece startPiece, final StructurePiecesBuilder builder, final RandomSource random) {
|
| 598 | this.generateChildForward((NetherFortressPieces.StartPiece)startPiece, builder, random, 1, 0, true);
|
| 599 | this.generateChildLeft((NetherFortressPieces.StartPiece)startPiece, builder, random, 0, 1, true);
|
| 600 | this.generateChildRight((NetherFortressPieces.StartPiece)startPiece, builder, random, 0, 1, true);
|
| 601 | }
|
| 602 |
|
| 603 | public static NetherFortressPieces.@Nullable CastleSmallCorridorCrossingPiece createPiece(
|
| 604 | final StructurePiecesBuilder builder, final int footX, final int footY, final int footZ, final Direction direction, final int genDepth
|
| 605 | ) {
|
| 606 | BoundingBox box = BoundingBox.orientBox(footX, footY, footZ, -1, 0, 0, 5, 7, 5, direction);
|
| 607 | return isOkBox(box) && builder.findCollisionPiece(box) == null ? new NetherFortressPieces.CastleSmallCorridorCrossingPiece(genDepth, box, direction) : null;
|
| 608 | }
|
| 609 |
|
| 610 | @Override
|
| 611 | public void postProcess(
|
| 612 | final WorldGenLevel level,
|
| 613 | final StructureManager structureManager,
|
| 614 | final ChunkGenerator generator,
|
| 615 | final RandomSource random,
|
| 616 | final BoundingBox chunkBB,
|
| 617 | final ChunkPos chunkPos,
|
| 618 | final BlockPos referencePos
|
| 619 | ) {
|
| 620 | this.generateBox(level, chunkBB, 0, 0, 0, 4, 1, 4, Blocks.NETHER_BRICKS.defaultBlockState(), Blocks.NETHER_BRICKS.defaultBlockState(), false);
|
| 621 | this.generateBox(level, chunkBB, 0, 2, 0, 4, 5, 4, Blocks.AIR.defaultBlockState(), Blocks.AIR.defaultBlockState(), false);
|
| 622 | this.generateBox(level, chunkBB, 0, 2, 0, 0, 5, 0, Blocks.NETHER_BRICKS.defaultBlockState(), Blocks.NETHER_BRICKS.defaultBlockState(), false);
|
| 623 | this.generateBox(level, chunkBB, 4, 2, 0, 4, 5, 0, Blocks.NETHER_BRICKS.defaultBlockState(), Blocks.NETHER_BRICKS.defaultBlockState(), false);
|
| 624 | this.generateBox(level, chunkBB, 0, 2, 4, 0, 5, 4, Blocks.NETHER_BRICKS.defaultBlockState(), Blocks.NETHER_BRICKS.defaultBlockState(), false);
|
| 625 | this.generateBox(level, chunkBB, 4, 2, 4, 4, 5, 4, Blocks.NETHER_BRICKS.defaultBlockState(), Blocks.NETHER_BRICKS.defaultBlockState(), false);
|
| 626 | this.generateBox(level, chunkBB, 0, 6, 0, 4, 6, 4, Blocks.NETHER_BRICKS.defaultBlockState(), Blocks.NETHER_BRICKS.defaultBlockState(), false);
|
| 627 |
|
| 628 | for (int x = 0; x <= 4; x++) {
|
| 629 | for (int z = 0; z <= 4; z++) {
|
| 630 | this.fillColumnDown(level, Blocks.NETHER_BRICKS.defaultBlockState(), x, -1, z, chunkBB);
|
| 631 | }
|
| 632 | }
|
| 633 | }
|
| 634 | }
|
| 635 |
|
| 636 | public static class CastleSmallCorridorLeftTurnPiece extends NetherFortressPieces.NetherBridgePiece {
|
| 637 | private static final int WIDTH = 5;
|
| 638 | private static final int HEIGHT = 7;
|
| 639 | private static final int DEPTH = 5;
|
| 640 | private boolean isNeedingChest;
|
| 641 |
|
| 642 | public CastleSmallCorridorLeftTurnPiece(final int genDepth, final RandomSource random, final BoundingBox boundingBox, final Direction direction) {
|
| 643 | super(StructurePieceType.NETHER_FORTRESS_CASTLE_SMALL_CORRIDOR_LEFT_TURN, genDepth, boundingBox);
|
| 644 | this.setOrientation(direction);
|
| 645 | this.isNeedingChest = random.nextInt(3) == 0;
|
| 646 | }
|
| 647 |
|
| 648 | public CastleSmallCorridorLeftTurnPiece(final CompoundTag tag) {
|
| 649 | super(StructurePieceType.NETHER_FORTRESS_CASTLE_SMALL_CORRIDOR_LEFT_TURN, tag);
|
| 650 | this.isNeedingChest = tag.getBooleanOr("Chest", false);
|
| 651 | }
|
| 652 |
|
| 653 | @Override
|
| 654 | protected void addAdditionalSaveData(final StructurePieceSerializationContext context, final CompoundTag tag) {
|
| 655 | super.addAdditionalSaveData(context, tag);
|
| 656 | tag.putBoolean("Chest", this.isNeedingChest);
|
| 657 | }
|
| 658 |
|
| 659 | @Override
|
| 660 | public void addChildren(final StructurePiece startPiece, final StructurePiecesBuilder builder, final RandomSource random) {
|
| 661 | this.generateChildLeft((NetherFortressPieces.StartPiece)startPiece, builder, random, 0, 1, true);
|
| 662 | }
|
| 663 |
|
| 664 | public static NetherFortressPieces.@Nullable CastleSmallCorridorLeftTurnPiece createPiece(
|
| 665 | final StructurePiecesBuilder builder,
|
| 666 | final RandomSource random,
|
| 667 | final int footX,
|
| 668 | final int footY,
|
| 669 | final int footZ,
|
| 670 | final Direction direction,
|
| 671 | final int genDepth
|
| 672 | ) {
|
| 673 | BoundingBox box = BoundingBox.orientBox(footX, footY, footZ, -1, 0, 0, 5, 7, 5, direction);
|
| 674 | return isOkBox(box) && builder.findCollisionPiece(box) == null
|
| 675 | ? new NetherFortressPieces.CastleSmallCorridorLeftTurnPiece(genDepth, random, box, direction)
|
| 676 | : null;
|
| 677 | }
|
| 678 |
|
| 679 | @Override
|
| 680 | public void postProcess(
|
| 681 | final WorldGenLevel level,
|
| 682 | final StructureManager structureManager,
|
| 683 | final ChunkGenerator generator,
|
| 684 | final RandomSource random,
|
| 685 | final BoundingBox chunkBB,
|
| 686 | final ChunkPos chunkPos,
|
| 687 | final BlockPos referencePos
|
| 688 | ) {
|
| 689 | this.generateBox(level, chunkBB, 0, 0, 0, 4, 1, 4, Blocks.NETHER_BRICKS.defaultBlockState(), Blocks.NETHER_BRICKS.defaultBlockState(), false);
|
| 690 | this.generateBox(level, chunkBB, 0, 2, 0, 4, 5, 4, Blocks.AIR.defaultBlockState(), Blocks.AIR.defaultBlockState(), false);
|
| 691 | BlockState weFence = Blocks.NETHER_BRICK_FENCE.defaultBlockState().setValue(FenceBlock.WEST, true).setValue(FenceBlock.EAST, true);
|
| 692 | BlockState nsFence = Blocks.NETHER_BRICK_FENCE.defaultBlockState().setValue(FenceBlock.NORTH, true).setValue(FenceBlock.SOUTH, true);
|
| 693 | this.generateBox(level, chunkBB, 4, 2, 0, 4, 5, 4, Blocks.NETHER_BRICKS.defaultBlockState(), Blocks.NETHER_BRICKS.defaultBlockState(), false);
|
| 694 | this.generateBox(level, chunkBB, 4, 3, 1, 4, 4, 1, nsFence, nsFence, false);
|
| 695 | this.generateBox(level, chunkBB, 4, 3, 3, 4, 4, 3, nsFence, nsFence, false);
|
| 696 | this.generateBox(level, chunkBB, 0, 2, 0, 0, 5, 0, Blocks.NETHER_BRICKS.defaultBlockState(), Blocks.NETHER_BRICKS.defaultBlockState(), false);
|
| 697 | this.generateBox(level, chunkBB, 0, 2, 4, 3, 5, 4, Blocks.NETHER_BRICKS.defaultBlockState(), Blocks.NETHER_BRICKS.defaultBlockState(), false);
|
| 698 | this.generateBox(level, chunkBB, 1, 3, 4, 1, 4, 4, weFence, weFence, false);
|
| 699 | this.generateBox(level, chunkBB, 3, 3, 4, 3, 4, 4, weFence, weFence, false);
|
| 700 | if (this.isNeedingChest && chunkBB.isInside(this.getWorldPos(3, 2, 3))) {
|
| 701 | this.isNeedingChest = false;
|
| 702 | this.createChest(level, chunkBB, random, 3, 2, 3, BuiltInLootTables.NETHER_BRIDGE);
|
| 703 | }
|
| 704 |
|
| 705 | this.generateBox(level, chunkBB, 0, 6, 0, 4, 6, 4, Blocks.NETHER_BRICKS.defaultBlockState(), Blocks.NETHER_BRICKS.defaultBlockState(), false);
|
| 706 |
|
| 707 | for (int x = 0; x <= 4; x++) {
|
| 708 | for (int z = 0; z <= 4; z++) {
|
| 709 | this.fillColumnDown(level, Blocks.NETHER_BRICKS.defaultBlockState(), x, -1, z, chunkBB);
|
| 710 | }
|
| 711 | }
|
| 712 | }
|
| 713 | }
|
| 714 |
|
| 715 | public static class CastleSmallCorridorPiece extends NetherFortressPieces.NetherBridgePiece {
|
| 716 | private static final int WIDTH = 5;
|
| 717 | private static final int HEIGHT = 7;
|
| 718 | private static final int DEPTH = 5;
|
| 719 |
|
| 720 | public CastleSmallCorridorPiece(final int genDepth, final BoundingBox boundingBox, final Direction direction) {
|
| 721 | super(StructurePieceType.NETHER_FORTRESS_CASTLE_SMALL_CORRIDOR, genDepth, boundingBox);
|
| 722 | this.setOrientation(direction);
|
| 723 | }
|
| 724 |
|
| 725 | public CastleSmallCorridorPiece(final CompoundTag tag) {
|
| 726 | super(StructurePieceType.NETHER_FORTRESS_CASTLE_SMALL_CORRIDOR, tag);
|
| 727 | }
|
| 728 |
|
| 729 | @Override
|
| 730 | public void addChildren(final StructurePiece startPiece, final StructurePiecesBuilder builder, final RandomSource random) {
|
| 731 | this.generateChildForward((NetherFortressPieces.StartPiece)startPiece, builder, random, 1, 0, true);
|
| 732 | }
|
| 733 |
|
| 734 | public static NetherFortressPieces.@Nullable CastleSmallCorridorPiece createPiece(
|
| 735 | final StructurePiecesBuilder builder, final int footX, final int footY, final int footZ, final Direction direction, final int genDepth
|
| 736 | ) {
|
| 737 | BoundingBox box = BoundingBox.orientBox(footX, footY, footZ, -1, 0, 0, 5, 7, 5, direction);
|
| 738 | return isOkBox(box) && builder.findCollisionPiece(box) == null ? new NetherFortressPieces.CastleSmallCorridorPiece(genDepth, box, direction) : null;
|
| 739 | }
|
| 740 |
|
| 741 | @Override
|
| 742 | public void postProcess(
|
| 743 | final WorldGenLevel level,
|
| 744 | final StructureManager structureManager,
|
| 745 | final ChunkGenerator generator,
|
| 746 | final RandomSource random,
|
| 747 | final BoundingBox chunkBB,
|
| 748 | final ChunkPos chunkPos,
|
| 749 | final BlockPos referencePos
|
| 750 | ) {
|
| 751 | this.generateBox(level, chunkBB, 0, 0, 0, 4, 1, 4, Blocks.NETHER_BRICKS.defaultBlockState(), Blocks.NETHER_BRICKS.defaultBlockState(), false);
|
| 752 | this.generateBox(level, chunkBB, 0, 2, 0, 4, 5, 4, Blocks.AIR.defaultBlockState(), Blocks.AIR.defaultBlockState(), false);
|
| 753 | BlockState nsFence = Blocks.NETHER_BRICK_FENCE.defaultBlockState().setValue(FenceBlock.NORTH, true).setValue(FenceBlock.SOUTH, true);
|
| 754 | this.generateBox(level, chunkBB, 0, 2, 0, 0, 5, 4, Blocks.NETHER_BRICKS.defaultBlockState(), Blocks.NETHER_BRICKS.defaultBlockState(), false);
|
| 755 | this.generateBox(level, chunkBB, 4, 2, 0, 4, 5, 4, Blocks.NETHER_BRICKS.defaultBlockState(), Blocks.NETHER_BRICKS.defaultBlockState(), false);
|
| 756 | this.generateBox(level, chunkBB, 0, 3, 1, 0, 4, 1, nsFence, nsFence, false);
|
| 757 | this.generateBox(level, chunkBB, 0, 3, 3, 0, 4, 3, nsFence, nsFence, false);
|
| 758 | this.generateBox(level, chunkBB, 4, 3, 1, 4, 4, 1, nsFence, nsFence, false);
|
| 759 | this.generateBox(level, chunkBB, 4, 3, 3, 4, 4, 3, nsFence, nsFence, false);
|
| 760 | this.generateBox(level, chunkBB, 0, 6, 0, 4, 6, 4, Blocks.NETHER_BRICKS.defaultBlockState(), Blocks.NETHER_BRICKS.defaultBlockState(), false);
|
| 761 |
|
| 762 | for (int x = 0; x <= 4; x++) {
|
| 763 | for (int z = 0; z <= 4; z++) {
|
| 764 | this.fillColumnDown(level, Blocks.NETHER_BRICKS.defaultBlockState(), x, -1, z, chunkBB);
|
| 765 | }
|
| 766 | }
|
| 767 | }
|
| 768 | }
|
| 769 |
|
| 770 | public static class CastleSmallCorridorRightTurnPiece extends NetherFortressPieces.NetherBridgePiece {
|
| 771 | private static final int WIDTH = 5;
|
| 772 | private static final int HEIGHT = 7;
|
| 773 | private static final int DEPTH = 5;
|
| 774 | private boolean isNeedingChest;
|
| 775 |
|
| 776 | public CastleSmallCorridorRightTurnPiece(final int genDepth, final RandomSource random, final BoundingBox boundingBox, final Direction direction) {
|
| 777 | super(StructurePieceType.NETHER_FORTRESS_CASTLE_SMALL_CORRIDOR_RIGHT_TURN, genDepth, boundingBox);
|
| 778 | this.setOrientation(direction);
|
| 779 | this.isNeedingChest = random.nextInt(3) == 0;
|
| 780 | }
|
| 781 |
|
| 782 | public CastleSmallCorridorRightTurnPiece(final CompoundTag tag) {
|
| 783 | super(StructurePieceType.NETHER_FORTRESS_CASTLE_SMALL_CORRIDOR_RIGHT_TURN, tag);
|
| 784 | this.isNeedingChest = tag.getBooleanOr("Chest", false);
|
| 785 | }
|
| 786 |
|
| 787 | @Override
|
| 788 | protected void addAdditionalSaveData(final StructurePieceSerializationContext context, final CompoundTag tag) {
|
| 789 | super.addAdditionalSaveData(context, tag);
|
| 790 | tag.putBoolean("Chest", this.isNeedingChest);
|
| 791 | }
|
| 792 |
|
| 793 | @Override
|
| 794 | public void addChildren(final StructurePiece startPiece, final StructurePiecesBuilder builder, final RandomSource random) {
|
| 795 | this.generateChildRight((NetherFortressPieces.StartPiece)startPiece, builder, random, 0, 1, true);
|
| 796 | }
|
| 797 |
|
| 798 | public static NetherFortressPieces.@Nullable CastleSmallCorridorRightTurnPiece createPiece(
|
| 799 | final StructurePiecesBuilder builder,
|
| 800 | final RandomSource random,
|
| 801 | final int footX,
|
| 802 | final int footY,
|
| 803 | final int footZ,
|
| 804 | final Direction direction,
|
| 805 | final int genDepth
|
| 806 | ) {
|
| 807 | BoundingBox box = BoundingBox.orientBox(footX, footY, footZ, -1, 0, 0, 5, 7, 5, direction);
|
| 808 | return isOkBox(box) && builder.findCollisionPiece(box) == null
|
| 809 | ? new NetherFortressPieces.CastleSmallCorridorRightTurnPiece(genDepth, random, box, direction)
|
| 810 | : null;
|
| 811 | }
|
| 812 |
|
| 813 | @Override
|
| 814 | public void postProcess(
|
| 815 | final WorldGenLevel level,
|
| 816 | final StructureManager structureManager,
|
| 817 | final ChunkGenerator generator,
|
| 818 | final RandomSource random,
|
| 819 | final BoundingBox chunkBB,
|
| 820 | final ChunkPos chunkPos,
|
| 821 | final BlockPos referencePos
|
| 822 | ) {
|
| 823 | this.generateBox(level, chunkBB, 0, 0, 0, 4, 1, 4, Blocks.NETHER_BRICKS.defaultBlockState(), Blocks.NETHER_BRICKS.defaultBlockState(), false);
|
| 824 | this.generateBox(level, chunkBB, 0, 2, 0, 4, 5, 4, Blocks.AIR.defaultBlockState(), Blocks.AIR.defaultBlockState(), false);
|
| 825 | BlockState weFence = Blocks.NETHER_BRICK_FENCE.defaultBlockState().setValue(FenceBlock.WEST, true).setValue(FenceBlock.EAST, true);
|
| 826 | BlockState nsFence = Blocks.NETHER_BRICK_FENCE.defaultBlockState().setValue(FenceBlock.NORTH, true).setValue(FenceBlock.SOUTH, true);
|
| 827 | this.generateBox(level, chunkBB, 0, 2, 0, 0, 5, 4, Blocks.NETHER_BRICKS.defaultBlockState(), Blocks.NETHER_BRICKS.defaultBlockState(), false);
|
| 828 | this.generateBox(level, chunkBB, 0, 3, 1, 0, 4, 1, nsFence, nsFence, false);
|
| 829 | this.generateBox(level, chunkBB, 0, 3, 3, 0, 4, 3, nsFence, nsFence, false);
|
| 830 | this.generateBox(level, chunkBB, 4, 2, 0, 4, 5, 0, Blocks.NETHER_BRICKS.defaultBlockState(), Blocks.NETHER_BRICKS.defaultBlockState(), false);
|
| 831 | this.generateBox(level, chunkBB, 1, 2, 4, 4, 5, 4, Blocks.NETHER_BRICKS.defaultBlockState(), Blocks.NETHER_BRICKS.defaultBlockState(), false);
|
| 832 | this.generateBox(level, chunkBB, 1, 3, 4, 1, 4, 4, weFence, weFence, false);
|
| 833 | this.generateBox(level, chunkBB, 3, 3, 4, 3, 4, 4, weFence, weFence, false);
|
| 834 | if (this.isNeedingChest && chunkBB.isInside(this.getWorldPos(1, 2, 3))) {
|
| 835 | this.isNeedingChest = false;
|
| 836 | this.createChest(level, chunkBB, random, 1, 2, 3, BuiltInLootTables.NETHER_BRIDGE);
|
| 837 | }
|
| 838 |
|
| 839 | this.generateBox(level, chunkBB, 0, 6, 0, 4, 6, 4, Blocks.NETHER_BRICKS.defaultBlockState(), Blocks.NETHER_BRICKS.defaultBlockState(), false);
|
| 840 |
|
| 841 | for (int x = 0; x <= 4; x++) {
|
| 842 | for (int z = 0; z <= 4; z++) {
|
| 843 | this.fillColumnDown(level, Blocks.NETHER_BRICKS.defaultBlockState(), x, -1, z, chunkBB);
|
| 844 | }
|
| 845 | }
|
| 846 | }
|
| 847 | }
|
| 848 |
|
| 849 | public static class CastleStalkRoom extends NetherFortressPieces.NetherBridgePiece {
|
| 850 | private static final int WIDTH = 13;
|
| 851 | private static final int HEIGHT = 14;
|
| 852 | private static final int DEPTH = 13;
|
| 853 |
|
| 854 | public CastleStalkRoom(final int genDepth, final BoundingBox boundingBox, final Direction direction) {
|
| 855 | super(StructurePieceType.NETHER_FORTRESS_CASTLE_STALK_ROOM, genDepth, boundingBox);
|
| 856 | this.setOrientation(direction);
|
| 857 | }
|
| 858 |
|
| 859 | public CastleStalkRoom(final CompoundTag tag) {
|
| 860 | super(StructurePieceType.NETHER_FORTRESS_CASTLE_STALK_ROOM, tag);
|
| 861 | }
|
| 862 |
|
| 863 | @Override
|
| 864 | public void addChildren(final StructurePiece startPiece, final StructurePiecesBuilder builder, final RandomSource random) {
|
| 865 | this.generateChildForward((NetherFortressPieces.StartPiece)startPiece, builder, random, 5, 3, true);
|
| 866 | this.generateChildForward((NetherFortressPieces.StartPiece)startPiece, builder, random, 5, 11, true);
|
| 867 | }
|
| 868 |
|
| 869 | public static NetherFortressPieces.@Nullable CastleStalkRoom createPiece(
|
| 870 | final StructurePiecesBuilder builder, final int footX, final int footY, final int footZ, final Direction direction, final int genDepth
|
| 871 | ) {
|
| 872 | BoundingBox box = BoundingBox.orientBox(footX, footY, footZ, -5, -3, 0, 13, 14, 13, direction);
|
| 873 | return isOkBox(box) && builder.findCollisionPiece(box) == null ? new NetherFortressPieces.CastleStalkRoom(genDepth, box, direction) : null;
|
| 874 | }
|
| 875 |
|
| 876 | @Override
|
| 877 | public void postProcess(
|
| 878 | final WorldGenLevel level,
|
| 879 | final StructureManager structureManager,
|
| 880 | final ChunkGenerator generator,
|
| 881 | final RandomSource random,
|
| 882 | final BoundingBox chunkBB,
|
| 883 | final ChunkPos chunkPos,
|
| 884 | final BlockPos referencePos
|
| 885 | ) {
|
| 886 | this.generateBox(level, chunkBB, 0, 3, 0, 12, 4, 12, Blocks.NETHER_BRICKS.defaultBlockState(), Blocks.NETHER_BRICKS.defaultBlockState(), false);
|
| 887 | this.generateBox(level, chunkBB, 0, 5, 0, 12, 13, 12, Blocks.AIR.defaultBlockState(), Blocks.AIR.defaultBlockState(), false);
|
| 888 | this.generateBox(level, chunkBB, 0, 5, 0, 1, 12, 12, Blocks.NETHER_BRICKS.defaultBlockState(), Blocks.NETHER_BRICKS.defaultBlockState(), false);
|
| 889 | this.generateBox(level, chunkBB, 11, 5, 0, 12, 12, 12, Blocks.NETHER_BRICKS.defaultBlockState(), Blocks.NETHER_BRICKS.defaultBlockState(), false);
|
| 890 | this.generateBox(level, chunkBB, 2, 5, 11, 4, 12, 12, Blocks.NETHER_BRICKS.defaultBlockState(), Blocks.NETHER_BRICKS.defaultBlockState(), false);
|
| 891 | this.generateBox(level, chunkBB, 8, 5, 11, 10, 12, 12, Blocks.NETHER_BRICKS.defaultBlockState(), Blocks.NETHER_BRICKS.defaultBlockState(), false);
|
| 892 | this.generateBox(level, chunkBB, 5, 9, 11, 7, 12, 12, Blocks.NETHER_BRICKS.defaultBlockState(), Blocks.NETHER_BRICKS.defaultBlockState(), false);
|
| 893 | this.generateBox(level, chunkBB, 2, 5, 0, 4, 12, 1, Blocks.NETHER_BRICKS.defaultBlockState(), Blocks.NETHER_BRICKS.defaultBlockState(), false);
|
| 894 | this.generateBox(level, chunkBB, 8, 5, 0, 10, 12, 1, Blocks.NETHER_BRICKS.defaultBlockState(), Blocks.NETHER_BRICKS.defaultBlockState(), false);
|
| 895 | this.generateBox(level, chunkBB, 5, 9, 0, 7, 12, 1, Blocks.NETHER_BRICKS.defaultBlockState(), Blocks.NETHER_BRICKS.defaultBlockState(), false);
|
| 896 | this.generateBox(level, chunkBB, 2, 11, 2, 10, 12, 10, Blocks.NETHER_BRICKS.defaultBlockState(), Blocks.NETHER_BRICKS.defaultBlockState(), false);
|
| 897 | BlockState weFence = Blocks.NETHER_BRICK_FENCE.defaultBlockState().setValue(FenceBlock.WEST, true).setValue(FenceBlock.EAST, true);
|
| 898 | BlockState nsFence = Blocks.NETHER_BRICK_FENCE.defaultBlockState().setValue(FenceBlock.NORTH, true).setValue(FenceBlock.SOUTH, true);
|
| 899 | BlockState nswFence = nsFence.setValue(FenceBlock.WEST, true);
|
| 900 | BlockState nseFence = nsFence.setValue(FenceBlock.EAST, true);
|
| 901 |
|
| 902 | for (int i = 1; i <= 11; i += 2) {
|
| 903 | this.generateBox(level, chunkBB, i, 10, 0, i, 11, 0, weFence, weFence, false);
|
| 904 | this.generateBox(level, chunkBB, i, 10, 12, i, 11, 12, weFence, weFence, false);
|
| 905 | this.generateBox(level, chunkBB, 0, 10, i, 0, 11, i, nsFence, nsFence, false);
|
| 906 | this.generateBox(level, chunkBB, 12, 10, i, 12, 11, i, nsFence, nsFence, false);
|
| 907 | this.placeBlock(level, Blocks.NETHER_BRICKS.defaultBlockState(), i, 13, 0, chunkBB);
|
| 908 | this.placeBlock(level, Blocks.NETHER_BRICKS.defaultBlockState(), i, 13, 12, chunkBB);
|
| 909 | this.placeBlock(level, Blocks.NETHER_BRICKS.defaultBlockState(), 0, 13, i, chunkBB);
|
| 910 | this.placeBlock(level, Blocks.NETHER_BRICKS.defaultBlockState(), 12, 13, i, chunkBB);
|
| 911 | if (i != 11) {
|
| 912 | this.placeBlock(level, weFence, i + 1, 13, 0, chunkBB);
|
| 913 | this.placeBlock(level, weFence, i + 1, 13, 12, chunkBB);
|
| 914 | this.placeBlock(level, nsFence, 0, 13, i + 1, chunkBB);
|
| 915 | this.placeBlock(level, nsFence, 12, 13, i + 1, chunkBB);
|
| 916 | }
|
| 917 | }
|
| 918 |
|
| 919 | this.placeBlock(level, Blocks.NETHER_BRICK_FENCE.defaultBlockState().setValue(FenceBlock.NORTH, true).setValue(FenceBlock.EAST, true), 0, 13, 0, chunkBB);
|
| 920 | this.placeBlock(level, Blocks.NETHER_BRICK_FENCE.defaultBlockState().setValue(FenceBlock.SOUTH, true).setValue(FenceBlock.EAST, true), 0, 13, 12, chunkBB);
|
| 921 | this.placeBlock(level, Blocks.NETHER_BRICK_FENCE.defaultBlockState().setValue(FenceBlock.SOUTH, true).setValue(FenceBlock.WEST, true), 12, 13, 12, chunkBB);
|
| 922 | this.placeBlock(level, Blocks.NETHER_BRICK_FENCE.defaultBlockState().setValue(FenceBlock.NORTH, true).setValue(FenceBlock.WEST, true), 12, 13, 0, chunkBB);
|
| 923 |
|
| 924 | for (int z = 3; z <= 9; z += 2) {
|
| 925 | this.generateBox(level, chunkBB, 1, 7, z, 1, 8, z, nswFence, nswFence, false);
|
| 926 | this.generateBox(level, chunkBB, 11, 7, z, 11, 8, z, nseFence, nseFence, false);
|
| 927 | }
|
| 928 |
|
| 929 | BlockState stairs = Blocks.NETHER_BRICK_STAIRS.defaultBlockState().setValue(StairBlock.FACING, Direction.NORTH);
|
| 930 |
|
| 931 | for (int i = 0; i <= 6; i++) {
|
| 932 | int z = i + 4;
|
| 933 |
|
| 934 | for (int x = 5; x <= 7; x++) {
|
| 935 | this.placeBlock(level, stairs, x, 5 + i, z, chunkBB);
|
| 936 | }
|
| 937 |
|
| 938 | if (z >= 5 && z <= 8) {
|
| 939 | this.generateBox(level, chunkBB, 5, 5, z, 7, i + 4, z, Blocks.NETHER_BRICKS.defaultBlockState(), Blocks.NETHER_BRICKS.defaultBlockState(), false);
|
| 940 | } else if (z >= 9 && z <= 10) {
|
| 941 | this.generateBox(level, chunkBB, 5, 8, z, 7, i + 4, z, Blocks.NETHER_BRICKS.defaultBlockState(), Blocks.NETHER_BRICKS.defaultBlockState(), false);
|
| 942 | }
|
| 943 |
|
| 944 | if (i >= 1) {
|
| 945 | this.generateBox(level, chunkBB, 5, 6 + i, z, 7, 9 + i, z, Blocks.AIR.defaultBlockState(), Blocks.AIR.defaultBlockState(), false);
|
| 946 | }
|
| 947 | }
|
| 948 |
|
| 949 | for (int x = 5; x <= 7; x++) {
|
| 950 | this.placeBlock(level, stairs, x, 12, 11, chunkBB);
|
| 951 | }
|
| 952 |
|
| 953 | this.generateBox(level, chunkBB, 5, 6, 7, 5, 7, 7, nseFence, nseFence, false);
|
| 954 | this.generateBox(level, chunkBB, 7, 6, 7, 7, 7, 7, nswFence, nswFence, false);
|
| 955 | this.generateBox(level, chunkBB, 5, 13, 12, 7, 13, 12, Blocks.AIR.defaultBlockState(), Blocks.AIR.defaultBlockState(), false);
|
| 956 | this.generateBox(level, chunkBB, 2, 5, 2, 3, 5, 3, Blocks.NETHER_BRICKS.defaultBlockState(), Blocks.NETHER_BRICKS.defaultBlockState(), false);
|
| 957 | this.generateBox(level, chunkBB, 2, 5, 9, 3, 5, 10, Blocks.NETHER_BRICKS.defaultBlockState(), Blocks.NETHER_BRICKS.defaultBlockState(), false);
|
| 958 | this.generateBox(level, chunkBB, 2, 5, 4, 2, 5, 8, Blocks.NETHER_BRICKS.defaultBlockState(), Blocks.NETHER_BRICKS.defaultBlockState(), false);
|
| 959 | this.generateBox(level, chunkBB, 9, 5, 2, 10, 5, 3, Blocks.NETHER_BRICKS.defaultBlockState(), Blocks.NETHER_BRICKS.defaultBlockState(), false);
|
| 960 | this.generateBox(level, chunkBB, 9, 5, 9, 10, 5, 10, Blocks.NETHER_BRICKS.defaultBlockState(), Blocks.NETHER_BRICKS.defaultBlockState(), false);
|
| 961 | this.generateBox(level, chunkBB, 10, 5, 4, 10, 5, 8, Blocks.NETHER_BRICKS.defaultBlockState(), Blocks.NETHER_BRICKS.defaultBlockState(), false);
|
| 962 | BlockState eastStairs = stairs.setValue(StairBlock.FACING, Direction.EAST);
|
| 963 | BlockState westStairs = stairs.setValue(StairBlock.FACING, Direction.WEST);
|
| 964 | this.placeBlock(level, westStairs, 4, 5, 2, chunkBB);
|
| 965 | this.placeBlock(level, westStairs, 4, 5, 3, chunkBB);
|
| 966 | this.placeBlock(level, westStairs, 4, 5, 9, chunkBB);
|
| 967 | this.placeBlock(level, westStairs, 4, 5, 10, chunkBB);
|
| 968 | this.placeBlock(level, eastStairs, 8, 5, 2, chunkBB);
|
| 969 | this.placeBlock(level, eastStairs, 8, 5, 3, chunkBB);
|
| 970 | this.placeBlock(level, eastStairs, 8, 5, 9, chunkBB);
|
| 971 | this.placeBlock(level, eastStairs, 8, 5, 10, chunkBB);
|
| 972 | this.generateBox(level, chunkBB, 3, 4, 4, 4, 4, 8, Blocks.SOUL_SAND.defaultBlockState(), Blocks.SOUL_SAND.defaultBlockState(), false);
|
| 973 | this.generateBox(level, chunkBB, 8, 4, 4, 9, 4, 8, Blocks.SOUL_SAND.defaultBlockState(), Blocks.SOUL_SAND.defaultBlockState(), false);
|
| 974 | this.generateBox(level, chunkBB, 3, 5, 4, 4, 5, 8, Blocks.NETHER_WART.defaultBlockState(), Blocks.NETHER_WART.defaultBlockState(), false);
|
| 975 | this.generateBox(level, chunkBB, 8, 5, 4, 9, 5, 8, Blocks.NETHER_WART.defaultBlockState(), Blocks.NETHER_WART.defaultBlockState(), false);
|
| 976 | this.generateBox(level, chunkBB, 4, 2, 0, 8, 2, 12, Blocks.NETHER_BRICKS.defaultBlockState(), Blocks.NETHER_BRICKS.defaultBlockState(), false);
|
| 977 | this.generateBox(level, chunkBB, 0, 2, 4, 12, 2, 8, Blocks.NETHER_BRICKS.defaultBlockState(), Blocks.NETHER_BRICKS.defaultBlockState(), false);
|
| 978 | this.generateBox(level, chunkBB, 4, 0, 0, 8, 1, 3, Blocks.NETHER_BRICKS.defaultBlockState(), Blocks.NETHER_BRICKS.defaultBlockState(), false);
|
| 979 | this.generateBox(level, chunkBB, 4, 0, 9, 8, 1, 12, Blocks.NETHER_BRICKS.defaultBlockState(), Blocks.NETHER_BRICKS.defaultBlockState(), false);
|
| 980 | this.generateBox(level, chunkBB, 0, 0, 4, 3, 1, 8, Blocks.NETHER_BRICKS.defaultBlockState(), Blocks.NETHER_BRICKS.defaultBlockState(), false);
|
| 981 | this.generateBox(level, chunkBB, 9, 0, 4, 12, 1, 8, Blocks.NETHER_BRICKS.defaultBlockState(), Blocks.NETHER_BRICKS.defaultBlockState(), false);
|
| 982 |
|
| 983 | for (int x = 4; x <= 8; x++) {
|
| 984 | for (int z = 0; z <= 2; z++) {
|
| 985 | this.fillColumnDown(level, Blocks.NETHER_BRICKS.defaultBlockState(), x, -1, z, chunkBB);
|
| 986 | this.fillColumnDown(level, Blocks.NETHER_BRICKS.defaultBlockState(), x, -1, 12 - z, chunkBB);
|
| 987 | }
|
| 988 | }
|
| 989 |
|
| 990 | for (int x = 0; x <= 2; x++) {
|
| 991 | for (int z = 4; z <= 8; z++) {
|
| 992 | this.fillColumnDown(level, Blocks.NETHER_BRICKS.defaultBlockState(), x, -1, z, chunkBB);
|
| 993 | this.fillColumnDown(level, Blocks.NETHER_BRICKS.defaultBlockState(), 12 - x, -1, z, chunkBB);
|
| 994 | }
|
| 995 | }
|
| 996 | }
|
| 997 | }
|
| 998 |
|
| 999 | public static class MonsterThrone extends NetherFortressPieces.NetherBridgePiece {
|
| 1000 | private static final int WIDTH = 7;
|
| 1001 | private static final int HEIGHT = 8;
|
| 1002 | private static final int DEPTH = 9;
|
| 1003 | private boolean hasPlacedSpawner;
|
| 1004 |
|
| 1005 | public MonsterThrone(final int genDepth, final BoundingBox boundingBox, final Direction direction) {
|
| 1006 | super(StructurePieceType.NETHER_FORTRESS_MONSTER_THRONE, genDepth, boundingBox);
|
| 1007 | this.setOrientation(direction);
|
| 1008 | }
|
| 1009 |
|
| 1010 | public MonsterThrone(final CompoundTag tag) {
|
| 1011 | super(StructurePieceType.NETHER_FORTRESS_MONSTER_THRONE, tag);
|
| 1012 | this.hasPlacedSpawner = tag.getBooleanOr("Mob", false);
|
| 1013 | }
|
| 1014 |
|
| 1015 | @Override
|
| 1016 | protected void addAdditionalSaveData(final StructurePieceSerializationContext context, final CompoundTag tag) {
|
| 1017 | super.addAdditionalSaveData(context, tag);
|
| 1018 | tag.putBoolean("Mob", this.hasPlacedSpawner);
|
| 1019 | }
|
| 1020 |
|
| 1021 | public static NetherFortressPieces.@Nullable MonsterThrone createPiece(
|
| 1022 | final StructurePiecesBuilder builder, final int footX, final int footY, final int footZ, final int genDepth, final Direction direction
|
| 1023 | ) {
|
| 1024 | BoundingBox box = BoundingBox.orientBox(footX, footY, footZ, -2, 0, 0, 7, 8, 9, direction);
|
| 1025 | return isOkBox(box) && builder.findCollisionPiece(box) == null ? new NetherFortressPieces.MonsterThrone(genDepth, box, direction) : null;
|
| 1026 | }
|
| 1027 |
|
| 1028 | @Override
|
| 1029 | public void postProcess(
|
| 1030 | final WorldGenLevel level,
|
| 1031 | final StructureManager structureManager,
|
| 1032 | final ChunkGenerator generator,
|
| 1033 | final RandomSource random,
|
| 1034 | final BoundingBox chunkBB,
|
| 1035 | final ChunkPos chunkPos,
|
| 1036 | final BlockPos referencePos
|
| 1037 | ) {
|
| 1038 | this.generateBox(level, chunkBB, 0, 2, 0, 6, 7, 7, Blocks.AIR.defaultBlockState(), Blocks.AIR.defaultBlockState(), false);
|
| 1039 | this.generateBox(level, chunkBB, 1, 0, 0, 5, 1, 7, Blocks.NETHER_BRICKS.defaultBlockState(), Blocks.NETHER_BRICKS.defaultBlockState(), false);
|
| 1040 | this.generateBox(level, chunkBB, 1, 2, 1, 5, 2, 7, Blocks.NETHER_BRICKS.defaultBlockState(), Blocks.NETHER_BRICKS.defaultBlockState(), false);
|
| 1041 | this.generateBox(level, chunkBB, 1, 3, 2, 5, 3, 7, Blocks.NETHER_BRICKS.defaultBlockState(), Blocks.NETHER_BRICKS.defaultBlockState(), false);
|
| 1042 | this.generateBox(level, chunkBB, 1, 4, 3, 5, 4, 7, Blocks.NETHER_BRICKS.defaultBlockState(), Blocks.NETHER_BRICKS.defaultBlockState(), false);
|
| 1043 | this.generateBox(level, chunkBB, 1, 2, 0, 1, 4, 2, Blocks.NETHER_BRICKS.defaultBlockState(), Blocks.NETHER_BRICKS.defaultBlockState(), false);
|
| 1044 | this.generateBox(level, chunkBB, 5, 2, 0, 5, 4, 2, Blocks.NETHER_BRICKS.defaultBlockState(), Blocks.NETHER_BRICKS.defaultBlockState(), false);
|
| 1045 | this.generateBox(level, chunkBB, 1, 5, 2, 1, 5, 3, Blocks.NETHER_BRICKS.defaultBlockState(), Blocks.NETHER_BRICKS.defaultBlockState(), false);
|
| 1046 | this.generateBox(level, chunkBB, 5, 5, 2, 5, 5, 3, Blocks.NETHER_BRICKS.defaultBlockState(), Blocks.NETHER_BRICKS.defaultBlockState(), false);
|
| 1047 | this.generateBox(level, chunkBB, 0, 5, 3, 0, 5, 8, Blocks.NETHER_BRICKS.defaultBlockState(), Blocks.NETHER_BRICKS.defaultBlockState(), false);
|
| 1048 | this.generateBox(level, chunkBB, 6, 5, 3, 6, 5, 8, Blocks.NETHER_BRICKS.defaultBlockState(), Blocks.NETHER_BRICKS.defaultBlockState(), false);
|
| 1049 | this.generateBox(level, chunkBB, 1, 5, 8, 5, 5, 8, Blocks.NETHER_BRICKS.defaultBlockState(), Blocks.NETHER_BRICKS.defaultBlockState(), false);
|
| 1050 | BlockState weFence = Blocks.NETHER_BRICK_FENCE.defaultBlockState().setValue(FenceBlock.WEST, true).setValue(FenceBlock.EAST, true);
|
| 1051 | BlockState nsFence = Blocks.NETHER_BRICK_FENCE.defaultBlockState().setValue(FenceBlock.NORTH, true).setValue(FenceBlock.SOUTH, true);
|
| 1052 | this.placeBlock(level, Blocks.NETHER_BRICK_FENCE.defaultBlockState().setValue(FenceBlock.WEST, true), 1, 6, 3, chunkBB);
|
| 1053 | this.placeBlock(level, Blocks.NETHER_BRICK_FENCE.defaultBlockState().setValue(FenceBlock.EAST, true), 5, 6, 3, chunkBB);
|
| 1054 | this.placeBlock(level, Blocks.NETHER_BRICK_FENCE.defaultBlockState().setValue(FenceBlock.EAST, true).setValue(FenceBlock.NORTH, true), 0, 6, 3, chunkBB);
|
| 1055 | this.placeBlock(level, Blocks.NETHER_BRICK_FENCE.defaultBlockState().setValue(FenceBlock.WEST, true).setValue(FenceBlock.NORTH, true), 6, 6, 3, chunkBB);
|
| 1056 | this.generateBox(level, chunkBB, 0, 6, 4, 0, 6, 7, nsFence, nsFence, false);
|
| 1057 | this.generateBox(level, chunkBB, 6, 6, 4, 6, 6, 7, nsFence, nsFence, false);
|
| 1058 | this.placeBlock(level, Blocks.NETHER_BRICK_FENCE.defaultBlockState().setValue(FenceBlock.EAST, true).setValue(FenceBlock.SOUTH, true), 0, 6, 8, chunkBB);
|
| 1059 | this.placeBlock(level, Blocks.NETHER_BRICK_FENCE.defaultBlockState().setValue(FenceBlock.WEST, true).setValue(FenceBlock.SOUTH, true), 6, 6, 8, chunkBB);
|
| 1060 | this.generateBox(level, chunkBB, 1, 6, 8, 5, 6, 8, weFence, weFence, false);
|
| 1061 | this.placeBlock(level, Blocks.NETHER_BRICK_FENCE.defaultBlockState().setValue(FenceBlock.EAST, true), 1, 7, 8, chunkBB);
|
| 1062 | this.generateBox(level, chunkBB, 2, 7, 8, 4, 7, 8, weFence, weFence, false);
|
| 1063 | this.placeBlock(level, Blocks.NETHER_BRICK_FENCE.defaultBlockState().setValue(FenceBlock.WEST, true), 5, 7, 8, chunkBB);
|
| 1064 | this.placeBlock(level, Blocks.NETHER_BRICK_FENCE.defaultBlockState().setValue(FenceBlock.EAST, true), 2, 8, 8, chunkBB);
|
| 1065 | this.placeBlock(level, weFence, 3, 8, 8, chunkBB);
|
| 1066 | this.placeBlock(level, Blocks.NETHER_BRICK_FENCE.defaultBlockState().setValue(FenceBlock.WEST, true), 4, 8, 8, chunkBB);
|
| 1067 | if (!this.hasPlacedSpawner) {
|
| 1068 | BlockPos pos = this.getWorldPos(3, 5, 5);
|
| 1069 | if (chunkBB.isInside(pos)) {
|
| 1070 | this.hasPlacedSpawner = true;
|
| 1071 | level.setBlock(pos, Blocks.SPAWNER.defaultBlockState(), 2);
|
| 1072 | if (level.getBlockEntity(pos) instanceof SpawnerBlockEntity spawner) {
|
| 1073 | spawner.setEntityId(EntityTypes.BLAZE, random);
|
| 1074 | }
|
| 1075 | }
|
| 1076 | }
|
| 1077 |
|
| 1078 | for (int x = 0; x <= 6; x++) {
|
| 1079 | for (int z = 0; z <= 6; z++) {
|
| 1080 | this.fillColumnDown(level, Blocks.NETHER_BRICKS.defaultBlockState(), x, -1, z, chunkBB);
|
| 1081 | }
|
| 1082 | }
|
| 1083 | }
|
| 1084 | }
|
| 1085 |
|
| 1086 | private abstract static class NetherBridgePiece extends StructurePiece {
|
| 1087 | protected NetherBridgePiece(final StructurePieceType type, final int genDepth, final BoundingBox boundingBox) {
|
| 1088 | super(type, genDepth, boundingBox);
|
| 1089 | }
|
| 1090 |
|
| 1091 | public NetherBridgePiece(final StructurePieceType type, final CompoundTag tag) {
|
| 1092 | super(type, tag);
|
| 1093 | }
|
| 1094 |
|
| 1095 | @Override
|
| 1096 | protected void addAdditionalSaveData(final StructurePieceSerializationContext context, final CompoundTag tag) {
|
| 1097 | }
|
| 1098 |
|
| 1099 | private int updatePieceWeight(final List<NetherFortressPieces.PieceWeight> currentPieces) {
|
| 1100 | boolean hasAnyPieces = false;
|
| 1101 | int totalWeight = 0;
|
| 1102 |
|
| 1103 | for (NetherFortressPieces.PieceWeight piece : currentPieces) {
|
| 1104 | if (piece.maxPlaceCount > 0 && piece.placeCount < piece.maxPlaceCount) {
|
| 1105 | hasAnyPieces = true;
|
| 1106 | }
|
| 1107 |
|
| 1108 | totalWeight += piece.weight;
|
| 1109 | }
|
| 1110 |
|
| 1111 | return hasAnyPieces ? totalWeight : -1;
|
| 1112 | }
|
| 1113 |
|
| 1114 | private NetherFortressPieces.@Nullable NetherBridgePiece generatePiece(
|
| 1115 | final NetherFortressPieces.StartPiece startPiece,
|
| 1116 | final List<NetherFortressPieces.PieceWeight> currentPieces,
|
| 1117 | final StructurePiecesBuilder builder,
|
| 1118 | final RandomSource random,
|
| 1119 | final int footX,
|
| 1120 | final int footY,
|
| 1121 | final int footZ,
|
| 1122 | final Direction direction,
|
| 1123 | final int depth
|
| 1124 | ) {
|
| 1125 | int totalWeight = this.updatePieceWeight(currentPieces);
|
| 1126 | boolean doStuff = totalWeight > 0 && depth <= 30;
|
| 1127 | int numAttempts = 0;
|
| 1128 |
|
| 1129 | while (numAttempts < 5 && doStuff) {
|
| 1130 | numAttempts++;
|
| 1131 | int weightSelection = random.nextInt(totalWeight);
|
| 1132 |
|
| 1133 | for (NetherFortressPieces.PieceWeight piece : currentPieces) {
|
| 1134 | weightSelection -= piece.weight;
|
| 1135 | if (weightSelection < 0) {
|
| 1136 | if (!piece.doPlace(depth) || piece == startPiece.previousPiece && !piece.allowInRow) {
|
| 1137 | break;
|
| 1138 | }
|
| 1139 |
|
| 1140 | NetherFortressPieces.NetherBridgePiece structurePiece = NetherFortressPieces.findAndCreateBridgePieceFactory(
|
| 1141 | piece, builder, random, footX, footY, footZ, direction, depth
|
| 1142 | );
|
| 1143 | if (structurePiece != null) {
|
| 1144 | piece.placeCount++;
|
| 1145 | startPiece.previousPiece = piece;
|
| 1146 | if (!piece.isValid()) {
|
| 1147 | currentPieces.remove(piece);
|
| 1148 | }
|
| 1149 |
|
| 1150 | return structurePiece;
|
| 1151 | }
|
| 1152 | }
|
| 1153 | }
|
| 1154 | }
|
| 1155 |
|
| 1156 | return NetherFortressPieces.BridgeEndFiller.createPiece(builder, random, footX, footY, footZ, direction, depth);
|
| 1157 | }
|
| 1158 |
|
| 1159 | private @Nullable StructurePiece generateAndAddPiece(
|
| 1160 | final NetherFortressPieces.StartPiece startPiece,
|
| 1161 | final StructurePiecesBuilder builder,
|
| 1162 | final RandomSource random,
|
| 1163 | final int footX,
|
| 1164 | final int footY,
|
| 1165 | final int footZ,
|
| 1166 | final Direction direction,
|
| 1167 | final int depth,
|
| 1168 | final boolean isCastle
|
| 1169 | ) {
|
| 1170 | if (Math.abs(footX - startPiece.getBoundingBox().minX()) <= 112 && Math.abs(footZ - startPiece.getBoundingBox().minZ()) <= 112) {
|
| 1171 | List<NetherFortressPieces.PieceWeight> availablePieces = startPiece.availableBridgePieces;
|
| 1172 | if (isCastle) {
|
| 1173 | availablePieces = startPiece.availableCastlePieces;
|
| 1174 | }
|
| 1175 |
|
| 1176 | StructurePiece newPiece = this.generatePiece(startPiece, availablePieces, builder, random, footX, footY, footZ, direction, depth + 1);
|
| 1177 | if (newPiece != null) {
|
| 1178 | builder.addPiece(newPiece);
|
| 1179 | startPiece.pendingChildren.add(newPiece);
|
| 1180 | }
|
| 1181 |
|
| 1182 | return newPiece;
|
| 1183 | } else {
|
| 1184 | return NetherFortressPieces.BridgeEndFiller.createPiece(builder, random, footX, footY, footZ, direction, depth);
|
| 1185 | }
|
| 1186 | }
|
| 1187 |
|
| 1188 | protected @Nullable StructurePiece generateChildForward(
|
| 1189 | final NetherFortressPieces.StartPiece startPiece,
|
| 1190 | final StructurePiecesBuilder builder,
|
| 1191 | final RandomSource random,
|
| 1192 | final int xOff,
|
| 1193 | final int yOff,
|
| 1194 | final boolean isCastle
|
| 1195 | ) {
|
| 1196 | Direction orientation = this.getOrientation();
|
| 1197 | if (orientation != null) {
|
| 1198 | switch (orientation) {
|
| 1199 | case NORTH:
|
| 1200 | return this.generateAndAddPiece(
|
| 1201 | startPiece,
|
| 1202 | builder,
|
| 1203 | random,
|
| 1204 | this.boundingBox.minX() + xOff,
|
| 1205 | this.boundingBox.minY() + yOff,
|
| 1206 | this.boundingBox.minZ() - 1,
|
| 1207 | orientation,
|
| 1208 | this.getGenDepth(),
|
| 1209 | isCastle
|
| 1210 | );
|
| 1211 | case SOUTH:
|
| 1212 | return this.generateAndAddPiece(
|
| 1213 | startPiece,
|
| 1214 | builder,
|
| 1215 | random,
|
| 1216 | this.boundingBox.minX() + xOff,
|
| 1217 | this.boundingBox.minY() + yOff,
|
| 1218 | this.boundingBox.maxZ() + 1,
|
| 1219 | orientation,
|
| 1220 | this.getGenDepth(),
|
| 1221 | isCastle
|
| 1222 | );
|
| 1223 | case WEST:
|
| 1224 | return this.generateAndAddPiece(
|
| 1225 | startPiece,
|
| 1226 | builder,
|
| 1227 | random,
|
| 1228 | this.boundingBox.minX() - 1,
|
| 1229 | this.boundingBox.minY() + yOff,
|
| 1230 | this.boundingBox.minZ() + xOff,
|
| 1231 | orientation,
|
| 1232 | this.getGenDepth(),
|
| 1233 | isCastle
|
| 1234 | );
|
| 1235 | case EAST:
|
| 1236 | return this.generateAndAddPiece(
|
| 1237 | startPiece,
|
| 1238 | builder,
|
| 1239 | random,
|
| 1240 | this.boundingBox.maxX() + 1,
|
| 1241 | this.boundingBox.minY() + yOff,
|
| 1242 | this.boundingBox.minZ() + xOff,
|
| 1243 | orientation,
|
| 1244 | this.getGenDepth(),
|
| 1245 | isCastle
|
| 1246 | );
|
| 1247 | }
|
| 1248 | }
|
| 1249 |
|
| 1250 | return null;
|
| 1251 | }
|
| 1252 |
|
| 1253 | protected @Nullable StructurePiece generateChildLeft(
|
| 1254 | final NetherFortressPieces.StartPiece startPiece,
|
| 1255 | final StructurePiecesBuilder builder,
|
| 1256 | final RandomSource random,
|
| 1257 | final int yOff,
|
| 1258 | final int zOff,
|
| 1259 | final boolean isCastle
|
| 1260 | ) {
|
| 1261 | Direction orientation = this.getOrientation();
|
| 1262 | if (orientation != null) {
|
| 1263 | switch (orientation) {
|
| 1264 | case NORTH:
|
| 1265 | return this.generateAndAddPiece(
|
| 1266 | startPiece,
|
| 1267 | builder,
|
| 1268 | random,
|
| 1269 | this.boundingBox.minX() - 1,
|
| 1270 | this.boundingBox.minY() + yOff,
|
| 1271 | this.boundingBox.minZ() + zOff,
|
| 1272 | Direction.WEST,
|
| 1273 | this.getGenDepth(),
|
| 1274 | isCastle
|
| 1275 | );
|
| 1276 | case SOUTH:
|
| 1277 | return this.generateAndAddPiece(
|
| 1278 | startPiece,
|
| 1279 | builder,
|
| 1280 | random,
|
| 1281 | this.boundingBox.minX() - 1,
|
| 1282 | this.boundingBox.minY() + yOff,
|
| 1283 | this.boundingBox.minZ() + zOff,
|
| 1284 | Direction.WEST,
|
| 1285 | this.getGenDepth(),
|
| 1286 | isCastle
|
| 1287 | );
|
| 1288 | case WEST:
|
| 1289 | return this.generateAndAddPiece(
|
| 1290 | startPiece,
|
| 1291 | builder,
|
| 1292 | random,
|
| 1293 | this.boundingBox.minX() + zOff,
|
| 1294 | this.boundingBox.minY() + yOff,
|
| 1295 | this.boundingBox.minZ() - 1,
|
| 1296 | Direction.NORTH,
|
| 1297 | this.getGenDepth(),
|
| 1298 | isCastle
|
| 1299 | );
|
| 1300 | case EAST:
|
| 1301 | return this.generateAndAddPiece(
|
| 1302 | startPiece,
|
| 1303 | builder,
|
| 1304 | random,
|
| 1305 | this.boundingBox.minX() + zOff,
|
| 1306 | this.boundingBox.minY() + yOff,
|
| 1307 | this.boundingBox.minZ() - 1,
|
| 1308 | Direction.NORTH,
|
| 1309 | this.getGenDepth(),
|
| 1310 | isCastle
|
| 1311 | );
|
| 1312 | }
|
| 1313 | }
|
| 1314 |
|
| 1315 | return null;
|
| 1316 | }
|
| 1317 |
|
| 1318 | protected @Nullable StructurePiece generateChildRight(
|
| 1319 | final NetherFortressPieces.StartPiece startPiece,
|
| 1320 | final StructurePiecesBuilder builder,
|
| 1321 | final RandomSource random,
|
| 1322 | final int yOff,
|
| 1323 | final int zOff,
|
| 1324 | final boolean isCastle
|
| 1325 | ) {
|
| 1326 | Direction orientation = this.getOrientation();
|
| 1327 | if (orientation != null) {
|
| 1328 | switch (orientation) {
|
| 1329 | case NORTH:
|
| 1330 | return this.generateAndAddPiece(
|
| 1331 | startPiece,
|
| 1332 | builder,
|
| 1333 | random,
|
| 1334 | this.boundingBox.maxX() + 1,
|
| 1335 | this.boundingBox.minY() + yOff,
|
| 1336 | this.boundingBox.minZ() + zOff,
|
| 1337 | Direction.EAST,
|
| 1338 | this.getGenDepth(),
|
| 1339 | isCastle
|
| 1340 | );
|
| 1341 | case SOUTH:
|
| 1342 | return this.generateAndAddPiece(
|
| 1343 | startPiece,
|
| 1344 | builder,
|
| 1345 | random,
|
| 1346 | this.boundingBox.maxX() + 1,
|
| 1347 | this.boundingBox.minY() + yOff,
|
| 1348 | this.boundingBox.minZ() + zOff,
|
| 1349 | Direction.EAST,
|
| 1350 | this.getGenDepth(),
|
| 1351 | isCastle
|
| 1352 | );
|
| 1353 | case WEST:
|
| 1354 | return this.generateAndAddPiece(
|
| 1355 | startPiece,
|
| 1356 | builder,
|
| 1357 | random,
|
| 1358 | this.boundingBox.minX() + zOff,
|
| 1359 | this.boundingBox.minY() + yOff,
|
| 1360 | this.boundingBox.maxZ() + 1,
|
| 1361 | Direction.SOUTH,
|
| 1362 | this.getGenDepth(),
|
| 1363 | isCastle
|
| 1364 | );
|
| 1365 | case EAST:
|
| 1366 | return this.generateAndAddPiece(
|
| 1367 | startPiece,
|
| 1368 | builder,
|
| 1369 | random,
|
| 1370 | this.boundingBox.minX() + zOff,
|
| 1371 | this.boundingBox.minY() + yOff,
|
| 1372 | this.boundingBox.maxZ() + 1,
|
| 1373 | Direction.SOUTH,
|
| 1374 | this.getGenDepth(),
|
| 1375 | isCastle
|
| 1376 | );
|
| 1377 | }
|
| 1378 | }
|
| 1379 |
|
| 1380 | return null;
|
| 1381 | }
|
| 1382 |
|
| 1383 | protected static boolean isOkBox(final BoundingBox box) {
|
| 1384 | return box.minY() > 10;
|
| 1385 | }
|
| 1386 | }
|
| 1387 |
|
| 1388 | private static class PieceWeight {
|
| 1389 | public final Class<? extends NetherFortressPieces.NetherBridgePiece> pieceClass;
|
| 1390 | public final int weight;
|
| 1391 | public int placeCount;
|
| 1392 | public final int maxPlaceCount;
|
| 1393 | public final boolean allowInRow;
|
| 1394 |
|
| 1395 | public PieceWeight(
|
| 1396 | final Class<? extends NetherFortressPieces.NetherBridgePiece> pieceClass, final int weight, final int maxPlaceCount, final boolean allowInRow
|
| 1397 | ) {
|
| 1398 | this.pieceClass = pieceClass;
|
| 1399 | this.weight = weight;
|
| 1400 | this.maxPlaceCount = maxPlaceCount;
|
| 1401 | this.allowInRow = allowInRow;
|
| 1402 | }
|
| 1403 |
|
| 1404 | public PieceWeight(final Class<? extends NetherFortressPieces.NetherBridgePiece> pieceClass, final int weight, final int maxPlaceCount) {
|
| 1405 | this(pieceClass, weight, maxPlaceCount, false);
|
| 1406 | }
|
| 1407 |
|
| 1408 | public boolean doPlace(final int depth) {
|
| 1409 | return this.maxPlaceCount == 0 || this.placeCount < this.maxPlaceCount;
|
| 1410 | }
|
| 1411 |
|
| 1412 | public boolean isValid() {
|
| 1413 | return this.maxPlaceCount == 0 || this.placeCount < this.maxPlaceCount;
|
| 1414 | }
|
| 1415 | }
|
| 1416 |
|
| 1417 | public static class RoomCrossing extends NetherFortressPieces.NetherBridgePiece {
|
| 1418 | private static final int WIDTH = 7;
|
| 1419 | private static final int HEIGHT = 9;
|
| 1420 | private static final int DEPTH = 7;
|
| 1421 |
|
| 1422 | public RoomCrossing(final int genDepth, final BoundingBox boundingBox, final Direction direction) {
|
| 1423 | super(StructurePieceType.NETHER_FORTRESS_ROOM_CROSSING, genDepth, boundingBox);
|
| 1424 | this.setOrientation(direction);
|
| 1425 | }
|
| 1426 |
|
| 1427 | public RoomCrossing(final CompoundTag tag) {
|
| 1428 | super(StructurePieceType.NETHER_FORTRESS_ROOM_CROSSING, tag);
|
| 1429 | }
|
| 1430 |
|
| 1431 | @Override
|
| 1432 | public void addChildren(final StructurePiece startPiece, final StructurePiecesBuilder builder, final RandomSource random) {
|
| 1433 | this.generateChildForward((NetherFortressPieces.StartPiece)startPiece, builder, random, 2, 0, false);
|
| 1434 | this.generateChildLeft((NetherFortressPieces.StartPiece)startPiece, builder, random, 0, 2, false);
|
| 1435 | this.generateChildRight((NetherFortressPieces.StartPiece)startPiece, builder, random, 0, 2, false);
|
| 1436 | }
|
| 1437 |
|
| 1438 | public static NetherFortressPieces.@Nullable RoomCrossing createPiece(
|
| 1439 | final StructurePiecesBuilder builder, final int footX, final int footY, final int footZ, final Direction direction, final int genDepth
|
| 1440 | ) {
|
| 1441 | BoundingBox box = BoundingBox.orientBox(footX, footY, footZ, -2, 0, 0, 7, 9, 7, direction);
|
| 1442 | return isOkBox(box) && builder.findCollisionPiece(box) == null ? new NetherFortressPieces.RoomCrossing(genDepth, box, direction) : null;
|
| 1443 | }
|
| 1444 |
|
| 1445 | @Override
|
| 1446 | public void postProcess(
|
| 1447 | final WorldGenLevel level,
|
| 1448 | final StructureManager structureManager,
|
| 1449 | final ChunkGenerator generator,
|
| 1450 | final RandomSource random,
|
| 1451 | final BoundingBox chunkBB,
|
| 1452 | final ChunkPos chunkPos,
|
| 1453 | final BlockPos referencePos
|
| 1454 | ) {
|
| 1455 | this.generateBox(level, chunkBB, 0, 0, 0, 6, 1, 6, Blocks.NETHER_BRICKS.defaultBlockState(), Blocks.NETHER_BRICKS.defaultBlockState(), false);
|
| 1456 | this.generateBox(level, chunkBB, 0, 2, 0, 6, 7, 6, Blocks.AIR.defaultBlockState(), Blocks.AIR.defaultBlockState(), false);
|
| 1457 | this.generateBox(level, chunkBB, 0, 2, 0, 1, 6, 0, Blocks.NETHER_BRICKS.defaultBlockState(), Blocks.NETHER_BRICKS.defaultBlockState(), false);
|
| 1458 | this.generateBox(level, chunkBB, 0, 2, 6, 1, 6, 6, Blocks.NETHER_BRICKS.defaultBlockState(), Blocks.NETHER_BRICKS.defaultBlockState(), false);
|
| 1459 | this.generateBox(level, chunkBB, 5, 2, 0, 6, 6, 0, Blocks.NETHER_BRICKS.defaultBlockState(), Blocks.NETHER_BRICKS.defaultBlockState(), false);
|
| 1460 | this.generateBox(level, chunkBB, 5, 2, 6, 6, 6, 6, Blocks.NETHER_BRICKS.defaultBlockState(), Blocks.NETHER_BRICKS.defaultBlockState(), false);
|
| 1461 | this.generateBox(level, chunkBB, 0, 2, 0, 0, 6, 1, Blocks.NETHER_BRICKS.defaultBlockState(), Blocks.NETHER_BRICKS.defaultBlockState(), false);
|
| 1462 | this.generateBox(level, chunkBB, 0, 2, 5, 0, 6, 6, Blocks.NETHER_BRICKS.defaultBlockState(), Blocks.NETHER_BRICKS.defaultBlockState(), false);
|
| 1463 | this.generateBox(level, chunkBB, 6, 2, 0, 6, 6, 1, Blocks.NETHER_BRICKS.defaultBlockState(), Blocks.NETHER_BRICKS.defaultBlockState(), false);
|
| 1464 | this.generateBox(level, chunkBB, 6, 2, 5, 6, 6, 6, Blocks.NETHER_BRICKS.defaultBlockState(), Blocks.NETHER_BRICKS.defaultBlockState(), false);
|
| 1465 | BlockState weFence = Blocks.NETHER_BRICK_FENCE.defaultBlockState().setValue(FenceBlock.WEST, true).setValue(FenceBlock.EAST, true);
|
| 1466 | BlockState nsFence = Blocks.NETHER_BRICK_FENCE.defaultBlockState().setValue(FenceBlock.NORTH, true).setValue(FenceBlock.SOUTH, true);
|
| 1467 | this.generateBox(level, chunkBB, 2, 6, 0, 4, 6, 0, Blocks.NETHER_BRICKS.defaultBlockState(), Blocks.NETHER_BRICKS.defaultBlockState(), false);
|
| 1468 | this.generateBox(level, chunkBB, 2, 5, 0, 4, 5, 0, weFence, weFence, false);
|
| 1469 | this.generateBox(level, chunkBB, 2, 6, 6, 4, 6, 6, Blocks.NETHER_BRICKS.defaultBlockState(), Blocks.NETHER_BRICKS.defaultBlockState(), false);
|
| 1470 | this.generateBox(level, chunkBB, 2, 5, 6, 4, 5, 6, weFence, weFence, false);
|
| 1471 | this.generateBox(level, chunkBB, 0, 6, 2, 0, 6, 4, Blocks.NETHER_BRICKS.defaultBlockState(), Blocks.NETHER_BRICKS.defaultBlockState(), false);
|
| 1472 | this.generateBox(level, chunkBB, 0, 5, 2, 0, 5, 4, nsFence, nsFence, false);
|
| 1473 | this.generateBox(level, chunkBB, 6, 6, 2, 6, 6, 4, Blocks.NETHER_BRICKS.defaultBlockState(), Blocks.NETHER_BRICKS.defaultBlockState(), false);
|
| 1474 | this.generateBox(level, chunkBB, 6, 5, 2, 6, 5, 4, nsFence, nsFence, false);
|
| 1475 |
|
| 1476 | for (int x = 0; x <= 6; x++) {
|
| 1477 | for (int z = 0; z <= 6; z++) {
|
| 1478 | this.fillColumnDown(level, Blocks.NETHER_BRICKS.defaultBlockState(), x, -1, z, chunkBB);
|
| 1479 | }
|
| 1480 | }
|
| 1481 | }
|
| 1482 | }
|
| 1483 |
|
| 1484 | public static class StairsRoom extends NetherFortressPieces.NetherBridgePiece {
|
| 1485 | private static final int WIDTH = 7;
|
| 1486 | private static final int HEIGHT = 11;
|
| 1487 | private static final int DEPTH = 7;
|
| 1488 |
|
| 1489 | public StairsRoom(final int genDepth, final BoundingBox boundingBox, final Direction direction) {
|
| 1490 | super(StructurePieceType.NETHER_FORTRESS_STAIRS_ROOM, genDepth, boundingBox);
|
| 1491 | this.setOrientation(direction);
|
| 1492 | }
|
| 1493 |
|
| 1494 | public StairsRoom(final CompoundTag tag) {
|
| 1495 | super(StructurePieceType.NETHER_FORTRESS_STAIRS_ROOM, tag);
|
| 1496 | }
|
| 1497 |
|
| 1498 | @Override
|
| 1499 | public void addChildren(final StructurePiece startPiece, final StructurePiecesBuilder builder, final RandomSource random) {
|
| 1500 | this.generateChildRight((NetherFortressPieces.StartPiece)startPiece, builder, random, 6, 2, false);
|
| 1501 | }
|
| 1502 |
|
| 1503 | public static NetherFortressPieces.@Nullable StairsRoom createPiece(
|
| 1504 | final StructurePiecesBuilder builder, final int footX, final int footY, final int footZ, final int genDepth, final Direction direction
|
| 1505 | ) {
|
| 1506 | BoundingBox box = BoundingBox.orientBox(footX, footY, footZ, -2, 0, 0, 7, 11, 7, direction);
|
| 1507 | return isOkBox(box) && builder.findCollisionPiece(box) == null ? new NetherFortressPieces.StairsRoom(genDepth, box, direction) : null;
|
| 1508 | }
|
| 1509 |
|
| 1510 | @Override
|
| 1511 | public void postProcess(
|
| 1512 | final WorldGenLevel level,
|
| 1513 | final StructureManager structureManager,
|
| 1514 | final ChunkGenerator generator,
|
| 1515 | final RandomSource random,
|
| 1516 | final BoundingBox chunkBB,
|
| 1517 | final ChunkPos chunkPos,
|
| 1518 | final BlockPos referencePos
|
| 1519 | ) {
|
| 1520 | this.generateBox(level, chunkBB, 0, 0, 0, 6, 1, 6, Blocks.NETHER_BRICKS.defaultBlockState(), Blocks.NETHER_BRICKS.defaultBlockState(), false);
|
| 1521 | this.generateBox(level, chunkBB, 0, 2, 0, 6, 10, 6, Blocks.AIR.defaultBlockState(), Blocks.AIR.defaultBlockState(), false);
|
| 1522 | this.generateBox(level, chunkBB, 0, 2, 0, 1, 8, 0, Blocks.NETHER_BRICKS.defaultBlockState(), Blocks.NETHER_BRICKS.defaultBlockState(), false);
|
| 1523 | this.generateBox(level, chunkBB, 5, 2, 0, 6, 8, 0, Blocks.NETHER_BRICKS.defaultBlockState(), Blocks.NETHER_BRICKS.defaultBlockState(), false);
|
| 1524 | this.generateBox(level, chunkBB, 0, 2, 1, 0, 8, 6, Blocks.NETHER_BRICKS.defaultBlockState(), Blocks.NETHER_BRICKS.defaultBlockState(), false);
|
| 1525 | this.generateBox(level, chunkBB, 6, 2, 1, 6, 8, 6, Blocks.NETHER_BRICKS.defaultBlockState(), Blocks.NETHER_BRICKS.defaultBlockState(), false);
|
| 1526 | this.generateBox(level, chunkBB, 1, 2, 6, 5, 8, 6, Blocks.NETHER_BRICKS.defaultBlockState(), Blocks.NETHER_BRICKS.defaultBlockState(), false);
|
| 1527 | BlockState weFence = Blocks.NETHER_BRICK_FENCE.defaultBlockState().setValue(FenceBlock.WEST, true).setValue(FenceBlock.EAST, true);
|
| 1528 | BlockState nsFence = Blocks.NETHER_BRICK_FENCE.defaultBlockState().setValue(FenceBlock.NORTH, true).setValue(FenceBlock.SOUTH, true);
|
| 1529 | this.generateBox(level, chunkBB, 0, 3, 2, 0, 5, 4, nsFence, nsFence, false);
|
| 1530 | this.generateBox(level, chunkBB, 6, 3, 2, 6, 5, 2, nsFence, nsFence, false);
|
| 1531 | this.generateBox(level, chunkBB, 6, 3, 4, 6, 5, 4, nsFence, nsFence, false);
|
| 1532 | this.placeBlock(level, Blocks.NETHER_BRICKS.defaultBlockState(), 5, 2, 5, chunkBB);
|
| 1533 | this.generateBox(level, chunkBB, 4, 2, 5, 4, 3, 5, Blocks.NETHER_BRICKS.defaultBlockState(), Blocks.NETHER_BRICKS.defaultBlockState(), false);
|
| 1534 | this.generateBox(level, chunkBB, 3, 2, 5, 3, 4, 5, Blocks.NETHER_BRICKS.defaultBlockState(), Blocks.NETHER_BRICKS.defaultBlockState(), false);
|
| 1535 | this.generateBox(level, chunkBB, 2, 2, 5, 2, 5, 5, Blocks.NETHER_BRICKS.defaultBlockState(), Blocks.NETHER_BRICKS.defaultBlockState(), false);
|
| 1536 | this.generateBox(level, chunkBB, 1, 2, 5, 1, 6, 5, Blocks.NETHER_BRICKS.defaultBlockState(), Blocks.NETHER_BRICKS.defaultBlockState(), false);
|
| 1537 | this.generateBox(level, chunkBB, 1, 7, 1, 5, 7, 4, Blocks.NETHER_BRICKS.defaultBlockState(), Blocks.NETHER_BRICKS.defaultBlockState(), false);
|
| 1538 | this.generateBox(level, chunkBB, 6, 8, 2, 6, 8, 4, Blocks.AIR.defaultBlockState(), Blocks.AIR.defaultBlockState(), false);
|
| 1539 | this.generateBox(level, chunkBB, 2, 6, 0, 4, 8, 0, Blocks.NETHER_BRICKS.defaultBlockState(), Blocks.NETHER_BRICKS.defaultBlockState(), false);
|
| 1540 | this.generateBox(level, chunkBB, 2, 5, 0, 4, 5, 0, weFence, weFence, false);
|
| 1541 |
|
| 1542 | for (int x = 0; x <= 6; x++) {
|
| 1543 | for (int z = 0; z <= 6; z++) {
|
| 1544 | this.fillColumnDown(level, Blocks.NETHER_BRICKS.defaultBlockState(), x, -1, z, chunkBB);
|
| 1545 | }
|
| 1546 | }
|
| 1547 | }
|
| 1548 | }
|
| 1549 |
|
| 1550 | public static class StartPiece extends NetherFortressPieces.BridgeCrossing {
|
| 1551 | private NetherFortressPieces.@Nullable PieceWeight previousPiece;
|
| 1552 | private final List<NetherFortressPieces.PieceWeight> availableBridgePieces = new ArrayList<>();
|
| 1553 | private final List<NetherFortressPieces.PieceWeight> availableCastlePieces = new ArrayList<>();
|
| 1554 | public final List<StructurePiece> pendingChildren = Lists.newArrayList();
|
| 1555 |
|
| 1556 | public StartPiece(final RandomSource random, final int west, final int north) {
|
| 1557 | super(west, north, getRandomHorizontalDirection(random));
|
| 1558 |
|
| 1559 | for (NetherFortressPieces.PieceWeight piece : NetherFortressPieces.BRIDGE_PIECE_WEIGHTS) {
|
| 1560 | piece.placeCount = 0;
|
| 1561 | this.availableBridgePieces.add(piece);
|
| 1562 | }
|
| 1563 |
|
| 1564 | for (NetherFortressPieces.PieceWeight piece : NetherFortressPieces.CASTLE_PIECE_WEIGHTS) {
|
| 1565 | piece.placeCount = 0;
|
| 1566 | this.availableCastlePieces.add(piece);
|
| 1567 | }
|
| 1568 | }
|
| 1569 |
|
| 1570 | public StartPiece(final CompoundTag tag) {
|
| 1571 | super(StructurePieceType.NETHER_FORTRESS_START, tag);
|
| 1572 | }
|
| 1573 | }
|
| 1574 | }
|
| 1575 |
|