| 1 | package net.minecraft.world.level.levelgen.structure.structures;
|
| 2 |
|
| 3 | import java.util.ArrayList;
|
| 4 | import java.util.List;
|
| 5 | import net.minecraft.core.BlockPos;
|
| 6 | import net.minecraft.core.Direction;
|
| 7 | import net.minecraft.nbt.CompoundTag;
|
| 8 | import net.minecraft.util.RandomSource;
|
| 9 | import net.minecraft.world.level.ChunkPos;
|
| 10 | import net.minecraft.world.level.StructureManager;
|
| 11 | import net.minecraft.world.level.WorldGenLevel;
|
| 12 | import net.minecraft.world.level.block.Blocks;
|
| 13 | import net.minecraft.world.level.block.Rotation;
|
| 14 | import net.minecraft.world.level.block.StairBlock;
|
| 15 | import net.minecraft.world.level.block.state.BlockState;
|
| 16 | import net.minecraft.world.level.chunk.ChunkGenerator;
|
| 17 | import net.minecraft.world.level.levelgen.structure.BoundingBox;
|
| 18 | import net.minecraft.world.level.levelgen.structure.ScatteredFeaturePiece;
|
| 19 | import net.minecraft.world.level.levelgen.structure.pieces.StructurePieceSerializationContext;
|
| 20 | import net.minecraft.world.level.levelgen.structure.pieces.StructurePieceType;
|
| 21 | import net.minecraft.world.level.storage.loot.BuiltInLootTables;
|
| 22 |
|
| 23 | public class DesertPyramidPiece extends ScatteredFeaturePiece {
|
| 24 | public static final int WIDTH = 21;
|
| 25 | public static final int DEPTH = 21;
|
| 26 | private final boolean[] hasPlacedChest = new boolean[4];
|
| 27 | private final List<BlockPos> potentialSuspiciousSandWorldPositions = new ArrayList<>();
|
| 28 | private BlockPos randomCollapsedRoofPos = BlockPos.ZERO;
|
| 29 |
|
| 30 | public DesertPyramidPiece(final RandomSource random, final int west, final int north) {
|
| 31 | super(StructurePieceType.DESERT_PYRAMID_PIECE, west, 64, north, 21, 15, 21, getRandomHorizontalDirection(random));
|
| 32 | }
|
| 33 |
|
| 34 | public DesertPyramidPiece(final CompoundTag tag) {
|
| 35 | super(StructurePieceType.DESERT_PYRAMID_PIECE, tag);
|
| 36 | this.hasPlacedChest[0] = tag.getBooleanOr("hasPlacedChest0", false);
|
| 37 | this.hasPlacedChest[1] = tag.getBooleanOr("hasPlacedChest1", false);
|
| 38 | this.hasPlacedChest[2] = tag.getBooleanOr("hasPlacedChest2", false);
|
| 39 | this.hasPlacedChest[3] = tag.getBooleanOr("hasPlacedChest3", false);
|
| 40 | }
|
| 41 |
|
| 42 | @Override
|
| 43 | protected void addAdditionalSaveData(final StructurePieceSerializationContext context, final CompoundTag tag) {
|
| 44 | super.addAdditionalSaveData(context, tag);
|
| 45 | tag.putBoolean("hasPlacedChest0", this.hasPlacedChest[0]);
|
| 46 | tag.putBoolean("hasPlacedChest1", this.hasPlacedChest[1]);
|
| 47 | tag.putBoolean("hasPlacedChest2", this.hasPlacedChest[2]);
|
| 48 | tag.putBoolean("hasPlacedChest3", this.hasPlacedChest[3]);
|
| 49 | }
|
| 50 |
|
| 51 | @Override
|
| 52 | public void postProcess(
|
| 53 | final WorldGenLevel level,
|
| 54 | final StructureManager structureManager,
|
| 55 | final ChunkGenerator generator,
|
| 56 | final RandomSource random,
|
| 57 | final BoundingBox chunkBB,
|
| 58 | final ChunkPos chunkPos,
|
| 59 | final BlockPos referencePos
|
| 60 | ) {
|
| 61 | if (this.updateHeightPositionToLowestGroundHeight(level, -random.nextInt(3))) {
|
| 62 | this.generateBox(
|
| 63 | level, chunkBB, 0, -4, 0, this.width - 1, 0, this.depth - 1, Blocks.SANDSTONE.defaultBlockState(), Blocks.SANDSTONE.defaultBlockState(), false
|
| 64 | );
|
| 65 |
|
| 66 | for (int pos = 1; pos <= 9; pos++) {
|
| 67 | this.generateBox(
|
| 68 | level,
|
| 69 | chunkBB,
|
| 70 | pos,
|
| 71 | pos,
|
| 72 | pos,
|
| 73 | this.width - 1 - pos,
|
| 74 | pos,
|
| 75 | this.depth - 1 - pos,
|
| 76 | Blocks.SANDSTONE.defaultBlockState(),
|
| 77 | Blocks.SANDSTONE.defaultBlockState(),
|
| 78 | false
|
| 79 | );
|
| 80 | this.generateBox(
|
| 81 | level,
|
| 82 | chunkBB,
|
| 83 | pos + 1,
|
| 84 | pos,
|
| 85 | pos + 1,
|
| 86 | this.width - 2 - pos,
|
| 87 | pos,
|
| 88 | this.depth - 2 - pos,
|
| 89 | Blocks.AIR.defaultBlockState(),
|
| 90 | Blocks.AIR.defaultBlockState(),
|
| 91 | false
|
| 92 | );
|
| 93 | }
|
| 94 |
|
| 95 | for (int x = 0; x < this.width; x++) {
|
| 96 | for (int z = 0; z < this.depth; z++) {
|
| 97 | int startY = -5;
|
| 98 | this.fillColumnDown(level, Blocks.SANDSTONE.defaultBlockState(), x, -5, z, chunkBB);
|
| 99 | }
|
| 100 | }
|
| 101 |
|
| 102 | BlockState northStairs = Blocks.SANDSTONE_STAIRS.defaultBlockState().setValue(StairBlock.FACING, Direction.NORTH);
|
| 103 | BlockState southStairs = Blocks.SANDSTONE_STAIRS.defaultBlockState().setValue(StairBlock.FACING, Direction.SOUTH);
|
| 104 | BlockState eastStairs = Blocks.SANDSTONE_STAIRS.defaultBlockState().setValue(StairBlock.FACING, Direction.EAST);
|
| 105 | BlockState westStairs = Blocks.SANDSTONE_STAIRS.defaultBlockState().setValue(StairBlock.FACING, Direction.WEST);
|
| 106 | this.generateBox(level, chunkBB, 0, 0, 0, 4, 9, 4, Blocks.SANDSTONE.defaultBlockState(), Blocks.AIR.defaultBlockState(), false);
|
| 107 | this.generateBox(level, chunkBB, 1, 10, 1, 3, 10, 3, Blocks.SANDSTONE.defaultBlockState(), Blocks.SANDSTONE.defaultBlockState(), false);
|
| 108 | this.placeBlock(level, northStairs, 2, 10, 0, chunkBB);
|
| 109 | this.placeBlock(level, southStairs, 2, 10, 4, chunkBB);
|
| 110 | this.placeBlock(level, eastStairs, 0, 10, 2, chunkBB);
|
| 111 | this.placeBlock(level, westStairs, 4, 10, 2, chunkBB);
|
| 112 | this.generateBox(level, chunkBB, this.width - 5, 0, 0, this.width - 1, 9, 4, Blocks.SANDSTONE.defaultBlockState(), Blocks.AIR.defaultBlockState(), false);
|
| 113 | this.generateBox(
|
| 114 | level, chunkBB, this.width - 4, 10, 1, this.width - 2, 10, 3, Blocks.SANDSTONE.defaultBlockState(), Blocks.SANDSTONE.defaultBlockState(), false
|
| 115 | );
|
| 116 | this.placeBlock(level, northStairs, this.width - 3, 10, 0, chunkBB);
|
| 117 | this.placeBlock(level, southStairs, this.width - 3, 10, 4, chunkBB);
|
| 118 | this.placeBlock(level, eastStairs, this.width - 5, 10, 2, chunkBB);
|
| 119 | this.placeBlock(level, westStairs, this.width - 1, 10, 2, chunkBB);
|
| 120 | this.generateBox(level, chunkBB, 8, 0, 0, 12, 4, 4, Blocks.SANDSTONE.defaultBlockState(), Blocks.AIR.defaultBlockState(), false);
|
| 121 | this.generateBox(level, chunkBB, 9, 1, 0, 11, 3, 4, Blocks.AIR.defaultBlockState(), Blocks.AIR.defaultBlockState(), false);
|
| 122 | this.placeBlock(level, Blocks.CUT_SANDSTONE.defaultBlockState(), 9, 1, 1, chunkBB);
|
| 123 | this.placeBlock(level, Blocks.CUT_SANDSTONE.defaultBlockState(), 9, 2, 1, chunkBB);
|
| 124 | this.placeBlock(level, Blocks.CUT_SANDSTONE.defaultBlockState(), 9, 3, 1, chunkBB);
|
| 125 | this.placeBlock(level, Blocks.CUT_SANDSTONE.defaultBlockState(), 10, 3, 1, chunkBB);
|
| 126 | this.placeBlock(level, Blocks.CUT_SANDSTONE.defaultBlockState(), 11, 3, 1, chunkBB);
|
| 127 | this.placeBlock(level, Blocks.CUT_SANDSTONE.defaultBlockState(), 11, 2, 1, chunkBB);
|
| 128 | this.placeBlock(level, Blocks.CUT_SANDSTONE.defaultBlockState(), 11, 1, 1, chunkBB);
|
| 129 | this.generateBox(level, chunkBB, 4, 1, 1, 8, 3, 3, Blocks.SANDSTONE.defaultBlockState(), Blocks.AIR.defaultBlockState(), false);
|
| 130 | this.generateBox(level, chunkBB, 4, 1, 2, 8, 2, 2, Blocks.AIR.defaultBlockState(), Blocks.AIR.defaultBlockState(), false);
|
| 131 | this.generateBox(level, chunkBB, 12, 1, 1, 16, 3, 3, Blocks.SANDSTONE.defaultBlockState(), Blocks.AIR.defaultBlockState(), false);
|
| 132 | this.generateBox(level, chunkBB, 12, 1, 2, 16, 2, 2, Blocks.AIR.defaultBlockState(), Blocks.AIR.defaultBlockState(), false);
|
| 133 | this.generateBox(
|
| 134 | level, chunkBB, 5, 4, 5, this.width - 6, 4, this.depth - 6, Blocks.SANDSTONE.defaultBlockState(), Blocks.SANDSTONE.defaultBlockState(), false
|
| 135 | );
|
| 136 | this.generateBox(level, chunkBB, 9, 4, 9, 11, 4, 11, Blocks.AIR.defaultBlockState(), Blocks.AIR.defaultBlockState(), false);
|
| 137 | this.generateBox(level, chunkBB, 8, 1, 8, 8, 3, 8, Blocks.CUT_SANDSTONE.defaultBlockState(), Blocks.CUT_SANDSTONE.defaultBlockState(), false);
|
| 138 | this.generateBox(level, chunkBB, 12, 1, 8, 12, 3, 8, Blocks.CUT_SANDSTONE.defaultBlockState(), Blocks.CUT_SANDSTONE.defaultBlockState(), false);
|
| 139 | this.generateBox(level, chunkBB, 8, 1, 12, 8, 3, 12, Blocks.CUT_SANDSTONE.defaultBlockState(), Blocks.CUT_SANDSTONE.defaultBlockState(), false);
|
| 140 | this.generateBox(level, chunkBB, 12, 1, 12, 12, 3, 12, Blocks.CUT_SANDSTONE.defaultBlockState(), Blocks.CUT_SANDSTONE.defaultBlockState(), false);
|
| 141 | this.generateBox(level, chunkBB, 1, 1, 5, 4, 4, 11, Blocks.SANDSTONE.defaultBlockState(), Blocks.SANDSTONE.defaultBlockState(), false);
|
| 142 | this.generateBox(
|
| 143 | level, chunkBB, this.width - 5, 1, 5, this.width - 2, 4, 11, Blocks.SANDSTONE.defaultBlockState(), Blocks.SANDSTONE.defaultBlockState(), false
|
| 144 | );
|
| 145 | this.generateBox(level, chunkBB, 6, 7, 9, 6, 7, 11, Blocks.SANDSTONE.defaultBlockState(), Blocks.SANDSTONE.defaultBlockState(), false);
|
| 146 | this.generateBox(
|
| 147 | level, chunkBB, this.width - 7, 7, 9, this.width - 7, 7, 11, Blocks.SANDSTONE.defaultBlockState(), Blocks.SANDSTONE.defaultBlockState(), false
|
| 148 | );
|
| 149 | this.generateBox(level, chunkBB, 5, 5, 9, 5, 7, 11, Blocks.CUT_SANDSTONE.defaultBlockState(), Blocks.CUT_SANDSTONE.defaultBlockState(), false);
|
| 150 | this.generateBox(
|
| 151 | level, chunkBB, this.width - 6, 5, 9, this.width - 6, 7, 11, Blocks.CUT_SANDSTONE.defaultBlockState(), Blocks.CUT_SANDSTONE.defaultBlockState(), false
|
| 152 | );
|
| 153 | this.placeBlock(level, Blocks.AIR.defaultBlockState(), 5, 5, 10, chunkBB);
|
| 154 | this.placeBlock(level, Blocks.AIR.defaultBlockState(), 5, 6, 10, chunkBB);
|
| 155 | this.placeBlock(level, Blocks.AIR.defaultBlockState(), 6, 6, 10, chunkBB);
|
| 156 | this.placeBlock(level, Blocks.AIR.defaultBlockState(), this.width - 6, 5, 10, chunkBB);
|
| 157 | this.placeBlock(level, Blocks.AIR.defaultBlockState(), this.width - 6, 6, 10, chunkBB);
|
| 158 | this.placeBlock(level, Blocks.AIR.defaultBlockState(), this.width - 7, 6, 10, chunkBB);
|
| 159 | this.generateBox(level, chunkBB, 2, 4, 4, 2, 6, 4, Blocks.AIR.defaultBlockState(), Blocks.AIR.defaultBlockState(), false);
|
| 160 | this.generateBox(level, chunkBB, this.width - 3, 4, 4, this.width - 3, 6, 4, Blocks.AIR.defaultBlockState(), Blocks.AIR.defaultBlockState(), false);
|
| 161 | this.placeBlock(level, northStairs, 2, 4, 5, chunkBB);
|
| 162 | this.placeBlock(level, northStairs, 2, 3, 4, chunkBB);
|
| 163 | this.placeBlock(level, northStairs, this.width - 3, 4, 5, chunkBB);
|
| 164 | this.placeBlock(level, northStairs, this.width - 3, 3, 4, chunkBB);
|
| 165 | this.generateBox(level, chunkBB, 1, 1, 3, 2, 2, 3, Blocks.SANDSTONE.defaultBlockState(), Blocks.SANDSTONE.defaultBlockState(), false);
|
| 166 | this.generateBox(
|
| 167 | level, chunkBB, this.width - 3, 1, 3, this.width - 2, 2, 3, Blocks.SANDSTONE.defaultBlockState(), Blocks.SANDSTONE.defaultBlockState(), false
|
| 168 | );
|
| 169 | this.placeBlock(level, Blocks.SANDSTONE.defaultBlockState(), 1, 1, 2, chunkBB);
|
| 170 | this.placeBlock(level, Blocks.SANDSTONE.defaultBlockState(), this.width - 2, 1, 2, chunkBB);
|
| 171 | this.placeBlock(level, Blocks.SANDSTONE_SLAB.defaultBlockState(), 1, 2, 2, chunkBB);
|
| 172 | this.placeBlock(level, Blocks.SANDSTONE_SLAB.defaultBlockState(), this.width - 2, 2, 2, chunkBB);
|
| 173 | this.placeBlock(level, westStairs, 2, 1, 2, chunkBB);
|
| 174 | this.placeBlock(level, eastStairs, this.width - 3, 1, 2, chunkBB);
|
| 175 | this.generateBox(level, chunkBB, 4, 3, 5, 4, 3, 17, Blocks.SANDSTONE.defaultBlockState(), Blocks.SANDSTONE.defaultBlockState(), false);
|
| 176 | this.generateBox(
|
| 177 | level, chunkBB, this.width - 5, 3, 5, this.width - 5, 3, 17, Blocks.SANDSTONE.defaultBlockState(), Blocks.SANDSTONE.defaultBlockState(), false
|
| 178 | );
|
| 179 | this.generateBox(level, chunkBB, 3, 1, 5, 4, 2, 16, Blocks.AIR.defaultBlockState(), Blocks.AIR.defaultBlockState(), false);
|
| 180 | this.generateBox(level, chunkBB, this.width - 6, 1, 5, this.width - 5, 2, 16, Blocks.AIR.defaultBlockState(), Blocks.AIR.defaultBlockState(), false);
|
| 181 |
|
| 182 | for (int z = 5; z <= 17; z += 2) {
|
| 183 | this.placeBlock(level, Blocks.CUT_SANDSTONE.defaultBlockState(), 4, 1, z, chunkBB);
|
| 184 | this.placeBlock(level, Blocks.CHISELED_SANDSTONE.defaultBlockState(), 4, 2, z, chunkBB);
|
| 185 | this.placeBlock(level, Blocks.CUT_SANDSTONE.defaultBlockState(), this.width - 5, 1, z, chunkBB);
|
| 186 | this.placeBlock(level, Blocks.CHISELED_SANDSTONE.defaultBlockState(), this.width - 5, 2, z, chunkBB);
|
| 187 | }
|
| 188 |
|
| 189 | this.placeBlock(level, Blocks.DYED_TERRACOTTA.orange().defaultBlockState(), 10, 0, 7, chunkBB);
|
| 190 | this.placeBlock(level, Blocks.DYED_TERRACOTTA.orange().defaultBlockState(), 10, 0, 8, chunkBB);
|
| 191 | this.placeBlock(level, Blocks.DYED_TERRACOTTA.orange().defaultBlockState(), 9, 0, 9, chunkBB);
|
| 192 | this.placeBlock(level, Blocks.DYED_TERRACOTTA.orange().defaultBlockState(), 11, 0, 9, chunkBB);
|
| 193 | this.placeBlock(level, Blocks.DYED_TERRACOTTA.orange().defaultBlockState(), 8, 0, 10, chunkBB);
|
| 194 | this.placeBlock(level, Blocks.DYED_TERRACOTTA.orange().defaultBlockState(), 12, 0, 10, chunkBB);
|
| 195 | this.placeBlock(level, Blocks.DYED_TERRACOTTA.orange().defaultBlockState(), 7, 0, 10, chunkBB);
|
| 196 | this.placeBlock(level, Blocks.DYED_TERRACOTTA.orange().defaultBlockState(), 13, 0, 10, chunkBB);
|
| 197 | this.placeBlock(level, Blocks.DYED_TERRACOTTA.orange().defaultBlockState(), 9, 0, 11, chunkBB);
|
| 198 | this.placeBlock(level, Blocks.DYED_TERRACOTTA.orange().defaultBlockState(), 11, 0, 11, chunkBB);
|
| 199 | this.placeBlock(level, Blocks.DYED_TERRACOTTA.orange().defaultBlockState(), 10, 0, 12, chunkBB);
|
| 200 | this.placeBlock(level, Blocks.DYED_TERRACOTTA.orange().defaultBlockState(), 10, 0, 13, chunkBB);
|
| 201 | this.placeBlock(level, Blocks.DYED_TERRACOTTA.blue().defaultBlockState(), 10, 0, 10, chunkBB);
|
| 202 |
|
| 203 | for (int x = 0; x <= this.width - 1; x += this.width - 1) {
|
| 204 | this.placeBlock(level, Blocks.CUT_SANDSTONE.defaultBlockState(), x, 2, 1, chunkBB);
|
| 205 | this.placeBlock(level, Blocks.DYED_TERRACOTTA.orange().defaultBlockState(), x, 2, 2, chunkBB);
|
| 206 | this.placeBlock(level, Blocks.CUT_SANDSTONE.defaultBlockState(), x, 2, 3, chunkBB);
|
| 207 | this.placeBlock(level, Blocks.CUT_SANDSTONE.defaultBlockState(), x, 3, 1, chunkBB);
|
| 208 | this.placeBlock(level, Blocks.DYED_TERRACOTTA.orange().defaultBlockState(), x, 3, 2, chunkBB);
|
| 209 | this.placeBlock(level, Blocks.CUT_SANDSTONE.defaultBlockState(), x, 3, 3, chunkBB);
|
| 210 | this.placeBlock(level, Blocks.DYED_TERRACOTTA.orange().defaultBlockState(), x, 4, 1, chunkBB);
|
| 211 | this.placeBlock(level, Blocks.CHISELED_SANDSTONE.defaultBlockState(), x, 4, 2, chunkBB);
|
| 212 | this.placeBlock(level, Blocks.DYED_TERRACOTTA.orange().defaultBlockState(), x, 4, 3, chunkBB);
|
| 213 | this.placeBlock(level, Blocks.CUT_SANDSTONE.defaultBlockState(), x, 5, 1, chunkBB);
|
| 214 | this.placeBlock(level, Blocks.DYED_TERRACOTTA.orange().defaultBlockState(), x, 5, 2, chunkBB);
|
| 215 | this.placeBlock(level, Blocks.CUT_SANDSTONE.defaultBlockState(), x, 5, 3, chunkBB);
|
| 216 | this.placeBlock(level, Blocks.DYED_TERRACOTTA.orange().defaultBlockState(), x, 6, 1, chunkBB);
|
| 217 | this.placeBlock(level, Blocks.CHISELED_SANDSTONE.defaultBlockState(), x, 6, 2, chunkBB);
|
| 218 | this.placeBlock(level, Blocks.DYED_TERRACOTTA.orange().defaultBlockState(), x, 6, 3, chunkBB);
|
| 219 | this.placeBlock(level, Blocks.DYED_TERRACOTTA.orange().defaultBlockState(), x, 7, 1, chunkBB);
|
| 220 | this.placeBlock(level, Blocks.DYED_TERRACOTTA.orange().defaultBlockState(), x, 7, 2, chunkBB);
|
| 221 | this.placeBlock(level, Blocks.DYED_TERRACOTTA.orange().defaultBlockState(), x, 7, 3, chunkBB);
|
| 222 | this.placeBlock(level, Blocks.CUT_SANDSTONE.defaultBlockState(), x, 8, 1, chunkBB);
|
| 223 | this.placeBlock(level, Blocks.CUT_SANDSTONE.defaultBlockState(), x, 8, 2, chunkBB);
|
| 224 | this.placeBlock(level, Blocks.CUT_SANDSTONE.defaultBlockState(), x, 8, 3, chunkBB);
|
| 225 | }
|
| 226 |
|
| 227 | for (int x = 2; x <= this.width - 3; x += this.width - 3 - 2) {
|
| 228 | this.placeBlock(level, Blocks.CUT_SANDSTONE.defaultBlockState(), x - 1, 2, 0, chunkBB);
|
| 229 | this.placeBlock(level, Blocks.DYED_TERRACOTTA.orange().defaultBlockState(), x, 2, 0, chunkBB);
|
| 230 | this.placeBlock(level, Blocks.CUT_SANDSTONE.defaultBlockState(), x + 1, 2, 0, chunkBB);
|
| 231 | this.placeBlock(level, Blocks.CUT_SANDSTONE.defaultBlockState(), x - 1, 3, 0, chunkBB);
|
| 232 | this.placeBlock(level, Blocks.DYED_TERRACOTTA.orange().defaultBlockState(), x, 3, 0, chunkBB);
|
| 233 | this.placeBlock(level, Blocks.CUT_SANDSTONE.defaultBlockState(), x + 1, 3, 0, chunkBB);
|
| 234 | this.placeBlock(level, Blocks.DYED_TERRACOTTA.orange().defaultBlockState(), x - 1, 4, 0, chunkBB);
|
| 235 | this.placeBlock(level, Blocks.CHISELED_SANDSTONE.defaultBlockState(), x, 4, 0, chunkBB);
|
| 236 | this.placeBlock(level, Blocks.DYED_TERRACOTTA.orange().defaultBlockState(), x + 1, 4, 0, chunkBB);
|
| 237 | this.placeBlock(level, Blocks.CUT_SANDSTONE.defaultBlockState(), x - 1, 5, 0, chunkBB);
|
| 238 | this.placeBlock(level, Blocks.DYED_TERRACOTTA.orange().defaultBlockState(), x, 5, 0, chunkBB);
|
| 239 | this.placeBlock(level, Blocks.CUT_SANDSTONE.defaultBlockState(), x + 1, 5, 0, chunkBB);
|
| 240 | this.placeBlock(level, Blocks.DYED_TERRACOTTA.orange().defaultBlockState(), x - 1, 6, 0, chunkBB);
|
| 241 | this.placeBlock(level, Blocks.CHISELED_SANDSTONE.defaultBlockState(), x, 6, 0, chunkBB);
|
| 242 | this.placeBlock(level, Blocks.DYED_TERRACOTTA.orange().defaultBlockState(), x + 1, 6, 0, chunkBB);
|
| 243 | this.placeBlock(level, Blocks.DYED_TERRACOTTA.orange().defaultBlockState(), x - 1, 7, 0, chunkBB);
|
| 244 | this.placeBlock(level, Blocks.DYED_TERRACOTTA.orange().defaultBlockState(), x, 7, 0, chunkBB);
|
| 245 | this.placeBlock(level, Blocks.DYED_TERRACOTTA.orange().defaultBlockState(), x + 1, 7, 0, chunkBB);
|
| 246 | this.placeBlock(level, Blocks.CUT_SANDSTONE.defaultBlockState(), x - 1, 8, 0, chunkBB);
|
| 247 | this.placeBlock(level, Blocks.CUT_SANDSTONE.defaultBlockState(), x, 8, 0, chunkBB);
|
| 248 | this.placeBlock(level, Blocks.CUT_SANDSTONE.defaultBlockState(), x + 1, 8, 0, chunkBB);
|
| 249 | }
|
| 250 |
|
| 251 | this.generateBox(level, chunkBB, 8, 4, 0, 12, 6, 0, Blocks.CUT_SANDSTONE.defaultBlockState(), Blocks.CUT_SANDSTONE.defaultBlockState(), false);
|
| 252 | this.placeBlock(level, Blocks.AIR.defaultBlockState(), 8, 6, 0, chunkBB);
|
| 253 | this.placeBlock(level, Blocks.AIR.defaultBlockState(), 12, 6, 0, chunkBB);
|
| 254 | this.placeBlock(level, Blocks.DYED_TERRACOTTA.orange().defaultBlockState(), 9, 5, 0, chunkBB);
|
| 255 | this.placeBlock(level, Blocks.CHISELED_SANDSTONE.defaultBlockState(), 10, 5, 0, chunkBB);
|
| 256 | this.placeBlock(level, Blocks.DYED_TERRACOTTA.orange().defaultBlockState(), 11, 5, 0, chunkBB);
|
| 257 | this.generateBox(level, chunkBB, 8, -14, 8, 12, -11, 12, Blocks.CUT_SANDSTONE.defaultBlockState(), Blocks.CUT_SANDSTONE.defaultBlockState(), false);
|
| 258 | this.generateBox(level, chunkBB, 8, -10, 8, 12, -10, 12, Blocks.CHISELED_SANDSTONE.defaultBlockState(), Blocks.CHISELED_SANDSTONE.defaultBlockState(), false);
|
| 259 | this.generateBox(level, chunkBB, 8, -9, 8, 12, -9, 12, Blocks.CUT_SANDSTONE.defaultBlockState(), Blocks.CUT_SANDSTONE.defaultBlockState(), false);
|
| 260 | this.generateBox(level, chunkBB, 8, -8, 8, 12, -1, 12, Blocks.SANDSTONE.defaultBlockState(), Blocks.SANDSTONE.defaultBlockState(), false);
|
| 261 | this.generateBox(level, chunkBB, 9, -11, 9, 11, -1, 11, Blocks.AIR.defaultBlockState(), Blocks.AIR.defaultBlockState(), false);
|
| 262 | this.placeBlock(level, Blocks.STONE_PRESSURE_PLATE.defaultBlockState(), 10, -11, 10, chunkBB);
|
| 263 | this.generateBox(level, chunkBB, 9, -13, 9, 11, -13, 11, Blocks.TNT.defaultBlockState(), Blocks.AIR.defaultBlockState(), false);
|
| 264 | this.placeBlock(level, Blocks.AIR.defaultBlockState(), 8, -11, 10, chunkBB);
|
| 265 | this.placeBlock(level, Blocks.AIR.defaultBlockState(), 8, -10, 10, chunkBB);
|
| 266 | this.placeBlock(level, Blocks.CHISELED_SANDSTONE.defaultBlockState(), 7, -10, 10, chunkBB);
|
| 267 | this.placeBlock(level, Blocks.CUT_SANDSTONE.defaultBlockState(), 7, -11, 10, chunkBB);
|
| 268 | this.placeBlock(level, Blocks.AIR.defaultBlockState(), 12, -11, 10, chunkBB);
|
| 269 | this.placeBlock(level, Blocks.AIR.defaultBlockState(), 12, -10, 10, chunkBB);
|
| 270 | this.placeBlock(level, Blocks.CHISELED_SANDSTONE.defaultBlockState(), 13, -10, 10, chunkBB);
|
| 271 | this.placeBlock(level, Blocks.CUT_SANDSTONE.defaultBlockState(), 13, -11, 10, chunkBB);
|
| 272 | this.placeBlock(level, Blocks.AIR.defaultBlockState(), 10, -11, 8, chunkBB);
|
| 273 | this.placeBlock(level, Blocks.AIR.defaultBlockState(), 10, -10, 8, chunkBB);
|
| 274 | this.placeBlock(level, Blocks.CHISELED_SANDSTONE.defaultBlockState(), 10, -10, 7, chunkBB);
|
| 275 | this.placeBlock(level, Blocks.CUT_SANDSTONE.defaultBlockState(), 10, -11, 7, chunkBB);
|
| 276 | this.placeBlock(level, Blocks.AIR.defaultBlockState(), 10, -11, 12, chunkBB);
|
| 277 | this.placeBlock(level, Blocks.AIR.defaultBlockState(), 10, -10, 12, chunkBB);
|
| 278 | this.placeBlock(level, Blocks.CHISELED_SANDSTONE.defaultBlockState(), 10, -10, 13, chunkBB);
|
| 279 | this.placeBlock(level, Blocks.CUT_SANDSTONE.defaultBlockState(), 10, -11, 13, chunkBB);
|
| 280 |
|
| 281 | for (Direction direction : Direction.Plane.HORIZONTAL) {
|
| 282 | if (!this.hasPlacedChest[direction.get2DDataValue()]) {
|
| 283 | int xo = direction.getStepX() * 2;
|
| 284 | int zo = direction.getStepZ() * 2;
|
| 285 | this.hasPlacedChest[direction.get2DDataValue()] = this.createChest(level, chunkBB, random, 10 + xo, -11, 10 + zo, BuiltInLootTables.DESERT_PYRAMID);
|
| 286 | }
|
| 287 | }
|
| 288 |
|
| 289 | this.addCellar(level, chunkBB);
|
| 290 | }
|
| 291 | }
|
| 292 |
|
| 293 | private void addCellar(final WorldGenLevel level, final BoundingBox chunkBB) {
|
| 294 | BlockPos roomCenter = new BlockPos(16, -4, 13);
|
| 295 | this.addCellarStairs(roomCenter, level, chunkBB);
|
| 296 | this.addCellarRoom(roomCenter, level, chunkBB);
|
| 297 | }
|
| 298 |
|
| 299 | private void addCellarStairs(final BlockPos roomCenter, final WorldGenLevel level, final BoundingBox chunkBB) {
|
| 300 | int x = roomCenter.getX();
|
| 301 | int y = roomCenter.getY();
|
| 302 | int z = roomCenter.getZ();
|
| 303 | BlockState sandStoneStairs = Blocks.SANDSTONE_STAIRS.defaultBlockState();
|
| 304 | this.placeBlock(level, sandStoneStairs.rotate(Rotation.COUNTERCLOCKWISE_90), 13, -1, 17, chunkBB);
|
| 305 | this.placeBlock(level, sandStoneStairs.rotate(Rotation.COUNTERCLOCKWISE_90), 14, -2, 17, chunkBB);
|
| 306 | this.placeBlock(level, sandStoneStairs.rotate(Rotation.COUNTERCLOCKWISE_90), 15, -3, 17, chunkBB);
|
| 307 | BlockState sand = Blocks.SAND.defaultBlockState();
|
| 308 | BlockState sandStone = Blocks.SANDSTONE.defaultBlockState();
|
| 309 | boolean variant = level.getRandom().nextBoolean();
|
| 310 | this.placeBlock(level, sand, x - 4, y + 4, z + 4, chunkBB);
|
| 311 | this.placeBlock(level, sand, x - 3, y + 4, z + 4, chunkBB);
|
| 312 | this.placeBlock(level, sand, x - 2, y + 4, z + 4, chunkBB);
|
| 313 | this.placeBlock(level, sand, x - 1, y + 4, z + 4, chunkBB);
|
| 314 | this.placeBlock(level, sand, x, y + 4, z + 4, chunkBB);
|
| 315 | this.placeBlock(level, sand, x - 2, y + 3, z + 4, chunkBB);
|
| 316 | this.placeBlock(level, variant ? sand : sandStone, x - 1, y + 3, z + 4, chunkBB);
|
| 317 | this.placeBlock(level, !variant ? sand : sandStone, x, y + 3, z + 4, chunkBB);
|
| 318 | this.placeBlock(level, sand, x - 1, y + 2, z + 4, chunkBB);
|
| 319 | this.placeBlock(level, sandStone, x, y + 2, z + 4, chunkBB);
|
| 320 | this.placeBlock(level, sand, x, y + 1, z + 4, chunkBB);
|
| 321 | }
|
| 322 |
|
| 323 | private void addCellarRoom(final BlockPos roomCenter, final WorldGenLevel level, final BoundingBox chunkBB) {
|
| 324 | int x = roomCenter.getX();
|
| 325 | int y = roomCenter.getY();
|
| 326 | int z = roomCenter.getZ();
|
| 327 | BlockState cutSandStone = Blocks.CUT_SANDSTONE.defaultBlockState();
|
| 328 | BlockState hieroglyphsSandStone = Blocks.CHISELED_SANDSTONE.defaultBlockState();
|
| 329 | this.generateBox(level, chunkBB, x - 3, y + 1, z - 3, x - 3, y + 1, z + 2, cutSandStone, cutSandStone, true);
|
| 330 | this.generateBox(level, chunkBB, x + 3, y + 1, z - 3, x + 3, y + 1, z + 2, cutSandStone, cutSandStone, true);
|
| 331 | this.generateBox(level, chunkBB, x - 3, y + 1, z - 3, x + 3, y + 1, z - 2, cutSandStone, cutSandStone, true);
|
| 332 | this.generateBox(level, chunkBB, x - 3, y + 1, z + 3, x + 3, y + 1, z + 3, cutSandStone, cutSandStone, true);
|
| 333 | this.generateBox(level, chunkBB, x - 3, y + 2, z - 3, x - 3, y + 2, z + 2, hieroglyphsSandStone, hieroglyphsSandStone, true);
|
| 334 | this.generateBox(level, chunkBB, x + 3, y + 2, z - 3, x + 3, y + 2, z + 2, hieroglyphsSandStone, hieroglyphsSandStone, true);
|
| 335 | this.generateBox(level, chunkBB, x - 3, y + 2, z - 3, x + 3, y + 2, z - 2, hieroglyphsSandStone, hieroglyphsSandStone, true);
|
| 336 | this.generateBox(level, chunkBB, x - 3, y + 2, z + 3, x + 3, y + 2, z + 3, hieroglyphsSandStone, hieroglyphsSandStone, true);
|
| 337 | this.generateBox(level, chunkBB, x - 3, -1, z - 3, x - 3, -1, z + 2, cutSandStone, cutSandStone, true);
|
| 338 | this.generateBox(level, chunkBB, x + 3, -1, z - 3, x + 3, -1, z + 2, cutSandStone, cutSandStone, true);
|
| 339 | this.generateBox(level, chunkBB, x - 3, -1, z - 3, x + 3, -1, z - 2, cutSandStone, cutSandStone, true);
|
| 340 | this.generateBox(level, chunkBB, x - 3, -1, z + 3, x + 3, -1, z + 3, cutSandStone, cutSandStone, true);
|
| 341 | this.placeSandBox(x - 2, y + 1, z - 2, x + 2, y + 3, z + 2);
|
| 342 | this.placeCollapsedRoof(level, chunkBB, x - 2, y + 4, z - 2, x + 2, z + 2);
|
| 343 | BlockState orangeTeracotta = Blocks.DYED_TERRACOTTA.orange().defaultBlockState();
|
| 344 | BlockState blueTeracotta = Blocks.DYED_TERRACOTTA.blue().defaultBlockState();
|
| 345 | this.placeBlock(level, blueTeracotta, x, y, z, chunkBB);
|
| 346 | this.placeBlock(level, orangeTeracotta, x + 1, y, z - 1, chunkBB);
|
| 347 | this.placeBlock(level, orangeTeracotta, x + 1, y, z + 1, chunkBB);
|
| 348 | this.placeBlock(level, orangeTeracotta, x - 1, y, z - 1, chunkBB);
|
| 349 | this.placeBlock(level, orangeTeracotta, x - 1, y, z + 1, chunkBB);
|
| 350 | this.placeBlock(level, orangeTeracotta, x + 2, y, z, chunkBB);
|
| 351 | this.placeBlock(level, orangeTeracotta, x - 2, y, z, chunkBB);
|
| 352 | this.placeBlock(level, orangeTeracotta, x, y, z + 2, chunkBB);
|
| 353 | this.placeBlock(level, orangeTeracotta, x, y, z - 2, chunkBB);
|
| 354 | this.placeBlock(level, orangeTeracotta, x + 3, y, z, chunkBB);
|
| 355 | this.placeSand(x + 3, y + 1, z);
|
| 356 | this.placeSand(x + 3, y + 2, z);
|
| 357 | this.placeBlock(level, cutSandStone, x + 4, y + 1, z, chunkBB);
|
| 358 | this.placeBlock(level, hieroglyphsSandStone, x + 4, y + 2, z, chunkBB);
|
| 359 | this.placeBlock(level, orangeTeracotta, x - 3, y, z, chunkBB);
|
| 360 | this.placeSand(x - 3, y + 1, z);
|
| 361 | this.placeSand(x - 3, y + 2, z);
|
| 362 | this.placeBlock(level, cutSandStone, x - 4, y + 1, z, chunkBB);
|
| 363 | this.placeBlock(level, hieroglyphsSandStone, x - 4, y + 2, z, chunkBB);
|
| 364 | this.placeBlock(level, orangeTeracotta, x, y, z + 3, chunkBB);
|
| 365 | this.placeSand(x, y + 1, z + 3);
|
| 366 | this.placeSand(x, y + 2, z + 3);
|
| 367 | this.placeBlock(level, orangeTeracotta, x, y, z - 3, chunkBB);
|
| 368 | this.placeSand(x, y + 1, z - 3);
|
| 369 | this.placeSand(x, y + 2, z - 3);
|
| 370 | this.placeBlock(level, cutSandStone, x, y + 1, z - 4, chunkBB);
|
| 371 | this.placeBlock(level, hieroglyphsSandStone, x, -2, z - 4, chunkBB);
|
| 372 | }
|
| 373 |
|
| 374 | private void placeSand(final int x, final int y, final int z) {
|
| 375 | BlockPos worldPos = this.getWorldPos(x, y, z);
|
| 376 | this.potentialSuspiciousSandWorldPositions.add(worldPos);
|
| 377 | }
|
| 378 |
|
| 379 | private void placeSandBox(final int x0, final int y0, final int z0, final int x1, final int y1, final int z1) {
|
| 380 | for (int y = y0; y <= y1; y++) {
|
| 381 | for (int x = x0; x <= x1; x++) {
|
| 382 | for (int z = z0; z <= z1; z++) {
|
| 383 | this.placeSand(x, y, z);
|
| 384 | }
|
| 385 | }
|
| 386 | }
|
| 387 | }
|
| 388 |
|
| 389 | private void placeCollapsedRoofPiece(final WorldGenLevel level, final int x, final int y, final int z, final BoundingBox chunkBB) {
|
| 390 | if (level.getRandom().nextFloat() < 0.33F) {
|
| 391 | BlockState blockState = Blocks.SANDSTONE.defaultBlockState();
|
| 392 | this.placeBlock(level, blockState, x, y, z, chunkBB);
|
| 393 | } else {
|
| 394 | BlockState blockState = Blocks.SAND.defaultBlockState();
|
| 395 | this.placeBlock(level, blockState, x, y, z, chunkBB);
|
| 396 | }
|
| 397 | }
|
| 398 |
|
| 399 | private void placeCollapsedRoof(final WorldGenLevel level, final BoundingBox chunkBB, final int x0, final int y0, final int z0, final int x1, final int z1) {
|
| 400 | for (int x = x0; x <= x1; x++) {
|
| 401 | for (int z = z0; z <= z1; z++) {
|
| 402 | this.placeCollapsedRoofPiece(level, x, y0, z, chunkBB);
|
| 403 | }
|
| 404 | }
|
| 405 |
|
| 406 | RandomSource random = RandomSource.createThreadLocalInstance(level.getSeed()).forkPositional().at(this.getWorldPos(x0, y0, z0));
|
| 407 | int roofPosX = random.nextIntBetweenInclusive(x0, x1);
|
| 408 | int roofPosZ = random.nextIntBetweenInclusive(z0, z1);
|
| 409 | this.randomCollapsedRoofPos = new BlockPos(this.getWorldX(roofPosX, roofPosZ), this.getWorldY(y0), this.getWorldZ(roofPosX, roofPosZ));
|
| 410 | }
|
| 411 |
|
| 412 | public List<BlockPos> getPotentialSuspiciousSandWorldPositions() {
|
| 413 | return this.potentialSuspiciousSandWorldPositions;
|
| 414 | }
|
| 415 |
|
| 416 | public BlockPos getRandomCollapsedRoofPos() {
|
| 417 | return this.randomCollapsedRoofPos;
|
| 418 | }
|
| 419 | }
|
| 420 |
|