OceanMonumentPieces .java

net.minecraft.world.level.levelgen.structure.structures.OceanMonumentPieces (class, 1986 lines): members: OceanMonumentSimpleTopRoom, MonumentRoomFitter.

net.minecraft.world.level.levelgen.structure.structuresclass1,986 linescommon92.1 KB

API Surface (38)

boolean fits(final OceanMonumentPieces.RoomDefinition definition)
OceanMonumentPieces.OceanMonumentPiece create(final Direction orientation, final OceanMonumentPieces.RoomDefinition definition, final RandomSource random)
boolean fits(final OceanMonumentPieces.RoomDefinition definition)
OceanMonumentPieces.OceanMonumentPiece create(final Direction orientation, final OceanMonumentPieces.RoomDefinition definition, final RandomSource random)
boolean fits(final OceanMonumentPieces.RoomDefinition definition)
OceanMonumentPieces.OceanMonumentPiece create(final Direction orientation, final OceanMonumentPieces.RoomDefinition definition, final RandomSource random)
boolean fits(final OceanMonumentPieces.RoomDefinition definition)
OceanMonumentPieces.OceanMonumentPiece create(final Direction orientation, final OceanMonumentPieces.RoomDefinition definition, final RandomSource random)
boolean fits(final OceanMonumentPieces.RoomDefinition definition)
OceanMonumentPieces.OceanMonumentPiece create(final Direction orientation, final OceanMonumentPieces.RoomDefinition definition, final RandomSource random)
boolean fits(final OceanMonumentPieces.RoomDefinition definition)
OceanMonumentPieces.OceanMonumentPiece create(final Direction orientation, final OceanMonumentPieces.RoomDefinition definition, final RandomSource random)
boolean fits(final OceanMonumentPieces.RoomDefinition definition)
OceanMonumentPieces.OceanMonumentPiece create(final Direction orientation, final OceanMonumentPieces.RoomDefinition definition, final RandomSource random)
void postProcess(final WorldGenLevel level, final StructureManager structureManager, final ChunkGenerator generator, final RandomSource random, final BoundingBox chunkBB, final ChunkPos chunkPos, final BlockPos referencePos)
void postProcess(final WorldGenLevel level, final StructureManager structureManager, final ChunkGenerator generator, final RandomSource random, final BoundingBox chunkBB, final ChunkPos chunkPos, final BlockPos referencePos)
void postProcess(final WorldGenLevel level, final StructureManager structureManager, final ChunkGenerator generator, final RandomSource random, final BoundingBox chunkBB, final ChunkPos chunkPos, final BlockPos referencePos)
void postProcess(final WorldGenLevel level, final StructureManager structureManager, final ChunkGenerator generator, final RandomSource random, final BoundingBox chunkBB, final ChunkPos chunkPos, final BlockPos referencePos)
void postProcess(final WorldGenLevel level, final StructureManager structureManager, final ChunkGenerator generator, final RandomSource random, final BoundingBox chunkBB, final ChunkPos chunkPos, final BlockPos referencePos)
void postProcess(final WorldGenLevel level, final StructureManager structureManager, final ChunkGenerator generator, final RandomSource random, final BoundingBox chunkBB, final ChunkPos chunkPos, final BlockPos referencePos)
void postProcess(final WorldGenLevel level, final StructureManager structureManager, final ChunkGenerator generator, final RandomSource random, final BoundingBox chunkBB, final ChunkPos chunkPos, final BlockPos referencePos)
void postProcess(final WorldGenLevel level, final StructureManager structureManager, final ChunkGenerator generator, final RandomSource random, final BoundingBox chunkBB, final ChunkPos chunkPos, final BlockPos referencePos)
void postProcess(final WorldGenLevel level, final StructureManager structureManager, final ChunkGenerator generator, final RandomSource random, final BoundingBox chunkBB, final ChunkPos chunkPos, final BlockPos referencePos)
int getRoomIndex(final int roomX, final int roomY, final int roomZ)
void addAdditionalSaveData(final StructurePieceSerializationContext context, final CompoundTag tag)
void generateWaterBox(final WorldGenLevel level, final BoundingBox chunkBB, final int x0, final int y0, final int z0, final int x1, final int y1, final int z1)
void generateDefaultFloor(final WorldGenLevel level, final BoundingBox chunkBB, final int xOff, final int zOff, final boolean downOpening)
void generateBoxOnFillOnly(final WorldGenLevel level, final BoundingBox chunkBB, final int x0, final int y0, final int z0, final int x1, final int y1, final int z1, final BlockState targetBlock)
boolean chunkIntersects(final BoundingBox chunkBB, final int x0, final int z0, final int x1, final int z1)
void spawnElder(final WorldGenLevel level, final BoundingBox chunkBB, final int x, final int y, final int z)
void postProcess(final WorldGenLevel level, final StructureManager structureManager, final ChunkGenerator generator, final RandomSource random, final BoundingBox chunkBB, final ChunkPos chunkPos, final BlockPos referencePos)
void postProcess(final WorldGenLevel level, final StructureManager structureManager, final ChunkGenerator generator, final RandomSource random, final BoundingBox chunkBB, final ChunkPos chunkPos, final BlockPos referencePos)
void postProcess(final WorldGenLevel level, final StructureManager structureManager, final ChunkGenerator generator, final RandomSource random, final BoundingBox chunkBB, final ChunkPos chunkPos, final BlockPos referencePos)
void setConnection(final Direction direction, final OceanMonumentPieces.RoomDefinition definition)
void updateOpenings()
boolean findSource(final int scanIndex)
boolean isSpecial()
int countOpenings()

Full Source

OceanMonumentPieces.java1986 lines · Minecraft 26.3 · verbatim
1
package net.minecraft.world.level.levelgen.structure.structures;
2
3
import com.google.common.collect.ImmutableSet;
4
import com.google.common.collect.Lists;
5
import it.unimi.dsi.fastutil.objects.ObjectArrayList;
6
import java.util.List;
7
import java.util.Set;
8
import net.minecraft.core.BlockPos;
9
import net.minecraft.core.Direction;
10
import net.minecraft.nbt.CompoundTag;
11
import net.minecraft.util.RandomSource;
12
import net.minecraft.util.Util;
13
import net.minecraft.world.entity.EntitySpawnReason;
14
import net.minecraft.world.entity.EntityTypes;
15
import net.minecraft.world.entity.monster.ElderGuardian;
16
import net.minecraft.world.level.ChunkPos;
17
import net.minecraft.world.level.StructureManager;
18
import net.minecraft.world.level.WorldGenLevel;
19
import net.minecraft.world.level.block.Block;
20
import net.minecraft.world.level.block.Blocks;
21
import net.minecraft.world.level.block.state.BlockState;
22
import net.minecraft.world.level.chunk.ChunkGenerator;
23
import net.minecraft.world.level.levelgen.structure.BoundingBox;
24
import net.minecraft.world.level.levelgen.structure.StructurePiece;
25
import net.minecraft.world.level.levelgen.structure.pieces.StructurePieceSerializationContext;
26
import net.minecraft.world.level.levelgen.structure.pieces.StructurePieceType;
27
28
public class OceanMonumentPieces {
29
	private OceanMonumentPieces() {
30
	}
31
32
	private static class FitDoubleXRoom implements OceanMonumentPieces.MonumentRoomFitter {
33
		@Override
34
		public boolean fits(final OceanMonumentPieces.RoomDefinition definition) {
35
			return definition.hasOpening[Direction.EAST.get3DDataValue()] && !definition.connections[Direction.EAST.get3DDataValue()].claimed;
36
		}
37
38
		@Override
39
		public OceanMonumentPieces.OceanMonumentPiece create(
40
			final Direction orientation, final OceanMonumentPieces.RoomDefinition definition, final RandomSource random
41
		) {
42
			definition.claimed = true;
43
			definition.connections[Direction.EAST.get3DDataValue()].claimed = true;
44
			return new OceanMonumentPieces.OceanMonumentDoubleXRoom(orientation, definition);
45
		}
46
	}
47
48
	private static class FitDoubleXYRoom implements OceanMonumentPieces.MonumentRoomFitter {
49
		@Override
50
		public boolean fits(final OceanMonumentPieces.RoomDefinition definition) {
51
			if (definition.hasOpening[Direction.EAST.get3DDataValue()]
52
				&& !definition.connections[Direction.EAST.get3DDataValue()].claimed
53
				&& definition.hasOpening[Direction.UP.get3DDataValue()]
54
				&& !definition.connections[Direction.UP.get3DDataValue()].claimed) {
55
				OceanMonumentPieces.RoomDefinition east = definition.connections[Direction.EAST.get3DDataValue()];
56
				return east.hasOpening[Direction.UP.get3DDataValue()] && !east.connections[Direction.UP.get3DDataValue()].claimed;
57
			} else {
58
				return false;
59
			}
60
		}
61
62
		@Override
63
		public OceanMonumentPieces.OceanMonumentPiece create(
64
			final Direction orientation, final OceanMonumentPieces.RoomDefinition definition, final RandomSource random
65
		) {
66
			definition.claimed = true;
67
			definition.connections[Direction.EAST.get3DDataValue()].claimed = true;
68
			definition.connections[Direction.UP.get3DDataValue()].claimed = true;
69
			definition.connections[Direction.EAST.get3DDataValue()].connections[Direction.UP.get3DDataValue()].claimed = true;
70
			return new OceanMonumentPieces.OceanMonumentDoubleXYRoom(orientation, definition);
71
		}
72
	}
73
74
	private static class FitDoubleYRoom implements OceanMonumentPieces.MonumentRoomFitter {
75
		@Override
76
		public boolean fits(final OceanMonumentPieces.RoomDefinition definition) {
77
			return definition.hasOpening[Direction.UP.get3DDataValue()] && !definition.connections[Direction.UP.get3DDataValue()].claimed;
78
		}
79
80
		@Override
81
		public OceanMonumentPieces.OceanMonumentPiece create(
82
			final Direction orientation, final OceanMonumentPieces.RoomDefinition definition, final RandomSource random
83
		) {
84
			definition.claimed = true;
85
			definition.connections[Direction.UP.get3DDataValue()].claimed = true;
86
			return new OceanMonumentPieces.OceanMonumentDoubleYRoom(orientation, definition);
87
		}
88
	}
89
90
	private static class FitDoubleYZRoom implements OceanMonumentPieces.MonumentRoomFitter {
91
		@Override
92
		public boolean fits(final OceanMonumentPieces.RoomDefinition definition) {
93
			if (definition.hasOpening[Direction.NORTH.get3DDataValue()]
94
				&& !definition.connections[Direction.NORTH.get3DDataValue()].claimed
95
				&& definition.hasOpening[Direction.UP.get3DDataValue()]
96
				&& !definition.connections[Direction.UP.get3DDataValue()].claimed) {
97
				OceanMonumentPieces.RoomDefinition north = definition.connections[Direction.NORTH.get3DDataValue()];
98
				return north.hasOpening[Direction.UP.get3DDataValue()] && !north.connections[Direction.UP.get3DDataValue()].claimed;
99
			} else {
100
				return false;
101
			}
102
		}
103
104
		@Override
105
		public OceanMonumentPieces.OceanMonumentPiece create(
106
			final Direction orientation, final OceanMonumentPieces.RoomDefinition definition, final RandomSource random
107
		) {
108
			definition.claimed = true;
109
			definition.connections[Direction.NORTH.get3DDataValue()].claimed = true;
110
			definition.connections[Direction.UP.get3DDataValue()].claimed = true;
111
			definition.connections[Direction.NORTH.get3DDataValue()].connections[Direction.UP.get3DDataValue()].claimed = true;
112
			return new OceanMonumentPieces.OceanMonumentDoubleYZRoom(orientation, definition);
113
		}
114
	}
115
116
	private static class FitDoubleZRoom implements OceanMonumentPieces.MonumentRoomFitter {
117
		@Override
118
		public boolean fits(final OceanMonumentPieces.RoomDefinition definition) {
119
			return definition.hasOpening[Direction.NORTH.get3DDataValue()] && !definition.connections[Direction.NORTH.get3DDataValue()].claimed;
120
		}
121
122
		@Override
123
		public OceanMonumentPieces.OceanMonumentPiece create(
124
			final Direction orientation, final OceanMonumentPieces.RoomDefinition definition, final RandomSource random
125
		) {
126
			OceanMonumentPieces.RoomDefinition source = definition;
127
			if (!definition.hasOpening[Direction.NORTH.get3DDataValue()] || definition.connections[Direction.NORTH.get3DDataValue()].claimed) {
128
				source = definition.connections[Direction.SOUTH.get3DDataValue()];
129
			}
130
131
			source.claimed = true;
132
			source.connections[Direction.NORTH.get3DDataValue()].claimed = true;
133
			return new OceanMonumentPieces.OceanMonumentDoubleZRoom(orientation, source);
134
		}
135
	}
136
137
	private static class FitSimpleRoom implements OceanMonumentPieces.MonumentRoomFitter {
138
		@Override
139
		public boolean fits(final OceanMonumentPieces.RoomDefinition definition) {
140
			return true;
141
		}
142
143
		@Override
144
		public OceanMonumentPieces.OceanMonumentPiece create(
145
			final Direction orientation, final OceanMonumentPieces.RoomDefinition definition, final RandomSource random
146
		) {
147
			definition.claimed = true;
148
			return new OceanMonumentPieces.OceanMonumentSimpleRoom(orientation, definition, random);
149
		}
150
	}
151
152
	private static class FitSimpleTopRoom implements OceanMonumentPieces.MonumentRoomFitter {
153
		@Override
154
		public boolean fits(final OceanMonumentPieces.RoomDefinition definition) {
155
			return !definition.hasOpening[Direction.WEST.get3DDataValue()]
156
				&& !definition.hasOpening[Direction.EAST.get3DDataValue()]
157
				&& !definition.hasOpening[Direction.NORTH.get3DDataValue()]
158
				&& !definition.hasOpening[Direction.SOUTH.get3DDataValue()]
159
				&& !definition.hasOpening[Direction.UP.get3DDataValue()];
160
		}
161
162
		@Override
163
		public OceanMonumentPieces.OceanMonumentPiece create(
164
			final Direction orientation, final OceanMonumentPieces.RoomDefinition definition, final RandomSource random
165
		) {
166
			definition.claimed = true;
167
			return new OceanMonumentPieces.OceanMonumentSimpleTopRoom(orientation, definition);
168
		}
169
	}
170
171
	public static class MonumentBuilding extends OceanMonumentPieces.OceanMonumentPiece {
172
		private static final int WIDTH = 58;
173
		private static final int HEIGHT = 22;
174
		private static final int DEPTH = 58;
175
		public static final int BIOME_RANGE_CHECK = 29;
176
		private static final int TOP_POSITION = 61;
177
		private OceanMonumentPieces.RoomDefinition sourceRoom;
178
		private OceanMonumentPieces.RoomDefinition coreRoom;
179
		private final List<OceanMonumentPieces.OceanMonumentPiece> childPieces = Lists.newArrayList();
180
181
		public MonumentBuilding(final RandomSource random, final int west, final int north, final Direction direction) {
182
			super(StructurePieceType.OCEAN_MONUMENT_BUILDING, direction, 0, makeBoundingBox(west, 39, north, direction, 58, 23, 58));
183
			this.setOrientation(direction);
184
			List<OceanMonumentPieces.RoomDefinition> roomDefinitions = this.generateRoomGraph(random);
185
			this.sourceRoom.claimed = true;
186
			this.childPieces.add(new OceanMonumentPieces.OceanMonumentEntryRoom(direction, this.sourceRoom));
187
			this.childPieces.add(new OceanMonumentPieces.OceanMonumentCoreRoom(direction, this.coreRoom));
188
			List<OceanMonumentPieces.MonumentRoomFitter> fitters = Lists.newArrayList();
189
			fitters.add(new OceanMonumentPieces.FitDoubleXYRoom());
190
			fitters.add(new OceanMonumentPieces.FitDoubleYZRoom());
191
			fitters.add(new OceanMonumentPieces.FitDoubleZRoom());
192
			fitters.add(new OceanMonumentPieces.FitDoubleXRoom());
193
			fitters.add(new OceanMonumentPieces.FitDoubleYRoom());
194
			fitters.add(new OceanMonumentPieces.FitSimpleTopRoom());
195
			fitters.add(new OceanMonumentPieces.FitSimpleRoom());
196
197
			for (OceanMonumentPieces.RoomDefinition definition : roomDefinitions) {
198
				if (!definition.claimed && !definition.isSpecial()) {
199
					for (OceanMonumentPieces.MonumentRoomFitter fitter : fitters) {
200
						if (fitter.fits(definition)) {
201
							this.childPieces.add(fitter.create(direction, definition, random));
202
							break;
203
						}
204
					}
205
				}
206
			}
207
208
			BlockPos offset = this.getWorldPos(9, 0, 22);
209
210
			for (OceanMonumentPieces.OceanMonumentPiece child : this.childPieces) {
211
				child.getBoundingBox().move(offset);
212
			}
213
214
			BoundingBox leftWing = BoundingBox.fromCorners(this.getWorldPos(1, 1, 1), this.getWorldPos(23, 8, 21));
215
			BoundingBox rightWing = BoundingBox.fromCorners(this.getWorldPos(34, 1, 1), this.getWorldPos(56, 8, 21));
216
			BoundingBox penthouse = BoundingBox.fromCorners(this.getWorldPos(22, 13, 22), this.getWorldPos(35, 17, 35));
217
			int wingRandom = random.nextInt();
218
			this.childPieces.add(new OceanMonumentPieces.OceanMonumentWingRoom(direction, leftWing, wingRandom++));
219
			this.childPieces.add(new OceanMonumentPieces.OceanMonumentWingRoom(direction, rightWing, wingRandom++));
220
			this.childPieces.add(new OceanMonumentPieces.OceanMonumentPenthouse(direction, penthouse));
221
		}
222
223
		public MonumentBuilding(final CompoundTag tag) {
224
			super(StructurePieceType.OCEAN_MONUMENT_BUILDING, tag);
225
		}
226
227
		private List<OceanMonumentPieces.RoomDefinition> generateRoomGraph(final RandomSource random) {
228
			OceanMonumentPieces.RoomDefinition[] roomGrid = new OceanMonumentPieces.RoomDefinition[75];
229
230
			for (int x = 0; x < 5; x++) {
231
				for (int z = 0; z < 4; z++) {
232
					int y = 0;
233
					int pos = getRoomIndex(x, 0, z);
234
					roomGrid[pos] = new OceanMonumentPieces.RoomDefinition(pos);
235
				}
236
			}
237
238
			for (int x = 0; x < 5; x++) {
239
				for (int z = 0; z < 4; z++) {
240
					int y = 1;
241
					int pos = getRoomIndex(x, 1, z);
242
					roomGrid[pos] = new OceanMonumentPieces.RoomDefinition(pos);
243
				}
244
			}
245
246
			for (int x = 1; x < 4; x++) {
247
				for (int z = 0; z < 2; z++) {
248
					int y = 2;
249
					int pos = getRoomIndex(x, 2, z);
250
					roomGrid[pos] = new OceanMonumentPieces.RoomDefinition(pos);
251
				}
252
			}
253
254
			this.sourceRoom = roomGrid[GRIDROOM_SOURCE_INDEX];
255
256
			for (int x = 0; x < 5; x++) {
257
				for (int z = 0; z < 5; z++) {
258
					for (int y = 0; y < 3; y++) {
259
						int pos = getRoomIndex(x, y, z);
260
						if (roomGrid[pos] != null) {
261
							for (Direction direction : Direction.values()) {
262
								int neighX = x + direction.getStepX();
263
								int neighY = y + direction.getStepY();
264
								int neighZ = z + direction.getStepZ();
265
								if (neighX >= 0 && neighX < 5 && neighZ >= 0 && neighZ < 5 && neighY >= 0 && neighY < 3) {
266
									int neighPos = getRoomIndex(neighX, neighY, neighZ);
267
									if (roomGrid[neighPos] != null) {
268
										if (neighZ == z) {
269
											roomGrid[pos].setConnection(direction, roomGrid[neighPos]);
270
										} else {
271
											roomGrid[pos].setConnection(direction.getOpposite(), roomGrid[neighPos]);
272
										}
273
									}
274
								}
275
							}
276
						}
277
					}
278
				}
279
			}
280
281
			OceanMonumentPieces.RoomDefinition roofRoom = new OceanMonumentPieces.RoomDefinition(1003);
282
			OceanMonumentPieces.RoomDefinition leftWing = new OceanMonumentPieces.RoomDefinition(1001);
283
			OceanMonumentPieces.RoomDefinition rightWing = new OceanMonumentPieces.RoomDefinition(1002);
284
			roomGrid[GRIDROOM_TOP_CONNECT_INDEX].setConnection(Direction.UP, roofRoom);
285
			roomGrid[GRIDROOM_LEFTWING_CONNECT_INDEX].setConnection(Direction.SOUTH, leftWing);
286
			roomGrid[GRIDROOM_RIGHTWING_CONNECT_INDEX].setConnection(Direction.SOUTH, rightWing);
287
			roofRoom.claimed = true;
288
			leftWing.claimed = true;
289
			rightWing.claimed = true;
290
			this.sourceRoom.isSource = true;
291
			this.coreRoom = roomGrid[getRoomIndex(random.nextInt(4), 0, 2)];
292
			this.coreRoom.claimed = true;
293
			this.coreRoom.connections[Direction.EAST.get3DDataValue()].claimed = true;
294
			this.coreRoom.connections[Direction.NORTH.get3DDataValue()].claimed = true;
295
			this.coreRoom.connections[Direction.EAST.get3DDataValue()].connections[Direction.NORTH.get3DDataValue()].claimed = true;
296
			this.coreRoom.connections[Direction.UP.get3DDataValue()].claimed = true;
297
			this.coreRoom.connections[Direction.EAST.get3DDataValue()].connections[Direction.UP.get3DDataValue()].claimed = true;
298
			this.coreRoom.connections[Direction.NORTH.get3DDataValue()].connections[Direction.UP.get3DDataValue()].claimed = true;
299
			this.coreRoom.connections[Direction.EAST.get3DDataValue()].connections[Direction.NORTH.get3DDataValue()].connections[Direction.UP.get3DDataValue()].claimed = true;
300
			ObjectArrayList<OceanMonumentPieces.RoomDefinition> roomDefs = new ObjectArrayList<>();
301
302
			for (OceanMonumentPieces.RoomDefinition definition : roomGrid) {
303
				if (definition != null) {
304
					definition.updateOpenings();
305
					roomDefs.add(definition);
306
				}
307
			}
308
309
			roofRoom.updateOpenings();
310
			Util.shuffle(roomDefs, random);
311
			int scanIndex = 1;
312
313
			for (OceanMonumentPieces.RoomDefinition definition : roomDefs) {
314
				int closeCount = 0;
315
				int attemptCount = 0;
316
317
				while (closeCount < 2 && attemptCount < 5) {
318
					attemptCount++;
319
					int f = random.nextInt(6);
320
					if (definition.hasOpening[f]) {
321
						int of = Direction.from3DDataValue(f).getOpposite().get3DDataValue();
322
						definition.hasOpening[f] = false;
323
						definition.connections[f].hasOpening[of] = false;
324
						if (definition.findSource(scanIndex++) && definition.connections[f].findSource(scanIndex++)) {
325
							closeCount++;
326
						} else {
327
							definition.hasOpening[f] = true;
328
							definition.connections[f].hasOpening[of] = true;
329
						}
330
					}
331
				}
332
			}
333
334
			roomDefs.add(roofRoom);
335
			roomDefs.add(leftWing);
336
			roomDefs.add(rightWing);
337
			return roomDefs;
338
		}
339
340
		@Override
341
		public void postProcess(
342
			final WorldGenLevel level,
343
			final StructureManager structureManager,
344
			final ChunkGenerator generator,
345
			final RandomSource random,
346
			final BoundingBox chunkBB,
347
			final ChunkPos chunkPos,
348
			final BlockPos referencePos
349
		) {
350
			int waterHeight = Math.max(level.getSeaLevel(), 64) - this.boundingBox.minY();
351
			this.generateWaterBox(level, chunkBB, 0, 0, 0, 58, waterHeight, 58);
352
			this.generateWing(false, 0, level, random, chunkBB);
353
			this.generateWing(true, 33, level, random, chunkBB);
354
			this.generateEntranceArchs(level, random, chunkBB);
355
			this.generateEntranceWall(level, random, chunkBB);
356
			this.generateRoofPiece(level, random, chunkBB);
357
			this.generateLowerWall(level, random, chunkBB);
358
			this.generateMiddleWall(level, random, chunkBB);
359
			this.generateUpperWall(level, random, chunkBB);
360
361
			for (int pillarX = 0; pillarX < 7; pillarX++) {
362
				int pillarZ = 0;
363
364
				while (pillarZ < 7) {
365
					if (pillarZ == 0 && pillarX == 3) {
366
						pillarZ = 6;
367
					}
368
369
					int bx = pillarX * 9;
370
					int bz = pillarZ * 9;
371
372
					for (int w = 0; w < 4; w++) {
373
						for (int d = 0; d < 4; d++) {
374
							this.placeBlock(level, BASE_LIGHT, bx + w, 0, bz + d, chunkBB);
375
							this.fillColumnDown(level, BASE_LIGHT, bx + w, -1, bz + d, chunkBB);
376
						}
377
					}
378
379
					if (pillarX != 0 && pillarX != 6) {
380
						pillarZ += 6;
381
					} else {
382
						pillarZ++;
383
					}
384
				}
385
			}
386
387
			for (int i = 0; i < 5; i++) {
388
				this.generateWaterBox(level, chunkBB, -1 - i, 0 + i * 2, -1 - i, -1 - i, 23, 58 + i);
389
				this.generateWaterBox(level, chunkBB, 58 + i, 0 + i * 2, -1 - i, 58 + i, 23, 58 + i);
390
				this.generateWaterBox(level, chunkBB, 0 - i, 0 + i * 2, -1 - i, 57 + i, 23, -1 - i);
391
				this.generateWaterBox(level, chunkBB, 0 - i, 0 + i * 2, 58 + i, 57 + i, 23, 58 + i);
392
			}
393
394
			for (OceanMonumentPieces.OceanMonumentPiece child : this.childPieces) {
395
				if (child.getBoundingBox().intersects(chunkBB)) {
396
					child.postProcess(level, structureManager, generator, random, chunkBB, chunkPos, referencePos);
397
				}
398
			}
399
		}
400
401
		private void generateWing(final boolean isFlipped, final int xoff, final WorldGenLevel level, final RandomSource random, final BoundingBox chunkBB) {
402
			int sectionWidth = 24;
403
			if (this.chunkIntersects(chunkBB, xoff, 0, xoff + 23, 20)) {
404
				this.generateBox(level, chunkBB, xoff + 0, 0, 0, xoff + 24, 0, 20, BASE_GRAY, BASE_GRAY, false);
405
				this.generateWaterBox(level, chunkBB, xoff + 0, 1, 0, xoff + 24, 10, 20);
406
407
				for (int i = 0; i < 4; i++) {
408
					this.generateBox(level, chunkBB, xoff + i, i + 1, i, xoff + i, i + 1, 20, BASE_LIGHT, BASE_LIGHT, false);
409
					this.generateBox(level, chunkBB, xoff + i + 7, i + 5, i + 7, xoff + i + 7, i + 5, 20, BASE_LIGHT, BASE_LIGHT, false);
410
					this.generateBox(level, chunkBB, xoff + 17 - i, i + 5, i + 7, xoff + 17 - i, i + 5, 20, BASE_LIGHT, BASE_LIGHT, false);
411
					this.generateBox(level, chunkBB, xoff + 24 - i, i + 1, i, xoff + 24 - i, i + 1, 20, BASE_LIGHT, BASE_LIGHT, false);
412
					this.generateBox(level, chunkBB, xoff + i + 1, i + 1, i, xoff + 23 - i, i + 1, i, BASE_LIGHT, BASE_LIGHT, false);
413
					this.generateBox(level, chunkBB, xoff + i + 8, i + 5, i + 7, xoff + 16 - i, i + 5, i + 7, BASE_LIGHT, BASE_LIGHT, false);
414
				}
415
416
				this.generateBox(level, chunkBB, xoff + 4, 4, 4, xoff + 6, 4, 20, BASE_GRAY, BASE_GRAY, false);
417
				this.generateBox(level, chunkBB, xoff + 7, 4, 4, xoff + 17, 4, 6, BASE_GRAY, BASE_GRAY, false);
418
				this.generateBox(level, chunkBB, xoff + 18, 4, 4, xoff + 20, 4, 20, BASE_GRAY, BASE_GRAY, false);
419
				this.generateBox(level, chunkBB, xoff + 11, 8, 11, xoff + 13, 8, 20, BASE_GRAY, BASE_GRAY, false);
420
				this.placeBlock(level, DOT_DECO_DATA, xoff + 12, 9, 12, chunkBB);
421
				this.placeBlock(level, DOT_DECO_DATA, xoff + 12, 9, 15, chunkBB);
422
				this.placeBlock(level, DOT_DECO_DATA, xoff + 12, 9, 18, chunkBB);
423
				int leftPos = xoff + (isFlipped ? 19 : 5);
424
				int rightPos = xoff + (isFlipped ? 5 : 19);
425
426
				for (int z = 20; z >= 5; z -= 3) {
427
					this.placeBlock(level, DOT_DECO_DATA, leftPos, 5, z, chunkBB);
428
				}
429
430
				for (int z = 19; z >= 7; z -= 3) {
431
					this.placeBlock(level, DOT_DECO_DATA, rightPos, 5, z, chunkBB);
432
				}
433
434
				for (int i = 0; i < 4; i++) {
435
					int pos = isFlipped ? xoff + 24 - (17 - i * 3) : xoff + 17 - i * 3;
436
					this.placeBlock(level, DOT_DECO_DATA, pos, 5, 5, chunkBB);
437
				}
438
439
				this.placeBlock(level, DOT_DECO_DATA, rightPos, 5, 5, chunkBB);
440
				this.generateBox(level, chunkBB, xoff + 11, 1, 12, xoff + 13, 7, 12, BASE_GRAY, BASE_GRAY, false);
441
				this.generateBox(level, chunkBB, xoff + 12, 1, 11, xoff + 12, 7, 13, BASE_GRAY, BASE_GRAY, false);
442
			}
443
		}
444
445
		private void generateEntranceArchs(final WorldGenLevel level, final RandomSource random, final BoundingBox chunkBB) {
446
			if (this.chunkIntersects(chunkBB, 22, 5, 35, 17)) {
447
				this.generateWaterBox(level, chunkBB, 25, 0, 0, 32, 8, 20);
448
449
				for (int i = 0; i < 4; i++) {
450
					this.generateBox(level, chunkBB, 24, 2, 5 + i * 4, 24, 4, 5 + i * 4, BASE_LIGHT, BASE_LIGHT, false);
451
					this.generateBox(level, chunkBB, 22, 4, 5 + i * 4, 23, 4, 5 + i * 4, BASE_LIGHT, BASE_LIGHT, false);
452
					this.placeBlock(level, BASE_LIGHT, 25, 5, 5 + i * 4, chunkBB);
453
					this.placeBlock(level, BASE_LIGHT, 26, 6, 5 + i * 4, chunkBB);
454
					this.placeBlock(level, LAMP_BLOCK, 26, 5, 5 + i * 4, chunkBB);
455
					this.generateBox(level, chunkBB, 33, 2, 5 + i * 4, 33, 4, 5 + i * 4, BASE_LIGHT, BASE_LIGHT, false);
456
					this.generateBox(level, chunkBB, 34, 4, 5 + i * 4, 35, 4, 5 + i * 4, BASE_LIGHT, BASE_LIGHT, false);
457
					this.placeBlock(level, BASE_LIGHT, 32, 5, 5 + i * 4, chunkBB);
458
					this.placeBlock(level, BASE_LIGHT, 31, 6, 5 + i * 4, chunkBB);
459
					this.placeBlock(level, LAMP_BLOCK, 31, 5, 5 + i * 4, chunkBB);
460
					this.generateBox(level, chunkBB, 27, 6, 5 + i * 4, 30, 6, 5 + i * 4, BASE_GRAY, BASE_GRAY, false);
461
				}
462
			}
463
		}
464
465
		private void generateEntranceWall(final WorldGenLevel level, final RandomSource random, final BoundingBox chunkBB) {
466
			if (this.chunkIntersects(chunkBB, 15, 20, 42, 21)) {
467
				this.generateBox(level, chunkBB, 15, 0, 21, 42, 0, 21, BASE_GRAY, BASE_GRAY, false);
468
				this.generateWaterBox(level, chunkBB, 26, 1, 21, 31, 3, 21);
469
				this.generateBox(level, chunkBB, 21, 12, 21, 36, 12, 21, BASE_GRAY, BASE_GRAY, false);
470
				this.generateBox(level, chunkBB, 17, 11, 21, 40, 11, 21, BASE_GRAY, BASE_GRAY, false);
471
				this.generateBox(level, chunkBB, 16, 10, 21, 41, 10, 21, BASE_GRAY, BASE_GRAY, false);
472
				this.generateBox(level, chunkBB, 15, 7, 21, 42, 9, 21, BASE_GRAY, BASE_GRAY, false);
473
				this.generateBox(level, chunkBB, 16, 6, 21, 41, 6, 21, BASE_GRAY, BASE_GRAY, false);
474
				this.generateBox(level, chunkBB, 17, 5, 21, 40, 5, 21, BASE_GRAY, BASE_GRAY, false);
475
				this.generateBox(level, chunkBB, 21, 4, 21, 36, 4, 21, BASE_GRAY, BASE_GRAY, false);
476
				this.generateBox(level, chunkBB, 22, 3, 21, 26, 3, 21, BASE_GRAY, BASE_GRAY, false);
477
				this.generateBox(level, chunkBB, 31, 3, 21, 35, 3, 21, BASE_GRAY, BASE_GRAY, false);
478
				this.generateBox(level, chunkBB, 23, 2, 21, 25, 2, 21, BASE_GRAY, BASE_GRAY, false);
479
				this.generateBox(level, chunkBB, 32, 2, 21, 34, 2, 21, BASE_GRAY, BASE_GRAY, false);
480
				this.generateBox(level, chunkBB, 28, 4, 20, 29, 4, 21, BASE_LIGHT, BASE_LIGHT, false);
481
				this.placeBlock(level, BASE_LIGHT, 27, 3, 21, chunkBB);
482
				this.placeBlock(level, BASE_LIGHT, 30, 3, 21, chunkBB);
483
				this.placeBlock(level, BASE_LIGHT, 26, 2, 21, chunkBB);
484
				this.placeBlock(level, BASE_LIGHT, 31, 2, 21, chunkBB);
485
				this.placeBlock(level, BASE_LIGHT, 25, 1, 21, chunkBB);
486
				this.placeBlock(level, BASE_LIGHT, 32, 1, 21, chunkBB);
487
488
				for (int i = 0; i < 7; i++) {
489
					this.placeBlock(level, BASE_BLACK, 28 - i, 6 + i, 21, chunkBB);
490
					this.placeBlock(level, BASE_BLACK, 29 + i, 6 + i, 21, chunkBB);
491
				}
492
493
				for (int i = 0; i < 4; i++) {
494
					this.placeBlock(level, BASE_BLACK, 28 - i, 9 + i, 21, chunkBB);
495
					this.placeBlock(level, BASE_BLACK, 29 + i, 9 + i, 21, chunkBB);
496
				}
497
498
				this.placeBlock(level, BASE_BLACK, 28, 12, 21, chunkBB);
499
				this.placeBlock(level, BASE_BLACK, 29, 12, 21, chunkBB);
500
501
				for (int i = 0; i < 3; i++) {
502
					this.placeBlock(level, BASE_BLACK, 22 - i * 2, 8, 21, chunkBB);
503
					this.placeBlock(level, BASE_BLACK, 22 - i * 2, 9, 21, chunkBB);
504
					this.placeBlock(level, BASE_BLACK, 35 + i * 2, 8, 21, chunkBB);
505
					this.placeBlock(level, BASE_BLACK, 35 + i * 2, 9, 21, chunkBB);
506
				}
507
508
				this.generateWaterBox(level, chunkBB, 15, 13, 21, 42, 15, 21);
509
				this.generateWaterBox(level, chunkBB, 15, 1, 21, 15, 6, 21);
510
				this.generateWaterBox(level, chunkBB, 16, 1, 21, 16, 5, 21);
511
				this.generateWaterBox(level, chunkBB, 17, 1, 21, 20, 4, 21);
512
				this.generateWaterBox(level, chunkBB, 21, 1, 21, 21, 3, 21);
513
				this.generateWaterBox(level, chunkBB, 22, 1, 21, 22, 2, 21);
514
				this.generateWaterBox(level, chunkBB, 23, 1, 21, 24, 1, 21);
515
				this.generateWaterBox(level, chunkBB, 42, 1, 21, 42, 6, 21);
516
				this.generateWaterBox(level, chunkBB, 41, 1, 21, 41, 5, 21);
517
				this.generateWaterBox(level, chunkBB, 37, 1, 21, 40, 4, 21);
518
				this.generateWaterBox(level, chunkBB, 36, 1, 21, 36, 3, 21);
519
				this.generateWaterBox(level, chunkBB, 33, 1, 21, 34, 1, 21);
520
				this.generateWaterBox(level, chunkBB, 35, 1, 21, 35, 2, 21);
521
			}
522
		}
523
524
		private void generateRoofPiece(final WorldGenLevel level, final RandomSource random, final BoundingBox chunkBB) {
525
			if (this.chunkIntersects(chunkBB, 21, 21, 36, 36)) {
526
				this.generateBox(level, chunkBB, 21, 0, 22, 36, 0, 36, BASE_GRAY, BASE_GRAY, false);
527
				this.generateWaterBox(level, chunkBB, 21, 1, 22, 36, 23, 36);
528
529
				for (int i = 0; i < 4; i++) {
530
					this.generateBox(level, chunkBB, 21 + i, 13 + i, 21 + i, 36 - i, 13 + i, 21 + i, BASE_LIGHT, BASE_LIGHT, false);
531
					this.generateBox(level, chunkBB, 21 + i, 13 + i, 36 - i, 36 - i, 13 + i, 36 - i, BASE_LIGHT, BASE_LIGHT, false);
532
					this.generateBox(level, chunkBB, 21 + i, 13 + i, 22 + i, 21 + i, 13 + i, 35 - i, BASE_LIGHT, BASE_LIGHT, false);
533
					this.generateBox(level, chunkBB, 36 - i, 13 + i, 22 + i, 36 - i, 13 + i, 35 - i, BASE_LIGHT, BASE_LIGHT, false);
534
				}
535
536
				this.generateBox(level, chunkBB, 25, 16, 25, 32, 16, 32, BASE_GRAY, BASE_GRAY, false);
537
				this.generateBox(level, chunkBB, 25, 17, 25, 25, 19, 25, BASE_LIGHT, BASE_LIGHT, false);
538
				this.generateBox(level, chunkBB, 32, 17, 25, 32, 19, 25, BASE_LIGHT, BASE_LIGHT, false);
539
				this.generateBox(level, chunkBB, 25, 17, 32, 25, 19, 32, BASE_LIGHT, BASE_LIGHT, false);
540
				this.generateBox(level, chunkBB, 32, 17, 32, 32, 19, 32, BASE_LIGHT, BASE_LIGHT, false);
541
				this.placeBlock(level, BASE_LIGHT, 26, 20, 26, chunkBB);
542
				this.placeBlock(level, BASE_LIGHT, 27, 21, 27, chunkBB);
543
				this.placeBlock(level, LAMP_BLOCK, 27, 20, 27, chunkBB);
544
				this.placeBlock(level, BASE_LIGHT, 26, 20, 31, chunkBB);
545
				this.placeBlock(level, BASE_LIGHT, 27, 21, 30, chunkBB);
546
				this.placeBlock(level, LAMP_BLOCK, 27, 20, 30, chunkBB);
547
				this.placeBlock(level, BASE_LIGHT, 31, 20, 31, chunkBB);
548
				this.placeBlock(level, BASE_LIGHT, 30, 21, 30, chunkBB);
549
				this.placeBlock(level, LAMP_BLOCK, 30, 20, 30, chunkBB);
550
				this.placeBlock(level, BASE_LIGHT, 31, 20, 26, chunkBB);
551
				this.placeBlock(level, BASE_LIGHT, 30, 21, 27, chunkBB);
552
				this.placeBlock(level, LAMP_BLOCK, 30, 20, 27, chunkBB);
553
				this.generateBox(level, chunkBB, 28, 21, 27, 29, 21, 27, BASE_GRAY, BASE_GRAY, false);
554
				this.generateBox(level, chunkBB, 27, 21, 28, 27, 21, 29, BASE_GRAY, BASE_GRAY, false);
555
				this.generateBox(level, chunkBB, 28, 21, 30, 29, 21, 30, BASE_GRAY, BASE_GRAY, false);
556
				this.generateBox(level, chunkBB, 30, 21, 28, 30, 21, 29, BASE_GRAY, BASE_GRAY, false);
557
			}
558
		}
559
560
		private void generateLowerWall(final WorldGenLevel level, final RandomSource random, final BoundingBox chunkBB) {
561
			if (this.chunkIntersects(chunkBB, 0, 21, 6, 58)) {
562
				this.generateBox(level, chunkBB, 0, 0, 21, 6, 0, 57, BASE_GRAY, BASE_GRAY, false);
563
				this.generateWaterBox(level, chunkBB, 0, 1, 21, 6, 7, 57);
564
				this.generateBox(level, chunkBB, 4, 4, 21, 6, 4, 53, BASE_GRAY, BASE_GRAY, false);
565
566
				for (int i = 0; i < 4; i++) {
567
					this.generateBox(level, chunkBB, i, i + 1, 21, i, i + 1, 57 - i, BASE_LIGHT, BASE_LIGHT, false);
568
				}
569
570
				for (int z = 23; z < 53; z += 3) {
571
					this.placeBlock(level, DOT_DECO_DATA, 5, 5, z, chunkBB);
572
				}
573
574
				this.placeBlock(level, DOT_DECO_DATA, 5, 5, 52, chunkBB);
575
576
				for (int i = 0; i < 4; i++) {
577
					this.generateBox(level, chunkBB, i, i + 1, 21, i, i + 1, 57 - i, BASE_LIGHT, BASE_LIGHT, false);
578
				}
579
580
				this.generateBox(level, chunkBB, 4, 1, 52, 6, 3, 52, BASE_GRAY, BASE_GRAY, false);
581
				this.generateBox(level, chunkBB, 5, 1, 51, 5, 3, 53, BASE_GRAY, BASE_GRAY, false);
582
			}
583
584
			if (this.chunkIntersects(chunkBB, 51, 21, 58, 58)) {
585
				this.generateBox(level, chunkBB, 51, 0, 21, 57, 0, 57, BASE_GRAY, BASE_GRAY, false);
586
				this.generateWaterBox(level, chunkBB, 51, 1, 21, 57, 7, 57);
587
				this.generateBox(level, chunkBB, 51, 4, 21, 53, 4, 53, BASE_GRAY, BASE_GRAY, false);
588
589
				for (int i = 0; i < 4; i++) {
590
					this.generateBox(level, chunkBB, 57 - i, i + 1, 21, 57 - i, i + 1, 57 - i, BASE_LIGHT, BASE_LIGHT, false);
591
				}
592
593
				for (int z = 23; z < 53; z += 3) {
594
					this.placeBlock(level, DOT_DECO_DATA, 52, 5, z, chunkBB);
595
				}
596
597
				this.placeBlock(level, DOT_DECO_DATA, 52, 5, 52, chunkBB);
598
				this.generateBox(level, chunkBB, 51, 1, 52, 53, 3, 52, BASE_GRAY, BASE_GRAY, false);
599
				this.generateBox(level, chunkBB, 52, 1, 51, 52, 3, 53, BASE_GRAY, BASE_GRAY, false);
600
			}
601
602
			if (this.chunkIntersects(chunkBB, 0, 51, 57, 57)) {
603
				this.generateBox(level, chunkBB, 7, 0, 51, 50, 0, 57, BASE_GRAY, BASE_GRAY, false);
604
				this.generateWaterBox(level, chunkBB, 7, 1, 51, 50, 10, 57);
605
606
				for (int i = 0; i < 4; i++) {
607
					this.generateBox(level, chunkBB, i + 1, i + 1, 57 - i, 56 - i, i + 1, 57 - i, BASE_LIGHT, BASE_LIGHT, false);
608
				}
609
			}
610
		}
611
612
		private void generateMiddleWall(final WorldGenLevel level, final RandomSource random, final BoundingBox chunkBB) {
613
			if (this.chunkIntersects(chunkBB, 7, 21, 13, 50)) {
614
				this.generateBox(level, chunkBB, 7, 0, 21, 13, 0, 50, BASE_GRAY, BASE_GRAY, false);
615
				this.generateWaterBox(level, chunkBB, 7, 1, 21, 13, 10, 50);
616
				this.generateBox(level, chunkBB, 11, 8, 21, 13, 8, 53, BASE_GRAY, BASE_GRAY, false);
617
618
				for (int i = 0; i < 4; i++) {
619
					this.generateBox(level, chunkBB, i + 7, i + 5, 21, i + 7, i + 5, 54, BASE_LIGHT, BASE_LIGHT, false);
620
				}
621
622
				for (int z = 21; z <= 45; z += 3) {
623
					this.placeBlock(level, DOT_DECO_DATA, 12, 9, z, chunkBB);
624
				}
625
			}
626
627
			if (this.chunkIntersects(chunkBB, 44, 21, 50, 54)) {
628
				this.generateBox(level, chunkBB, 44, 0, 21, 50, 0, 50, BASE_GRAY, BASE_GRAY, false);
629
				this.generateWaterBox(level, chunkBB, 44, 1, 21, 50, 10, 50);
630
				this.generateBox(level, chunkBB, 44, 8, 21, 46, 8, 53, BASE_GRAY, BASE_GRAY, false);
631
632
				for (int i = 0; i < 4; i++) {
633
					this.generateBox(level, chunkBB, 50 - i, i + 5, 21, 50 - i, i + 5, 54, BASE_LIGHT, BASE_LIGHT, false);
634
				}
635
636
				for (int z = 21; z <= 45; z += 3) {
637
					this.placeBlock(level, DOT_DECO_DATA, 45, 9, z, chunkBB);
638
				}
639
			}
640
641
			if (this.chunkIntersects(chunkBB, 8, 44, 49, 54)) {
642
				this.generateBox(level, chunkBB, 14, 0, 44, 43, 0, 50, BASE_GRAY, BASE_GRAY, false);
643
				this.generateWaterBox(level, chunkBB, 14, 1, 44, 43, 10, 50);
644
645
				for (int x = 12; x <= 45; x += 3) {
646
					this.placeBlock(level, DOT_DECO_DATA, x, 9, 45, chunkBB);
647
					this.placeBlock(level, DOT_DECO_DATA, x, 9, 52, chunkBB);
648
					if (x == 12 || x == 18 || x == 24 || x == 33 || x == 39 || x == 45) {
649
						this.placeBlock(level, DOT_DECO_DATA, x, 9, 47, chunkBB);
650
						this.placeBlock(level, DOT_DECO_DATA, x, 9, 50, chunkBB);
651
						this.placeBlock(level, DOT_DECO_DATA, x, 10, 45, chunkBB);
652
						this.placeBlock(level, DOT_DECO_DATA, x, 10, 46, chunkBB);
653
						this.placeBlock(level, DOT_DECO_DATA, x, 10, 51, chunkBB);
654
						this.placeBlock(level, DOT_DECO_DATA, x, 10, 52, chunkBB);
655
						this.placeBlock(level, DOT_DECO_DATA, x, 11, 47, chunkBB);
656
						this.placeBlock(level, DOT_DECO_DATA, x, 11, 50, chunkBB);
657
						this.placeBlock(level, DOT_DECO_DATA, x, 12, 48, chunkBB);
658
						this.placeBlock(level, DOT_DECO_DATA, x, 12, 49, chunkBB);
659
					}
660
				}
661
662
				for (int i = 0; i < 3; i++) {
663
					this.generateBox(level, chunkBB, 8 + i, 5 + i, 54, 49 - i, 5 + i, 54, BASE_GRAY, BASE_GRAY, false);
664
				}
665
666
				this.generateBox(level, chunkBB, 11, 8, 54, 46, 8, 54, BASE_LIGHT, BASE_LIGHT, false);
667
				this.generateBox(level, chunkBB, 14, 8, 44, 43, 8, 53, BASE_GRAY, BASE_GRAY, false);
668
			}
669
		}
670
671
		private void generateUpperWall(final WorldGenLevel level, final RandomSource random, final BoundingBox chunkBB) {
672
			if (this.chunkIntersects(chunkBB, 14, 21, 20, 43)) {
673
				this.generateBox(level, chunkBB, 14, 0, 21, 20, 0, 43, BASE_GRAY, BASE_GRAY, false);
674
				this.generateWaterBox(level, chunkBB, 14, 1, 22, 20, 14, 43);
675
				this.generateBox(level, chunkBB, 18, 12, 22, 20, 12, 39, BASE_GRAY, BASE_GRAY, false);
676
				this.generateBox(level, chunkBB, 18, 12, 21, 20, 12, 21, BASE_LIGHT, BASE_LIGHT, false);
677
678
				for (int i = 0; i < 4; i++) {
679
					this.generateBox(level, chunkBB, i + 14, i + 9, 21, i + 14, i + 9, 43 - i, BASE_LIGHT, BASE_LIGHT, false);
680
				}
681
682
				for (int z = 23; z <= 39; z += 3) {
683
					this.placeBlock(level, DOT_DECO_DATA, 19, 13, z, chunkBB);
684
				}
685
			}
686
687
			if (this.chunkIntersects(chunkBB, 37, 21, 43, 43)) {
688
				this.generateBox(level, chunkBB, 37, 0, 21, 43, 0, 43, BASE_GRAY, BASE_GRAY, false);
689
				this.generateWaterBox(level, chunkBB, 37, 1, 22, 43, 14, 43);
690
				this.generateBox(level, chunkBB, 37, 12, 22, 39, 12, 39, BASE_GRAY, BASE_GRAY, false);
691
				this.generateBox(level, chunkBB, 37, 12, 21, 39, 12, 21, BASE_LIGHT, BASE_LIGHT, false);
692
693
				for (int i = 0; i < 4; i++) {
694
					this.generateBox(level, chunkBB, 43 - i, i + 9, 21, 43 - i, i + 9, 43 - i, BASE_LIGHT, BASE_LIGHT, false);
695
				}
696
697
				for (int z = 23; z <= 39; z += 3) {
698
					this.placeBlock(level, DOT_DECO_DATA, 38, 13, z, chunkBB);
699
				}
700
			}
701
702
			if (this.chunkIntersects(chunkBB, 15, 37, 42, 43)) {
703
				this.generateBox(level, chunkBB, 21, 0, 37, 36, 0, 43, BASE_GRAY, BASE_GRAY, false);
704
				this.generateWaterBox(level, chunkBB, 21, 1, 37, 36, 14, 43);
705
				this.generateBox(level, chunkBB, 21, 12, 37, 36, 12, 39, BASE_GRAY, BASE_GRAY, false);
706
707
				for (int i = 0; i < 4; i++) {
708
					this.generateBox(level, chunkBB, 15 + i, i + 9, 43 - i, 42 - i, i + 9, 43 - i, BASE_LIGHT, BASE_LIGHT, false);
709
				}
710
711
				for (int x = 21; x <= 36; x += 3) {
712
					this.placeBlock(level, DOT_DECO_DATA, x, 13, 38, chunkBB);
713
				}
714
			}
715
		}
716
	}
717
718
	private interface MonumentRoomFitter {
719
		boolean fits(OceanMonumentPieces.RoomDefinition definition);
720
721
		OceanMonumentPieces.OceanMonumentPiece create(Direction orientation, OceanMonumentPieces.RoomDefinition definition, RandomSource random);
722
	}
723
724
	public static class OceanMonumentCoreRoom extends OceanMonumentPieces.OceanMonumentPiece {
725
		public OceanMonumentCoreRoom(final Direction orientation, final OceanMonumentPieces.RoomDefinition definition) {
726
			super(StructurePieceType.OCEAN_MONUMENT_CORE_ROOM, 1, orientation, definition, 2, 2, 2);
727
		}
728
729
		public OceanMonumentCoreRoom(final CompoundTag tag) {
730
			super(StructurePieceType.OCEAN_MONUMENT_CORE_ROOM, tag);
731
		}
732
733
		@Override
734
		public void postProcess(
735
			final WorldGenLevel level,
736
			final StructureManager structureManager,
737
			final ChunkGenerator generator,
738
			final RandomSource random,
739
			final BoundingBox chunkBB,
740
			final ChunkPos chunkPos,
741
			final BlockPos referencePos
742
		) {
743
			this.generateBoxOnFillOnly(level, chunkBB, 1, 8, 0, 14, 8, 14, BASE_GRAY);
744
			int y = 7;
745
			BlockState block = BASE_LIGHT;
746
			this.generateBox(level, chunkBB, 0, 7, 0, 0, 7, 15, block, block, false);
747
			this.generateBox(level, chunkBB, 15, 7, 0, 15, 7, 15, block, block, false);
748
			this.generateBox(level, chunkBB, 1, 7, 0, 15, 7, 0, block, block, false);
749
			this.generateBox(level, chunkBB, 1, 7, 15, 14, 7, 15, block, block, false);
750
751
			for (int yx = 1; yx <= 6; yx++) {
752
				block = BASE_LIGHT;
753
				if (yx == 2 || yx == 6) {
754
					block = BASE_GRAY;
755
				}
756
757
				for (int x = 0; x <= 15; x += 15) {
758
					this.generateBox(level, chunkBB, x, yx, 0, x, yx, 1, block, block, false);
759
					this.generateBox(level, chunkBB, x, yx, 6, x, yx, 9, block, block, false);
760
					this.generateBox(level, chunkBB, x, yx, 14, x, yx, 15, block, block, false);
761
				}
762
763
				this.generateBox(level, chunkBB, 1, yx, 0, 1, yx, 0, block, block, false);
764
				this.generateBox(level, chunkBB, 6, yx, 0, 9, yx, 0, block, block, false);
765
				this.generateBox(level, chunkBB, 14, yx, 0, 14, yx, 0, block, block, false);
766
				this.generateBox(level, chunkBB, 1, yx, 15, 14, yx, 15, block, block, false);
767
			}
768
769
			this.generateBox(level, chunkBB, 6, 3, 6, 9, 6, 9, BASE_BLACK, BASE_BLACK, false);
770
			this.generateBox(level, chunkBB, 7, 4, 7, 8, 5, 8, Blocks.GOLD_BLOCK.defaultBlockState(), Blocks.GOLD_BLOCK.defaultBlockState(), false);
771
772
			for (int yx = 3; yx <= 6; yx += 3) {
773
				for (int x = 6; x <= 9; x += 3) {
774
					this.placeBlock(level, LAMP_BLOCK, x, yx, 6, chunkBB);
775
					this.placeBlock(level, LAMP_BLOCK, x, yx, 9, chunkBB);
776
				}
777
			}
778
779
			this.generateBox(level, chunkBB, 5, 1, 6, 5, 2, 6, BASE_LIGHT, BASE_LIGHT, false);
780
			this.generateBox(level, chunkBB, 5, 1, 9, 5, 2, 9, BASE_LIGHT, BASE_LIGHT, false);
781
			this.generateBox(level, chunkBB, 10, 1, 6, 10, 2, 6, BASE_LIGHT, BASE_LIGHT, false);
782
			this.generateBox(level, chunkBB, 10, 1, 9, 10, 2, 9, BASE_LIGHT, BASE_LIGHT, false);
783
			this.generateBox(level, chunkBB, 6, 1, 5, 6, 2, 5, BASE_LIGHT, BASE_LIGHT, false);
784
			this.generateBox(level, chunkBB, 9, 1, 5, 9, 2, 5, BASE_LIGHT, BASE_LIGHT, false);
785
			this.generateBox(level, chunkBB, 6, 1, 10, 6, 2, 10, BASE_LIGHT, BASE_LIGHT, false);
786
			this.generateBox(level, chunkBB, 9, 1, 10, 9, 2, 10, BASE_LIGHT, BASE_LIGHT, false);
787
			this.generateBox(level, chunkBB, 5, 2, 5, 5, 6, 5, BASE_LIGHT, BASE_LIGHT, false);
788
			this.generateBox(level, chunkBB, 5, 2, 10, 5, 6, 10, BASE_LIGHT, BASE_LIGHT, false);
789
			this.generateBox(level, chunkBB, 10, 2, 5, 10, 6, 5, BASE_LIGHT, BASE_LIGHT, false);
790
			this.generateBox(level, chunkBB, 10, 2, 10, 10, 6, 10, BASE_LIGHT, BASE_LIGHT, false);
791
			this.generateBox(level, chunkBB, 5, 7, 1, 5, 7, 6, BASE_LIGHT, BASE_LIGHT, false);
792
			this.generateBox(level, chunkBB, 10, 7, 1, 10, 7, 6, BASE_LIGHT, BASE_LIGHT, false);
793
			this.generateBox(level, chunkBB, 5, 7, 9, 5, 7, 14, BASE_LIGHT, BASE_LIGHT, false);
794
			this.generateBox(level, chunkBB, 10, 7, 9, 10, 7, 14, BASE_LIGHT, BASE_LIGHT, false);
795
			this.generateBox(level, chunkBB, 1, 7, 5, 6, 7, 5, BASE_LIGHT, BASE_LIGHT, false);
796
			this.generateBox(level, chunkBB, 1, 7, 10, 6, 7, 10, BASE_LIGHT, BASE_LIGHT, false);
797
			this.generateBox(level, chunkBB, 9, 7, 5, 14, 7, 5, BASE_LIGHT, BASE_LIGHT, false);
798
			this.generateBox(level, chunkBB, 9, 7, 10, 14, 7, 10, BASE_LIGHT, BASE_LIGHT, false);
799
			this.generateBox(level, chunkBB, 2, 1, 2, 2, 1, 3, BASE_LIGHT, BASE_LIGHT, false);
800
			this.generateBox(level, chunkBB, 3, 1, 2, 3, 1, 2, BASE_LIGHT, BASE_LIGHT, false);
801
			this.generateBox(level, chunkBB, 13, 1, 2, 13, 1, 3, BASE_LIGHT, BASE_LIGHT, false);
802
			this.generateBox(level, chunkBB, 12, 1, 2, 12, 1, 2, BASE_LIGHT, BASE_LIGHT, false);
803
			this.generateBox(level, chunkBB, 2, 1, 12, 2, 1, 13, BASE_LIGHT, BASE_LIGHT, false);
804
			this.generateBox(level, chunkBB, 3, 1, 13, 3, 1, 13, BASE_LIGHT, BASE_LIGHT, false);
805
			this.generateBox(level, chunkBB, 13, 1, 12, 13, 1, 13, BASE_LIGHT, BASE_LIGHT, false);
806
			this.generateBox(level, chunkBB, 12, 1, 13, 12, 1, 13, BASE_LIGHT, BASE_LIGHT, false);
807
		}
808
	}
809
810
	public static class OceanMonumentDoubleXRoom extends OceanMonumentPieces.OceanMonumentPiece {
811
		public OceanMonumentDoubleXRoom(final Direction orientation, final OceanMonumentPieces.RoomDefinition definition) {
812
			super(StructurePieceType.OCEAN_MONUMENT_DOUBLE_X_ROOM, 1, orientation, definition, 2, 1, 1);
813
		}
814
815
		public OceanMonumentDoubleXRoom(final CompoundTag tag) {
816
			super(StructurePieceType.OCEAN_MONUMENT_DOUBLE_X_ROOM, tag);
817
		}
818
819
		@Override
820
		public void postProcess(
821
			final WorldGenLevel level,
822
			final StructureManager structureManager,
823
			final ChunkGenerator generator,
824
			final RandomSource random,
825
			final BoundingBox chunkBB,
826
			final ChunkPos chunkPos,
827
			final BlockPos referencePos
828
		) {
829
			OceanMonumentPieces.RoomDefinition east = this.roomDefinition.connections[Direction.EAST.get3DDataValue()];
830
			OceanMonumentPieces.RoomDefinition west = this.roomDefinition;
831
			if (this.roomDefinition.index / 25 > 0) {
832
				this.generateDefaultFloor(level, chunkBB, 8, 0, east.hasOpening[Direction.DOWN.get3DDataValue()]);
833
				this.generateDefaultFloor(level, chunkBB, 0, 0, west.hasOpening[Direction.DOWN.get3DDataValue()]);
834
			}
835
836
			if (west.connections[Direction.UP.get3DDataValue()] == null) {
837
				this.generateBoxOnFillOnly(level, chunkBB, 1, 4, 1, 7, 4, 6, BASE_GRAY);
838
			}
839
840
			if (east.connections[Direction.UP.get3DDataValue()] == null) {
841
				this.generateBoxOnFillOnly(level, chunkBB, 8, 4, 1, 14, 4, 6, BASE_GRAY);
842
			}
843
844
			this.generateBox(level, chunkBB, 0, 3, 0, 0, 3, 7, BASE_LIGHT, BASE_LIGHT, false);
845
			this.generateBox(level, chunkBB, 15, 3, 0, 15, 3, 7, BASE_LIGHT, BASE_LIGHT, false);
846
			this.generateBox(level, chunkBB, 1, 3, 0, 15, 3, 0, BASE_LIGHT, BASE_LIGHT, false);
847
			this.generateBox(level, chunkBB, 1, 3, 7, 14, 3, 7, BASE_LIGHT, BASE_LIGHT, false);
848
			this.generateBox(level, chunkBB, 0, 2, 0, 0, 2, 7, BASE_GRAY, BASE_GRAY, false);
849
			this.generateBox(level, chunkBB, 15, 2, 0, 15, 2, 7, BASE_GRAY, BASE_GRAY, false);
850
			this.generateBox(level, chunkBB, 1, 2, 0, 15, 2, 0, BASE_GRAY, BASE_GRAY, false);
851
			this.generateBox(level, chunkBB, 1, 2, 7, 14, 2, 7, BASE_GRAY, BASE_GRAY, false);
852
			this.generateBox(level, chunkBB, 0, 1, 0, 0, 1, 7, BASE_LIGHT, BASE_LIGHT, false);
853
			this.generateBox(level, chunkBB, 15, 1, 0, 15, 1, 7, BASE_LIGHT, BASE_LIGHT, false);
854
			this.generateBox(level, chunkBB, 1, 1, 0, 15, 1, 0, BASE_LIGHT, BASE_LIGHT, false);
855
			this.generateBox(level, chunkBB, 1, 1, 7, 14, 1, 7, BASE_LIGHT, BASE_LIGHT, false);
856
			this.generateBox(level, chunkBB, 5, 1, 0, 10, 1, 4, BASE_LIGHT, BASE_LIGHT, false);
857
			this.generateBox(level, chunkBB, 6, 2, 0, 9, 2, 3, BASE_GRAY, BASE_GRAY, false);
858
			this.generateBox(level, chunkBB, 5, 3, 0, 10, 3, 4, BASE_LIGHT, BASE_LIGHT, false);
859
			this.placeBlock(level, LAMP_BLOCK, 6, 2, 3, chunkBB);
860
			this.placeBlock(level, LAMP_BLOCK, 9, 2, 3, chunkBB);
861
			if (west.hasOpening[Direction.SOUTH.get3DDataValue()]) {
862
				this.generateWaterBox(level, chunkBB, 3, 1, 0, 4, 2, 0);
863
			}
864
865
			if (west.hasOpening[Direction.NORTH.get3DDataValue()]) {
866
				this.generateWaterBox(level, chunkBB, 3, 1, 7, 4, 2, 7);
867
			}
868
869
			if (west.hasOpening[Direction.WEST.get3DDataValue()]) {
870
				this.generateWaterBox(level, chunkBB, 0, 1, 3, 0, 2, 4);
871
			}
872
873
			if (east.hasOpening[Direction.SOUTH.get3DDataValue()]) {
874
				this.generateWaterBox(level, chunkBB, 11, 1, 0, 12, 2, 0);
875
			}
876
877
			if (east.hasOpening[Direction.NORTH.get3DDataValue()]) {
878
				this.generateWaterBox(level, chunkBB, 11, 1, 7, 12, 2, 7);
879
			}
880
881
			if (east.hasOpening[Direction.EAST.get3DDataValue()]) {
882
				this.generateWaterBox(level, chunkBB, 15, 1, 3, 15, 2, 4);
883
			}
884
		}
885
	}
886
887
	public static class OceanMonumentDoubleXYRoom extends OceanMonumentPieces.OceanMonumentPiece {
888
		public OceanMonumentDoubleXYRoom(final Direction orientation, final OceanMonumentPieces.RoomDefinition definition) {
889
			super(StructurePieceType.OCEAN_MONUMENT_DOUBLE_XY_ROOM, 1, orientation, definition, 2, 2, 1);
890
		}
891
892
		public OceanMonumentDoubleXYRoom(final CompoundTag tag) {
893
			super(StructurePieceType.OCEAN_MONUMENT_DOUBLE_XY_ROOM, tag);
894
		}
895
896
		@Override
897
		public void postProcess(
898
			final WorldGenLevel level,
899
			final StructureManager structureManager,
900
			final ChunkGenerator generator,
901
			final RandomSource random,
902
			final BoundingBox chunkBB,
903
			final ChunkPos chunkPos,
904
			final BlockPos referencePos
905
		) {
906
			OceanMonumentPieces.RoomDefinition east = this.roomDefinition.connections[Direction.EAST.get3DDataValue()];
907
			OceanMonumentPieces.RoomDefinition west = this.roomDefinition;
908
			OceanMonumentPieces.RoomDefinition westUp = west.connections[Direction.UP.get3DDataValue()];
909
			OceanMonumentPieces.RoomDefinition eastUp = east.connections[Direction.UP.get3DDataValue()];
910
			if (this.roomDefinition.index / 25 > 0) {
911
				this.generateDefaultFloor(level, chunkBB, 8, 0, east.hasOpening[Direction.DOWN.get3DDataValue()]);
912
				this.generateDefaultFloor(level, chunkBB, 0, 0, west.hasOpening[Direction.DOWN.get3DDataValue()]);
913
			}
914
915
			if (westUp.connections[Direction.UP.get3DDataValue()] == null) {
916
				this.generateBoxOnFillOnly(level, chunkBB, 1, 8, 1, 7, 8, 6, BASE_GRAY);
917
			}
918
919
			if (eastUp.connections[Direction.UP.get3DDataValue()] == null) {
920
				this.generateBoxOnFillOnly(level, chunkBB, 8, 8, 1, 14, 8, 6, BASE_GRAY);
921
			}
922
923
			for (int y = 1; y <= 7; y++) {
924
				BlockState block = BASE_LIGHT;
925
				if (y == 2 || y == 6) {
926
					block = BASE_GRAY;
927
				}
928
929
				this.generateBox(level, chunkBB, 0, y, 0, 0, y, 7, block, block, false);
930
				this.generateBox(level, chunkBB, 15, y, 0, 15, y, 7, block, block, false);
931
				this.generateBox(level, chunkBB, 1, y, 0, 15, y, 0, block, block, false);
932
				this.generateBox(level, chunkBB, 1, y, 7, 14, y, 7, block, block, false);
933
			}
934
935
			this.generateBox(level, chunkBB, 2, 1, 3, 2, 7, 4, BASE_LIGHT, BASE_LIGHT, false);
936
			this.generateBox(level, chunkBB, 3, 1, 2, 4, 7, 2, BASE_LIGHT, BASE_LIGHT, false);
937
			this.generateBox(level, chunkBB, 3, 1, 5, 4, 7, 5, BASE_LIGHT, BASE_LIGHT, false);
938
			this.generateBox(level, chunkBB, 13, 1, 3, 13, 7, 4, BASE_LIGHT, BASE_LIGHT, false);
939
			this.generateBox(level, chunkBB, 11, 1, 2, 12, 7, 2, BASE_LIGHT, BASE_LIGHT, false);
940
			this.generateBox(level, chunkBB, 11, 1, 5, 12, 7, 5, BASE_LIGHT, BASE_LIGHT, false);
941
			this.generateBox(level, chunkBB, 5, 1, 3, 5, 3, 4, BASE_LIGHT, BASE_LIGHT, false);
942
			this.generateBox(level, chunkBB, 10, 1, 3, 10, 3, 4, BASE_LIGHT, BASE_LIGHT, false);
943
			this.generateBox(level, chunkBB, 5, 7, 2, 10, 7, 5, BASE_LIGHT, BASE_LIGHT, false);
944
			this.generateBox(level, chunkBB, 5, 5, 2, 5, 7, 2, BASE_LIGHT, BASE_LIGHT, false);
945
			this.generateBox(level, chunkBB, 10, 5, 2, 10, 7, 2, BASE_LIGHT, BASE_LIGHT, false);
946
			this.generateBox(level, chunkBB, 5, 5, 5, 5, 7, 5, BASE_LIGHT, BASE_LIGHT, false);
947
			this.generateBox(level, chunkBB, 10, 5, 5, 10, 7, 5, BASE_LIGHT, BASE_LIGHT, false);
948
			this.placeBlock(level, BASE_LIGHT, 6, 6, 2, chunkBB);
949
			this.placeBlock(level, BASE_LIGHT, 9, 6, 2, chunkBB);
950
			this.placeBlock(level, BASE_LIGHT, 6, 6, 5, chunkBB);
951
			this.placeBlock(level, BASE_LIGHT, 9, 6, 5, chunkBB);
952
			this.generateBox(level, chunkBB, 5, 4, 3, 6, 4, 4, BASE_LIGHT, BASE_LIGHT, false);
953
			this.generateBox(level, chunkBB, 9, 4, 3, 10, 4, 4, BASE_LIGHT, BASE_LIGHT, false);
954
			this.placeBlock(level, LAMP_BLOCK, 5, 4, 2, chunkBB);
955
			this.placeBlock(level, LAMP_BLOCK, 5, 4, 5, chunkBB);
956
			this.placeBlock(level, LAMP_BLOCK, 10, 4, 2, chunkBB);
957
			this.placeBlock(level, LAMP_BLOCK, 10, 4, 5, chunkBB);
958
			if (west.hasOpening[Direction.SOUTH.get3DDataValue()]) {
959
				this.generateWaterBox(level, chunkBB, 3, 1, 0, 4, 2, 0);
960
			}
961
962
			if (west.hasOpening[Direction.NORTH.get3DDataValue()]) {
963
				this.generateWaterBox(level, chunkBB, 3, 1, 7, 4, 2, 7);
964
			}
965
966
			if (west.hasOpening[Direction.WEST.get3DDataValue()]) {
967
				this.generateWaterBox(level, chunkBB, 0, 1, 3, 0, 2, 4);
968
			}
969
970
			if (east.hasOpening[Direction.SOUTH.get3DDataValue()]) {
971
				this.generateWaterBox(level, chunkBB, 11, 1, 0, 12, 2, 0);
972
			}
973
974
			if (east.hasOpening[Direction.NORTH.get3DDataValue()]) {
975
				this.generateWaterBox(level, chunkBB, 11, 1, 7, 12, 2, 7);
976
			}
977
978
			if (east.hasOpening[Direction.EAST.get3DDataValue()]) {
979
				this.generateWaterBox(level, chunkBB, 15, 1, 3, 15, 2, 4);
980
			}
981
982
			if (westUp.hasOpening[Direction.SOUTH.get3DDataValue()]) {
983
				this.generateWaterBox(level, chunkBB, 3, 5, 0, 4, 6, 0);
984
			}
985
986
			if (westUp.hasOpening[Direction.NORTH.get3DDataValue()]) {
987
				this.generateWaterBox(level, chunkBB, 3, 5, 7, 4, 6, 7);
988
			}
989
990
			if (westUp.hasOpening[Direction.WEST.get3DDataValue()]) {
991
				this.generateWaterBox(level, chunkBB, 0, 5, 3, 0, 6, 4);
992
			}
993
994
			if (eastUp.hasOpening[Direction.SOUTH.get3DDataValue()]) {
995
				this.generateWaterBox(level, chunkBB, 11, 5, 0, 12, 6, 0);
996
			}
997
998
			if (eastUp.hasOpening[Direction.NORTH.get3DDataValue()]) {
999
				this.generateWaterBox(level, chunkBB, 11, 5, 7, 12, 6, 7);
1000
			}
1001
1002
			if (eastUp.hasOpening[Direction.EAST.get3DDataValue()]) {
1003
				this.generateWaterBox(level, chunkBB, 15, 5, 3, 15, 6, 4);
1004
			}
1005
		}
1006
	}
1007
1008
	public static class OceanMonumentDoubleYRoom extends OceanMonumentPieces.OceanMonumentPiece {
1009
		public OceanMonumentDoubleYRoom(final Direction orientation, final OceanMonumentPieces.RoomDefinition definition) {
1010
			super(StructurePieceType.OCEAN_MONUMENT_DOUBLE_Y_ROOM, 1, orientation, definition, 1, 2, 1);
1011
		}
1012
1013
		public OceanMonumentDoubleYRoom(final CompoundTag tag) {
1014
			super(StructurePieceType.OCEAN_MONUMENT_DOUBLE_Y_ROOM, tag);
1015
		}
1016
1017
		@Override
1018
		public void postProcess(
1019
			final WorldGenLevel level,
1020
			final StructureManager structureManager,
1021
			final ChunkGenerator generator,
1022
			final RandomSource random,
1023
			final BoundingBox chunkBB,
1024
			final ChunkPos chunkPos,
1025
			final BlockPos referencePos
1026
		) {
1027
			if (this.roomDefinition.index / 25 > 0) {
1028
				this.generateDefaultFloor(level, chunkBB, 0, 0, this.roomDefinition.hasOpening[Direction.DOWN.get3DDataValue()]);
1029
			}
1030
1031
			OceanMonumentPieces.RoomDefinition above = this.roomDefinition.connections[Direction.UP.get3DDataValue()];
1032
			if (above.connections[Direction.UP.get3DDataValue()] == null) {
1033
				this.generateBoxOnFillOnly(level, chunkBB, 1, 8, 1, 6, 8, 6, BASE_GRAY);
1034
			}
1035
1036
			this.generateBox(level, chunkBB, 0, 4, 0, 0, 4, 7, BASE_LIGHT, BASE_LIGHT, false);
1037
			this.generateBox(level, chunkBB, 7, 4, 0, 7, 4, 7, BASE_LIGHT, BASE_LIGHT, false);
1038
			this.generateBox(level, chunkBB, 1, 4, 0, 6, 4, 0, BASE_LIGHT, BASE_LIGHT, false);
1039
			this.generateBox(level, chunkBB, 1, 4, 7, 6, 4, 7, BASE_LIGHT, BASE_LIGHT, false);
1040
			this.generateBox(level, chunkBB, 2, 4, 1, 2, 4, 2, BASE_LIGHT, BASE_LIGHT, false);
1041
			this.generateBox(level, chunkBB, 1, 4, 2, 1, 4, 2, BASE_LIGHT, BASE_LIGHT, false);
1042
			this.generateBox(level, chunkBB, 5, 4, 1, 5, 4, 2, BASE_LIGHT, BASE_LIGHT, false);
1043
			this.generateBox(level, chunkBB, 6, 4, 2, 6, 4, 2, BASE_LIGHT, BASE_LIGHT, false);
1044
			this.generateBox(level, chunkBB, 2, 4, 5, 2, 4, 6, BASE_LIGHT, BASE_LIGHT, false);
1045
			this.generateBox(level, chunkBB, 1, 4, 5, 1, 4, 5, BASE_LIGHT, BASE_LIGHT, false);
1046
			this.generateBox(level, chunkBB, 5, 4, 5, 5, 4, 6, BASE_LIGHT, BASE_LIGHT, false);
1047
			this.generateBox(level, chunkBB, 6, 4, 5, 6, 4, 5, BASE_LIGHT, BASE_LIGHT, false);
1048
			OceanMonumentPieces.RoomDefinition definition = this.roomDefinition;
1049
1050
			for (int y = 1; y <= 5; y += 4) {
1051
				int z = 0;
1052
				if (definition.hasOpening[Direction.SOUTH.get3DDataValue()]) {
1053
					this.generateBox(level, chunkBB, 2, y, z, 2, y + 2, z, BASE_LIGHT, BASE_LIGHT, false);
1054
					this.generateBox(level, chunkBB, 5, y, z, 5, y + 2, z, BASE_LIGHT, BASE_LIGHT, false);
1055
					this.generateBox(level, chunkBB, 3, y + 2, z, 4, y + 2, z, BASE_LIGHT, BASE_LIGHT, false);
1056
				} else {
1057
					this.generateBox(level, chunkBB, 0, y, z, 7, y + 2, z, BASE_LIGHT, BASE_LIGHT, false);
1058
					this.generateBox(level, chunkBB, 0, y + 1, z, 7, y + 1, z, BASE_GRAY, BASE_GRAY, false);
1059
				}
1060
1061
				int var13 = 7;
1062
				if (definition.hasOpening[Direction.NORTH.get3DDataValue()]) {
1063
					this.generateBox(level, chunkBB, 2, y, var13, 2, y + 2, var13, BASE_LIGHT, BASE_LIGHT, false);
1064
					this.generateBox(level, chunkBB, 5, y, var13, 5, y + 2, var13, BASE_LIGHT, BASE_LIGHT, false);
1065
					this.generateBox(level, chunkBB, 3, y + 2, var13, 4, y + 2, var13, BASE_LIGHT, BASE_LIGHT, false);
1066
				} else {
1067
					this.generateBox(level, chunkBB, 0, y, var13, 7, y + 2, var13, BASE_LIGHT, BASE_LIGHT, false);
1068
					this.generateBox(level, chunkBB, 0, y + 1, var13, 7, y + 1, var13, BASE_GRAY, BASE_GRAY, false);
1069
				}
1070
1071
				int x = 0;
1072
				if (definition.hasOpening[Direction.WEST.get3DDataValue()]) {
1073
					this.generateBox(level, chunkBB, x, y, 2, x, y + 2, 2, BASE_LIGHT, BASE_LIGHT, false);
1074
					this.generateBox(level, chunkBB, x, y, 5, x, y + 2, 5, BASE_LIGHT, BASE_LIGHT, false);
1075
					this.generateBox(level, chunkBB, x, y + 2, 3, x, y + 2, 4, BASE_LIGHT, BASE_LIGHT, false);
1076
				} else {
1077
					this.generateBox(level, chunkBB, x, y, 0, x, y + 2, 7, BASE_LIGHT, BASE_LIGHT, false);
1078
					this.generateBox(level, chunkBB, x, y + 1, 0, x, y + 1, 7, BASE_GRAY, BASE_GRAY, false);
1079
				}
1080
1081
				int var14 = 7;
1082
				if (definition.hasOpening[Direction.EAST.get3DDataValue()]) {
1083
					this.generateBox(level, chunkBB, var14, y, 2, var14, y + 2, 2, BASE_LIGHT, BASE_LIGHT, false);
1084
					this.generateBox(level, chunkBB, var14, y, 5, var14, y + 2, 5, BASE_LIGHT, BASE_LIGHT, false);
1085
					this.generateBox(level, chunkBB, var14, y + 2, 3, var14, y + 2, 4, BASE_LIGHT, BASE_LIGHT, false);
1086
				} else {
1087
					this.generateBox(level, chunkBB, var14, y, 0, var14, y + 2, 7, BASE_LIGHT, BASE_LIGHT, false);
1088
					this.generateBox(level, chunkBB, var14, y + 1, 0, var14, y + 1, 7, BASE_GRAY, BASE_GRAY, false);
1089
				}
1090
1091
				definition = above;
1092
			}
1093
		}
1094
	}
1095
1096
	public static class OceanMonumentDoubleYZRoom extends OceanMonumentPieces.OceanMonumentPiece {
1097
		public OceanMonumentDoubleYZRoom(final Direction orientation, final OceanMonumentPieces.RoomDefinition definition) {
1098
			super(StructurePieceType.OCEAN_MONUMENT_DOUBLE_YZ_ROOM, 1, orientation, definition, 1, 2, 2);
1099
		}
1100
1101
		public OceanMonumentDoubleYZRoom(final CompoundTag tag) {
1102
			super(StructurePieceType.OCEAN_MONUMENT_DOUBLE_YZ_ROOM, tag);
1103
		}
1104
1105
		@Override
1106
		public void postProcess(
1107
			final WorldGenLevel level,
1108
			final StructureManager structureManager,
1109
			final ChunkGenerator generator,
1110
			final RandomSource random,
1111
			final BoundingBox chunkBB,
1112
			final ChunkPos chunkPos,
1113
			final BlockPos referencePos
1114
		) {
1115
			OceanMonumentPieces.RoomDefinition north = this.roomDefinition.connections[Direction.NORTH.get3DDataValue()];
1116
			OceanMonumentPieces.RoomDefinition south = this.roomDefinition;
1117
			OceanMonumentPieces.RoomDefinition northUp = north.connections[Direction.UP.get3DDataValue()];
1118
			OceanMonumentPieces.RoomDefinition southUp = south.connections[Direction.UP.get3DDataValue()];
1119
			if (this.roomDefinition.index / 25 > 0) {
1120
				this.generateDefaultFloor(level, chunkBB, 0, 8, north.hasOpening[Direction.DOWN.get3DDataValue()]);
1121
				this.generateDefaultFloor(level, chunkBB, 0, 0, south.hasOpening[Direction.DOWN.get3DDataValue()]);
1122
			}
1123
1124
			if (southUp.connections[Direction.UP.get3DDataValue()] == null) {
1125
				this.generateBoxOnFillOnly(level, chunkBB, 1, 8, 1, 6, 8, 7, BASE_GRAY);
1126
			}
1127
1128
			if (northUp.connections[Direction.UP.get3DDataValue()] == null) {
1129
				this.generateBoxOnFillOnly(level, chunkBB, 1, 8, 8, 6, 8, 14, BASE_GRAY);
1130
			}
1131
1132
			for (int y = 1; y <= 7; y++) {
1133
				BlockState block = BASE_LIGHT;
1134
				if (y == 2 || y == 6) {
1135
					block = BASE_GRAY;
1136
				}
1137
1138
				this.generateBox(level, chunkBB, 0, y, 0, 0, y, 15, block, block, false);
1139
				this.generateBox(level, chunkBB, 7, y, 0, 7, y, 15, block, block, false);
1140
				this.generateBox(level, chunkBB, 1, y, 0, 6, y, 0, block, block, false);
1141
				this.generateBox(level, chunkBB, 1, y, 15, 6, y, 15, block, block, false);
1142
			}
1143
1144
			for (int y = 1; y <= 7; y++) {
1145
				BlockState block = BASE_BLACK;
1146
				if (y == 2 || y == 6) {
1147
					block = LAMP_BLOCK;
1148
				}
1149
1150
				this.generateBox(level, chunkBB, 3, y, 7, 4, y, 8, block, block, false);
1151
			}
1152
1153
			if (south.hasOpening[Direction.SOUTH.get3DDataValue()]) {
1154
				this.generateWaterBox(level, chunkBB, 3, 1, 0, 4, 2, 0);
1155
			}
1156
1157
			if (south.hasOpening[Direction.EAST.get3DDataValue()]) {
1158
				this.generateWaterBox(level, chunkBB, 7, 1, 3, 7, 2, 4);
1159
			}
1160
1161
			if (south.hasOpening[Direction.WEST.get3DDataValue()]) {
1162
				this.generateWaterBox(level, chunkBB, 0, 1, 3, 0, 2, 4);
1163
			}
1164
1165
			if (north.hasOpening[Direction.NORTH.get3DDataValue()]) {
1166
				this.generateWaterBox(level, chunkBB, 3, 1, 15, 4, 2, 15);
1167
			}
1168
1169
			if (north.hasOpening[Direction.WEST.get3DDataValue()]) {
1170
				this.generateWaterBox(level, chunkBB, 0, 1, 11, 0, 2, 12);
1171
			}
1172
1173
			if (north.hasOpening[Direction.EAST.get3DDataValue()]) {
1174
				this.generateWaterBox(level, chunkBB, 7, 1, 11, 7, 2, 12);
1175
			}
1176
1177
			if (southUp.hasOpening[Direction.SOUTH.get3DDataValue()]) {
1178
				this.generateWaterBox(level, chunkBB, 3, 5, 0, 4, 6, 0);
1179
			}
1180
1181
			if (southUp.hasOpening[Direction.EAST.get3DDataValue()]) {
1182
				this.generateWaterBox(level, chunkBB, 7, 5, 3, 7, 6, 4);
1183
				this.generateBox(level, chunkBB, 5, 4, 2, 6, 4, 5, BASE_LIGHT, BASE_LIGHT, false);
1184
				this.generateBox(level, chunkBB, 6, 1, 2, 6, 3, 2, BASE_LIGHT, BASE_LIGHT, false);
1185
				this.generateBox(level, chunkBB, 6, 1, 5, 6, 3, 5, BASE_LIGHT, BASE_LIGHT, false);
1186
			}
1187
1188
			if (southUp.hasOpening[Direction.WEST.get3DDataValue()]) {
1189
				this.generateWaterBox(level, chunkBB, 0, 5, 3, 0, 6, 4);
1190
				this.generateBox(level, chunkBB, 1, 4, 2, 2, 4, 5, BASE_LIGHT, BASE_LIGHT, false);
1191
				this.generateBox(level, chunkBB, 1, 1, 2, 1, 3, 2, BASE_LIGHT, BASE_LIGHT, false);
1192
				this.generateBox(level, chunkBB, 1, 1, 5, 1, 3, 5, BASE_LIGHT, BASE_LIGHT, false);
1193
			}
1194
1195
			if (northUp.hasOpening[Direction.NORTH.get3DDataValue()]) {
1196
				this.generateWaterBox(level, chunkBB, 3, 5, 15, 4, 6, 15);
1197
			}
1198
1199
			if (northUp.hasOpening[Direction.WEST.get3DDataValue()]) {
1200
				this.generateWaterBox(level, chunkBB, 0, 5, 11, 0, 6, 12);
1201
				this.generateBox(level, chunkBB, 1, 4, 10, 2, 4, 13, BASE_LIGHT, BASE_LIGHT, false);
1202
				this.generateBox(level, chunkBB, 1, 1, 10, 1, 3, 10, BASE_LIGHT, BASE_LIGHT, false);
1203
				this.generateBox(level, chunkBB, 1, 1, 13, 1, 3, 13, BASE_LIGHT, BASE_LIGHT, false);
1204
			}
1205
1206
			if (northUp.hasOpening[Direction.EAST.get3DDataValue()]) {
1207
				this.generateWaterBox(level, chunkBB, 7, 5, 11, 7, 6, 12);
1208
				this.generateBox(level, chunkBB, 5, 4, 10, 6, 4, 13, BASE_LIGHT, BASE_LIGHT, false);
1209
				this.generateBox(level, chunkBB, 6, 1, 10, 6, 3, 10, BASE_LIGHT, BASE_LIGHT, false);
1210
				this.generateBox(level, chunkBB, 6, 1, 13, 6, 3, 13, BASE_LIGHT, BASE_LIGHT, false);
1211
			}
1212
		}
1213
	}
1214
1215
	public static class OceanMonumentDoubleZRoom extends OceanMonumentPieces.OceanMonumentPiece {
1216
		public OceanMonumentDoubleZRoom(final Direction orientation, final OceanMonumentPieces.RoomDefinition definition) {
1217
			super(StructurePieceType.OCEAN_MONUMENT_DOUBLE_Z_ROOM, 1, orientation, definition, 1, 1, 2);
1218
		}
1219
1220
		public OceanMonumentDoubleZRoom(final CompoundTag tag) {
1221
			super(StructurePieceType.OCEAN_MONUMENT_DOUBLE_Z_ROOM, tag);
1222
		}
1223
1224
		@Override
1225
		public void postProcess(
1226
			final WorldGenLevel level,
1227
			final StructureManager structureManager,
1228
			final ChunkGenerator generator,
1229
			final RandomSource random,
1230
			final BoundingBox chunkBB,
1231
			final ChunkPos chunkPos,
1232
			final BlockPos referencePos
1233
		) {
1234
			OceanMonumentPieces.RoomDefinition north = this.roomDefinition.connections[Direction.NORTH.get3DDataValue()];
1235
			OceanMonumentPieces.RoomDefinition south = this.roomDefinition;
1236
			if (this.roomDefinition.index / 25 > 0) {
1237
				this.generateDefaultFloor(level, chunkBB, 0, 8, north.hasOpening[Direction.DOWN.get3DDataValue()]);
1238
				this.generateDefaultFloor(level, chunkBB, 0, 0, south.hasOpening[Direction.DOWN.get3DDataValue()]);
1239
			}
1240
1241
			if (south.connections[Direction.UP.get3DDataValue()] == null) {
1242
				this.generateBoxOnFillOnly(level, chunkBB, 1, 4, 1, 6, 4, 7, BASE_GRAY);
1243
			}
1244
1245
			if (north.connections[Direction.UP.get3DDataValue()] == null) {
1246
				this.generateBoxOnFillOnly(level, chunkBB, 1, 4, 8, 6, 4, 14, BASE_GRAY);
1247
			}
1248
1249
			this.generateBox(level, chunkBB, 0, 3, 0, 0, 3, 15, BASE_LIGHT, BASE_LIGHT, false);
1250
			this.generateBox(level, chunkBB, 7, 3, 0, 7, 3, 15, BASE_LIGHT, BASE_LIGHT, false);
1251
			this.generateBox(level, chunkBB, 1, 3, 0, 7, 3, 0, BASE_LIGHT, BASE_LIGHT, false);
1252
			this.generateBox(level, chunkBB, 1, 3, 15, 6, 3, 15, BASE_LIGHT, BASE_LIGHT, false);
1253
			this.generateBox(level, chunkBB, 0, 2, 0, 0, 2, 15, BASE_GRAY, BASE_GRAY, false);
1254
			this.generateBox(level, chunkBB, 7, 2, 0, 7, 2, 15, BASE_GRAY, BASE_GRAY, false);
1255
			this.generateBox(level, chunkBB, 1, 2, 0, 7, 2, 0, BASE_GRAY, BASE_GRAY, false);
1256
			this.generateBox(level, chunkBB, 1, 2, 15, 6, 2, 15, BASE_GRAY, BASE_GRAY, false);
1257
			this.generateBox(level, chunkBB, 0, 1, 0, 0, 1, 15, BASE_LIGHT, BASE_LIGHT, false);
1258
			this.generateBox(level, chunkBB, 7, 1, 0, 7, 1, 15, BASE_LIGHT, BASE_LIGHT, false);
1259
			this.generateBox(level, chunkBB, 1, 1, 0, 7, 1, 0, BASE_LIGHT, BASE_LIGHT, false);
1260
			this.generateBox(level, chunkBB, 1, 1, 15, 6, 1, 15, BASE_LIGHT, BASE_LIGHT, false);
1261
			this.generateBox(level, chunkBB, 1, 1, 1, 1, 1, 2, BASE_LIGHT, BASE_LIGHT, false);
1262
			this.generateBox(level, chunkBB, 6, 1, 1, 6, 1, 2, BASE_LIGHT, BASE_LIGHT, false);
1263
			this.generateBox(level, chunkBB, 1, 3, 1, 1, 3, 2, BASE_LIGHT, BASE_LIGHT, false);
1264
			this.generateBox(level, chunkBB, 6, 3, 1, 6, 3, 2, BASE_LIGHT, BASE_LIGHT, false);
1265
			this.generateBox(level, chunkBB, 1, 1, 13, 1, 1, 14, BASE_LIGHT, BASE_LIGHT, false);
1266
			this.generateBox(level, chunkBB, 6, 1, 13, 6, 1, 14, BASE_LIGHT, BASE_LIGHT, false);
1267
			this.generateBox(level, chunkBB, 1, 3, 13, 1, 3, 14, BASE_LIGHT, BASE_LIGHT, false);
1268
			this.generateBox(level, chunkBB, 6, 3, 13, 6, 3, 14, BASE_LIGHT, BASE_LIGHT, false);
1269
			this.generateBox(level, chunkBB, 2, 1, 6, 2, 3, 6, BASE_LIGHT, BASE_LIGHT, false);
1270
			this.generateBox(level, chunkBB, 5, 1, 6, 5, 3, 6, BASE_LIGHT, BASE_LIGHT, false);
1271
			this.generateBox(level, chunkBB, 2, 1, 9, 2, 3, 9, BASE_LIGHT, BASE_LIGHT, false);
1272
			this.generateBox(level, chunkBB, 5, 1, 9, 5, 3, 9, BASE_LIGHT, BASE_LIGHT, false);
1273
			this.generateBox(level, chunkBB, 3, 2, 6, 4, 2, 6, BASE_LIGHT, BASE_LIGHT, false);
1274
			this.generateBox(level, chunkBB, 3, 2, 9, 4, 2, 9, BASE_LIGHT, BASE_LIGHT, false);
1275
			this.generateBox(level, chunkBB, 2, 2, 7, 2, 2, 8, BASE_LIGHT, BASE_LIGHT, false);
1276
			this.generateBox(level, chunkBB, 5, 2, 7, 5, 2, 8, BASE_LIGHT, BASE_LIGHT, false);
1277
			this.placeBlock(level, LAMP_BLOCK, 2, 2, 5, chunkBB);
1278
			this.placeBlock(level, LAMP_BLOCK, 5, 2, 5, chunkBB);
1279
			this.placeBlock(level, LAMP_BLOCK, 2, 2, 10, chunkBB);
1280
			this.placeBlock(level, LAMP_BLOCK, 5, 2, 10, chunkBB);
1281
			this.placeBlock(level, BASE_LIGHT, 2, 3, 5, chunkBB);
1282
			this.placeBlock(level, BASE_LIGHT, 5, 3, 5, chunkBB);
1283
			this.placeBlock(level, BASE_LIGHT, 2, 3, 10, chunkBB);
1284
			this.placeBlock(level, BASE_LIGHT, 5, 3, 10, chunkBB);
1285
			if (south.hasOpening[Direction.SOUTH.get3DDataValue()]) {
1286
				this.generateWaterBox(level, chunkBB, 3, 1, 0, 4, 2, 0);
1287
			}
1288
1289
			if (south.hasOpening[Direction.EAST.get3DDataValue()]) {
1290
				this.generateWaterBox(level, chunkBB, 7, 1, 3, 7, 2, 4);
1291
			}
1292
1293
			if (south.hasOpening[Direction.WEST.get3DDataValue()]) {
1294
				this.generateWaterBox(level, chunkBB, 0, 1, 3, 0, 2, 4);
1295
			}
1296
1297
			if (north.hasOpening[Direction.NORTH.get3DDataValue()]) {
1298
				this.generateWaterBox(level, chunkBB, 3, 1, 15, 4, 2, 15);
1299
			}
1300
1301
			if (north.hasOpening[Direction.WEST.get3DDataValue()]) {
1302
				this.generateWaterBox(level, chunkBB, 0, 1, 11, 0, 2, 12);
1303
			}
1304
1305
			if (north.hasOpening[Direction.EAST.get3DDataValue()]) {
1306
				this.generateWaterBox(level, chunkBB, 7, 1, 11, 7, 2, 12);
1307
			}
1308
		}
1309
	}
1310
1311
	public static class OceanMonumentEntryRoom extends OceanMonumentPieces.OceanMonumentPiece {
1312
		public OceanMonumentEntryRoom(final Direction orientation, final OceanMonumentPieces.RoomDefinition definition) {
1313
			super(StructurePieceType.OCEAN_MONUMENT_ENTRY_ROOM, 1, orientation, definition, 1, 1, 1);
1314
		}
1315
1316
		public OceanMonumentEntryRoom(final CompoundTag tag) {
1317
			super(StructurePieceType.OCEAN_MONUMENT_ENTRY_ROOM, tag);
1318
		}
1319
1320
		@Override
1321
		public void postProcess(
1322
			final WorldGenLevel level,
1323
			final StructureManager structureManager,
1324
			final ChunkGenerator generator,
1325
			final RandomSource random,
1326
			final BoundingBox chunkBB,
1327
			final ChunkPos chunkPos,
1328
			final BlockPos referencePos
1329
		) {
1330
			this.generateBox(level, chunkBB, 0, 3, 0, 2, 3, 7, BASE_LIGHT, BASE_LIGHT, false);
1331
			this.generateBox(level, chunkBB, 5, 3, 0, 7, 3, 7, BASE_LIGHT, BASE_LIGHT, false);
1332
			this.generateBox(level, chunkBB, 0, 2, 0, 1, 2, 7, BASE_LIGHT, BASE_LIGHT, false);
1333
			this.generateBox(level, chunkBB, 6, 2, 0, 7, 2, 7, BASE_LIGHT, BASE_LIGHT, false);
1334
			this.generateBox(level, chunkBB, 0, 1, 0, 0, 1, 7, BASE_LIGHT, BASE_LIGHT, false);
1335
			this.generateBox(level, chunkBB, 7, 1, 0, 7, 1, 7, BASE_LIGHT, BASE_LIGHT, false);
1336
			this.generateBox(level, chunkBB, 0, 1, 7, 7, 3, 7, BASE_LIGHT, BASE_LIGHT, false);
1337
			this.generateBox(level, chunkBB, 1, 1, 0, 2, 3, 0, BASE_LIGHT, BASE_LIGHT, false);
1338
			this.generateBox(level, chunkBB, 5, 1, 0, 6, 3, 0, BASE_LIGHT, BASE_LIGHT, false);
1339
			if (this.roomDefinition.hasOpening[Direction.NORTH.get3DDataValue()]) {
1340
				this.generateWaterBox(level, chunkBB, 3, 1, 7, 4, 2, 7);
1341
			}
1342
1343
			if (this.roomDefinition.hasOpening[Direction.WEST.get3DDataValue()]) {
1344
				this.generateWaterBox(level, chunkBB, 0, 1, 3, 1, 2, 4);
1345
			}
1346
1347
			if (this.roomDefinition.hasOpening[Direction.EAST.get3DDataValue()]) {
1348
				this.generateWaterBox(level, chunkBB, 6, 1, 3, 7, 2, 4);
1349
			}
1350
		}
1351
	}
1352
1353
	public static class OceanMonumentPenthouse extends OceanMonumentPieces.OceanMonumentPiece {
1354
		public OceanMonumentPenthouse(final Direction orientation, final BoundingBox boundingBox) {
1355
			super(StructurePieceType.OCEAN_MONUMENT_PENTHOUSE, orientation, 1, boundingBox);
1356
		}
1357
1358
		public OceanMonumentPenthouse(final CompoundTag tag) {
1359
			super(StructurePieceType.OCEAN_MONUMENT_PENTHOUSE, tag);
1360
		}
1361
1362
		@Override
1363
		public void postProcess(
1364
			final WorldGenLevel level,
1365
			final StructureManager structureManager,
1366
			final ChunkGenerator generator,
1367
			final RandomSource random,
1368
			final BoundingBox chunkBB,
1369
			final ChunkPos chunkPos,
1370
			final BlockPos referencePos
1371
		) {
1372
			this.generateBox(level, chunkBB, 2, -1, 2, 11, -1, 11, BASE_LIGHT, BASE_LIGHT, false);
1373
			this.generateBox(level, chunkBB, 0, -1, 0, 1, -1, 11, BASE_GRAY, BASE_GRAY, false);
1374
			this.generateBox(level, chunkBB, 12, -1, 0, 13, -1, 11, BASE_GRAY, BASE_GRAY, false);
1375
			this.generateBox(level, chunkBB, 2, -1, 0, 11, -1, 1, BASE_GRAY, BASE_GRAY, false);
1376
			this.generateBox(level, chunkBB, 2, -1, 12, 11, -1, 13, BASE_GRAY, BASE_GRAY, false);
1377
			this.generateBox(level, chunkBB, 0, 0, 0, 0, 0, 13, BASE_LIGHT, BASE_LIGHT, false);
1378
			this.generateBox(level, chunkBB, 13, 0, 0, 13, 0, 13, BASE_LIGHT, BASE_LIGHT, false);
1379
			this.generateBox(level, chunkBB, 1, 0, 0, 12, 0, 0, BASE_LIGHT, BASE_LIGHT, false);
1380
			this.generateBox(level, chunkBB, 1, 0, 13, 12, 0, 13, BASE_LIGHT, BASE_LIGHT, false);
1381
1382
			for (int i = 2; i <= 11; i += 3) {
1383
				this.placeBlock(level, LAMP_BLOCK, 0, 0, i, chunkBB);
1384
				this.placeBlock(level, LAMP_BLOCK, 13, 0, i, chunkBB);
1385
				this.placeBlock(level, LAMP_BLOCK, i, 0, 0, chunkBB);
1386
			}
1387
1388
			this.generateBox(level, chunkBB, 2, 0, 3, 4, 0, 9, BASE_LIGHT, BASE_LIGHT, false);
1389
			this.generateBox(level, chunkBB, 9, 0, 3, 11, 0, 9, BASE_LIGHT, BASE_LIGHT, false);
1390
			this.generateBox(level, chunkBB, 4, 0, 9, 9, 0, 11, BASE_LIGHT, BASE_LIGHT, false);
1391
			this.placeBlock(level, BASE_LIGHT, 5, 0, 8, chunkBB);
1392
			this.placeBlock(level, BASE_LIGHT, 8, 0, 8, chunkBB);
1393
			this.placeBlock(level, BASE_LIGHT, 10, 0, 10, chunkBB);
1394
			this.placeBlock(level, BASE_LIGHT, 3, 0, 10, chunkBB);
1395
			this.generateBox(level, chunkBB, 3, 0, 3, 3, 0, 7, BASE_BLACK, BASE_BLACK, false);
1396
			this.generateBox(level, chunkBB, 10, 0, 3, 10, 0, 7, BASE_BLACK, BASE_BLACK, false);
1397
			this.generateBox(level, chunkBB, 6, 0, 10, 7, 0, 10, BASE_BLACK, BASE_BLACK, false);
1398
			int x = 3;
1399
1400
			for (int i = 0; i < 2; i++) {
1401
				for (int z = 2; z <= 8; z += 3) {
1402
					this.generateBox(level, chunkBB, x, 0, z, x, 2, z, BASE_LIGHT, BASE_LIGHT, false);
1403
				}
1404
1405
				x = 10;
1406
			}
1407
1408
			this.generateBox(level, chunkBB, 5, 0, 10, 5, 2, 10, BASE_LIGHT, BASE_LIGHT, false);
1409
			this.generateBox(level, chunkBB, 8, 0, 10, 8, 2, 10, BASE_LIGHT, BASE_LIGHT, false);
1410
			this.generateBox(level, chunkBB, 6, -1, 7, 7, -1, 8, BASE_BLACK, BASE_BLACK, false);
1411
			this.generateWaterBox(level, chunkBB, 6, -1, 3, 7, -1, 4);
1412
			this.spawnElder(level, chunkBB, 6, 1, 6);
1413
		}
1414
	}
1415
1416
	protected abstract static class OceanMonumentPiece extends StructurePiece {
1417
		protected static final BlockState BASE_GRAY = Blocks.PRISMARINE.defaultBlockState();
1418
		protected static final BlockState BASE_LIGHT = Blocks.PRISMARINE_BRICKS.defaultBlockState();
1419
		protected static final BlockState BASE_BLACK = Blocks.DARK_PRISMARINE.defaultBlockState();
1420
		protected static final BlockState DOT_DECO_DATA = BASE_LIGHT;
1421
		protected static final BlockState LAMP_BLOCK = Blocks.SEA_LANTERN.defaultBlockState();
1422
		protected static final boolean DO_FILL = true;
1423
		protected static final BlockState FILL_BLOCK = Blocks.WATER.defaultBlockState();
1424
		protected static final Set<Block> FILL_KEEP = ImmutableSet.<Block>builder()
1425
			.add(Blocks.ICE)
1426
			.add(Blocks.PACKED_ICE)
1427
			.add(Blocks.BLUE_ICE)
1428
			.add(FILL_BLOCK.getBlock())
1429
			.build();
1430
		protected static final int GRIDROOM_WIDTH = 8;
1431
		protected static final int GRIDROOM_DEPTH = 8;
1432
		protected static final int GRIDROOM_HEIGHT = 4;
1433
		protected static final int GRID_WIDTH = 5;
1434
		protected static final int GRID_DEPTH = 5;
1435
		protected static final int GRID_HEIGHT = 3;
1436
		protected static final int GRID_FLOOR_COUNT = 25;
1437
		protected static final int GRID_SIZE = 75;
1438
		protected static final int GRIDROOM_SOURCE_INDEX = getRoomIndex(2, 0, 0);
1439
		protected static final int GRIDROOM_TOP_CONNECT_INDEX = getRoomIndex(2, 2, 0);
1440
		protected static final int GRIDROOM_LEFTWING_CONNECT_INDEX = getRoomIndex(0, 1, 0);
1441
		protected static final int GRIDROOM_RIGHTWING_CONNECT_INDEX = getRoomIndex(4, 1, 0);
1442
		protected static final int LEFTWING_INDEX = 1001;
1443
		protected static final int RIGHTWING_INDEX = 1002;
1444
		protected static final int PENTHOUSE_INDEX = 1003;
1445
		protected OceanMonumentPieces.RoomDefinition roomDefinition;
1446
1447
		protected static int getRoomIndex(final int roomX, final int roomY, final int roomZ) {
1448
			return roomY * 25 + roomZ * 5 + roomX;
1449
		}
1450
1451
		public OceanMonumentPiece(final StructurePieceType type, final Direction orientation, final int genDepth, final BoundingBox boundingBox) {
1452
			super(type, genDepth, boundingBox);
1453
			this.setOrientation(orientation);
1454
		}
1455
1456
		protected OceanMonumentPiece(
1457
			final StructurePieceType type,
1458
			final int genDepth,
1459
			final Direction orientation,
1460
			final OceanMonumentPieces.RoomDefinition roomDefinition,
1461
			final int roomWidth,
1462
			final int roomHeight,
1463
			final int roomDepth
1464
		) {
1465
			super(type, genDepth, makeBoundingBox(orientation, roomDefinition, roomWidth, roomHeight, roomDepth));
1466
			this.setOrientation(orientation);
1467
			this.roomDefinition = roomDefinition;
1468
		}
1469
1470
		private static BoundingBox makeBoundingBox(
1471
			final Direction orientation, final OceanMonumentPieces.RoomDefinition roomDefinition, final int roomWidth, final int roomHeight, final int roomDepth
1472
		) {
1473
			int roomIndex = roomDefinition.index;
1474
			int roomX = roomIndex % 5;
1475
			int roomZ = roomIndex / 5 % 5;
1476
			int roomY = roomIndex / 25;
1477
			BoundingBox boundingBox = makeBoundingBox(0, 0, 0, orientation, roomWidth * 8, roomHeight * 4, roomDepth * 8);
1478
			switch (orientation) {
1479
				case NORTH:
1480
					boundingBox.move(roomX * 8, roomY * 4, -(roomZ + roomDepth) * 8 + 1);
1481
					break;
1482
				case SOUTH:
1483
					boundingBox.move(roomX * 8, roomY * 4, roomZ * 8);
1484
					break;
1485
				case WEST:
1486
					boundingBox.move(-(roomZ + roomDepth) * 8 + 1, roomY * 4, roomX * 8);
1487
					break;
1488
				case EAST:
1489
				default:
1490
					boundingBox.move(roomZ * 8, roomY * 4, roomX * 8);
1491
			}
1492
1493
			return boundingBox;
1494
		}
1495
1496
		public OceanMonumentPiece(final StructurePieceType type, final CompoundTag tag) {
1497
			super(type, tag);
1498
		}
1499
1500
		@Override
1501
		protected void addAdditionalSaveData(final StructurePieceSerializationContext context, final CompoundTag tag) {
1502
		}
1503
1504
		protected void generateWaterBox(
1505
			final WorldGenLevel level, final BoundingBox chunkBB, final int x0, final int y0, final int z0, final int x1, final int y1, final int z1
1506
		) {
1507
			for (int y = y0; y <= y1; y++) {
1508
				for (int x = x0; x <= x1; x++) {
1509
					for (int z = z0; z <= z1; z++) {
1510
						BlockState block = this.getBlock(level, x, y, z, chunkBB);
1511
						if (!FILL_KEEP.contains(block.getBlock())) {
1512
							if (this.getWorldY(y) >= level.getSeaLevel() && block != FILL_BLOCK) {
1513
								this.placeBlock(level, Blocks.AIR.defaultBlockState(), x, y, z, chunkBB);
1514
							} else {
1515
								this.placeBlock(level, FILL_BLOCK, x, y, z, chunkBB);
1516
							}
1517
						}
1518
					}
1519
				}
1520
			}
1521
		}
1522
1523
		protected void generateDefaultFloor(final WorldGenLevel level, final BoundingBox chunkBB, final int xOff, final int zOff, final boolean downOpening) {
1524
			if (downOpening) {
1525
				this.generateBox(level, chunkBB, xOff + 0, 0, zOff + 0, xOff + 2, 0, zOff + 8 - 1, BASE_GRAY, BASE_GRAY, false);
1526
				this.generateBox(level, chunkBB, xOff + 5, 0, zOff + 0, xOff + 8 - 1, 0, zOff + 8 - 1, BASE_GRAY, BASE_GRAY, false);
1527
				this.generateBox(level, chunkBB, xOff + 3, 0, zOff + 0, xOff + 4, 0, zOff + 2, BASE_GRAY, BASE_GRAY, false);
1528
				this.generateBox(level, chunkBB, xOff + 3, 0, zOff + 5, xOff + 4, 0, zOff + 8 - 1, BASE_GRAY, BASE_GRAY, false);
1529
				this.generateBox(level, chunkBB, xOff + 3, 0, zOff + 2, xOff + 4, 0, zOff + 2, BASE_LIGHT, BASE_LIGHT, false);
1530
				this.generateBox(level, chunkBB, xOff + 3, 0, zOff + 5, xOff + 4, 0, zOff + 5, BASE_LIGHT, BASE_LIGHT, false);
1531
				this.generateBox(level, chunkBB, xOff + 2, 0, zOff + 3, xOff + 2, 0, zOff + 4, BASE_LIGHT, BASE_LIGHT, false);
1532
				this.generateBox(level, chunkBB, xOff + 5, 0, zOff + 3, xOff + 5, 0, zOff + 4, BASE_LIGHT, BASE_LIGHT, false);
1533
			} else {
1534
				this.generateBox(level, chunkBB, xOff + 0, 0, zOff + 0, xOff + 8 - 1, 0, zOff + 8 - 1, BASE_GRAY, BASE_GRAY, false);
1535
			}
1536
		}
1537
1538
		protected void generateBoxOnFillOnly(
1539
			final WorldGenLevel level,
1540
			final BoundingBox chunkBB,
1541
			final int x0,
1542
			final int y0,
1543
			final int z0,
1544
			final int x1,
1545
			final int y1,
1546
			final int z1,
1547
			final BlockState targetBlock
1548
		) {
1549
			for (int y = y0; y <= y1; y++) {
1550
				for (int x = x0; x <= x1; x++) {
1551
					for (int z = z0; z <= z1; z++) {
1552
						if (this.getBlock(level, x, y, z, chunkBB) == FILL_BLOCK) {
1553
							this.placeBlock(level, targetBlock, x, y, z, chunkBB);
1554
						}
1555
					}
1556
				}
1557
			}
1558
		}
1559
1560
		protected boolean chunkIntersects(final BoundingBox chunkBB, final int x0, final int z0, final int x1, final int z1) {
1561
			int wx0 = this.getWorldX(x0, z0);
1562
			int wz0 = this.getWorldZ(x0, z0);
1563
			int wx1 = this.getWorldX(x1, z1);
1564
			int wz1 = this.getWorldZ(x1, z1);
1565
			return chunkBB.intersects(Math.min(wx0, wx1), Math.min(wz0, wz1), Math.max(wx0, wx1), Math.max(wz0, wz1));
1566
		}
1567
1568
		protected void spawnElder(final WorldGenLevel level, final BoundingBox chunkBB, final int x, final int y, final int z) {
1569
			BlockPos pos = this.getWorldPos(x, y, z);
1570
			if (chunkBB.isInside(pos)) {
1571
				ElderGuardian elder = EntityTypes.ELDER_GUARDIAN.create(level.getLevel(), EntitySpawnReason.STRUCTURE);
1572
				if (elder != null) {
1573
					elder.heal(elder.getMaxHealth());
1574
					elder.snapTo(pos.getX() + 0.5, pos.getY(), pos.getZ() + 0.5, 0.0F, 0.0F);
1575
					elder.finalizeSpawn(level, level.getCurrentDifficultyAt(elder.blockPosition()), EntitySpawnReason.STRUCTURE, null);
1576
					level.addFreshEntityWithPassengers(elder);
1577
				}
1578
			}
1579
		}
1580
	}
1581
1582
	public static class OceanMonumentSimpleRoom extends OceanMonumentPieces.OceanMonumentPiece {
1583
		private int mainDesign;
1584
1585
		public OceanMonumentSimpleRoom(final Direction orientation, final OceanMonumentPieces.RoomDefinition definition, final RandomSource random) {
1586
			super(StructurePieceType.OCEAN_MONUMENT_SIMPLE_ROOM, 1, orientation, definition, 1, 1, 1);
1587
			this.mainDesign = random.nextInt(3);
1588
		}
1589
1590
		public OceanMonumentSimpleRoom(final CompoundTag tag) {
1591
			super(StructurePieceType.OCEAN_MONUMENT_SIMPLE_ROOM, tag);
1592
		}
1593
1594
		@Override
1595
		public void postProcess(
1596
			final WorldGenLevel level,
1597
			final StructureManager structureManager,
1598
			final ChunkGenerator generator,
1599
			final RandomSource random,
1600
			final BoundingBox chunkBB,
1601
			final ChunkPos chunkPos,
1602
			final BlockPos referencePos
1603
		) {
1604
			if (this.roomDefinition.index / 25 > 0) {
1605
				this.generateDefaultFloor(level, chunkBB, 0, 0, this.roomDefinition.hasOpening[Direction.DOWN.get3DDataValue()]);
1606
			}
1607
1608
			if (this.roomDefinition.connections[Direction.UP.get3DDataValue()] == null) {
1609
				this.generateBoxOnFillOnly(level, chunkBB, 1, 4, 1, 6, 4, 6, BASE_GRAY);
1610
			}
1611
1612
			boolean centerPillar = this.mainDesign != 0
1613
				&& random.nextBoolean()
1614
				&& !this.roomDefinition.hasOpening[Direction.DOWN.get3DDataValue()]
1615
				&& !this.roomDefinition.hasOpening[Direction.UP.get3DDataValue()]
1616
				&& this.roomDefinition.countOpenings() > 1;
1617
			if (this.mainDesign == 0) {
1618
				this.generateBox(level, chunkBB, 0, 1, 0, 2, 1, 2, BASE_LIGHT, BASE_LIGHT, false);
1619
				this.generateBox(level, chunkBB, 0, 3, 0, 2, 3, 2, BASE_LIGHT, BASE_LIGHT, false);
1620
				this.generateBox(level, chunkBB, 0, 2, 0, 0, 2, 2, BASE_GRAY, BASE_GRAY, false);
1621
				this.generateBox(level, chunkBB, 1, 2, 0, 2, 2, 0, BASE_GRAY, BASE_GRAY, false);
1622
				this.placeBlock(level, LAMP_BLOCK, 1, 2, 1, chunkBB);
1623
				this.generateBox(level, chunkBB, 5, 1, 0, 7, 1, 2, BASE_LIGHT, BASE_LIGHT, false);
1624
				this.generateBox(level, chunkBB, 5, 3, 0, 7, 3, 2, BASE_LIGHT, BASE_LIGHT, false);
1625
				this.generateBox(level, chunkBB, 7, 2, 0, 7, 2, 2, BASE_GRAY, BASE_GRAY, false);
1626
				this.generateBox(level, chunkBB, 5, 2, 0, 6, 2, 0, BASE_GRAY, BASE_GRAY, false);
1627
				this.placeBlock(level, LAMP_BLOCK, 6, 2, 1, chunkBB);
1628
				this.generateBox(level, chunkBB, 0, 1, 5, 2, 1, 7, BASE_LIGHT, BASE_LIGHT, false);
1629
				this.generateBox(level, chunkBB, 0, 3, 5, 2, 3, 7, BASE_LIGHT, BASE_LIGHT, false);
1630
				this.generateBox(level, chunkBB, 0, 2, 5, 0, 2, 7, BASE_GRAY, BASE_GRAY, false);
1631
				this.generateBox(level, chunkBB, 1, 2, 7, 2, 2, 7, BASE_GRAY, BASE_GRAY, false);
1632
				this.placeBlock(level, LAMP_BLOCK, 1, 2, 6, chunkBB);
1633
				this.generateBox(level, chunkBB, 5, 1, 5, 7, 1, 7, BASE_LIGHT, BASE_LIGHT, false);
1634
				this.generateBox(level, chunkBB, 5, 3, 5, 7, 3, 7, BASE_LIGHT, BASE_LIGHT, false);
1635
				this.generateBox(level, chunkBB, 7, 2, 5, 7, 2, 7, BASE_GRAY, BASE_GRAY, false);
1636
				this.generateBox(level, chunkBB, 5, 2, 7, 6, 2, 7, BASE_GRAY, BASE_GRAY, false);
1637
				this.placeBlock(level, LAMP_BLOCK, 6, 2, 6, chunkBB);
1638
				if (this.roomDefinition.hasOpening[Direction.SOUTH.get3DDataValue()]) {
1639
					this.generateBox(level, chunkBB, 3, 3, 0, 4, 3, 0, BASE_LIGHT, BASE_LIGHT, false);
1640
				} else {
1641
					this.generateBox(level, chunkBB, 3, 3, 0, 4, 3, 1, BASE_LIGHT, BASE_LIGHT, false);
1642
					this.generateBox(level, chunkBB, 3, 2, 0, 4, 2, 0, BASE_GRAY, BASE_GRAY, false);
1643
					this.generateBox(level, chunkBB, 3, 1, 0, 4, 1, 1, BASE_LIGHT, BASE_LIGHT, false);
1644
				}
1645
1646
				if (this.roomDefinition.hasOpening[Direction.NORTH.get3DDataValue()]) {
1647
					this.generateBox(level, chunkBB, 3, 3, 7, 4, 3, 7, BASE_LIGHT, BASE_LIGHT, false);
1648
				} else {
1649
					this.generateBox(level, chunkBB, 3, 3, 6, 4, 3, 7, BASE_LIGHT, BASE_LIGHT, false);
1650
					this.generateBox(level, chunkBB, 3, 2, 7, 4, 2, 7, BASE_GRAY, BASE_GRAY, false);
1651
					this.generateBox(level, chunkBB, 3, 1, 6, 4, 1, 7, BASE_LIGHT, BASE_LIGHT, false);
1652
				}
1653
1654
				if (this.roomDefinition.hasOpening[Direction.WEST.get3DDataValue()]) {
1655
					this.generateBox(level, chunkBB, 0, 3, 3, 0, 3, 4, BASE_LIGHT, BASE_LIGHT, false);
1656
				} else {
1657
					this.generateBox(level, chunkBB, 0, 3, 3, 1, 3, 4, BASE_LIGHT, BASE_LIGHT, false);
1658
					this.generateBox(level, chunkBB, 0, 2, 3, 0, 2, 4, BASE_GRAY, BASE_GRAY, false);
1659
					this.generateBox(level, chunkBB, 0, 1, 3, 1, 1, 4, BASE_LIGHT, BASE_LIGHT, false);
1660
				}
1661
1662
				if (this.roomDefinition.hasOpening[Direction.EAST.get3DDataValue()]) {
1663
					this.generateBox(level, chunkBB, 7, 3, 3, 7, 3, 4, BASE_LIGHT, BASE_LIGHT, false);
1664
				} else {
1665
					this.generateBox(level, chunkBB, 6, 3, 3, 7, 3, 4, BASE_LIGHT, BASE_LIGHT, false);
1666
					this.generateBox(level, chunkBB, 7, 2, 3, 7, 2, 4, BASE_GRAY, BASE_GRAY, false);
1667
					this.generateBox(level, chunkBB, 6, 1, 3, 7, 1, 4, BASE_LIGHT, BASE_LIGHT, false);
1668
				}
1669
			} else if (this.mainDesign == 1) {
1670
				this.generateBox(level, chunkBB, 2, 1, 2, 2, 3, 2, BASE_LIGHT, BASE_LIGHT, false);
1671
				this.generateBox(level, chunkBB, 2, 1, 5, 2, 3, 5, BASE_LIGHT, BASE_LIGHT, false);
1672
				this.generateBox(level, chunkBB, 5, 1, 5, 5, 3, 5, BASE_LIGHT, BASE_LIGHT, false);
1673
				this.generateBox(level, chunkBB, 5, 1, 2, 5, 3, 2, BASE_LIGHT, BASE_LIGHT, false);
1674
				this.placeBlock(level, LAMP_BLOCK, 2, 2, 2, chunkBB);
1675
				this.placeBlock(level, LAMP_BLOCK, 2, 2, 5, chunkBB);
1676
				this.placeBlock(level, LAMP_BLOCK, 5, 2, 5, chunkBB);
1677
				this.placeBlock(level, LAMP_BLOCK, 5, 2, 2, chunkBB);
1678
				this.generateBox(level, chunkBB, 0, 1, 0, 1, 3, 0, BASE_LIGHT, BASE_LIGHT, false);
1679
				this.generateBox(level, chunkBB, 0, 1, 1, 0, 3, 1, BASE_LIGHT, BASE_LIGHT, false);
1680
				this.generateBox(level, chunkBB, 0, 1, 7, 1, 3, 7, BASE_LIGHT, BASE_LIGHT, false);
1681
				this.generateBox(level, chunkBB, 0, 1, 6, 0, 3, 6, BASE_LIGHT, BASE_LIGHT, false);
1682
				this.generateBox(level, chunkBB, 6, 1, 7, 7, 3, 7, BASE_LIGHT, BASE_LIGHT, false);
1683
				this.generateBox(level, chunkBB, 7, 1, 6, 7, 3, 6, BASE_LIGHT, BASE_LIGHT, false);
1684
				this.generateBox(level, chunkBB, 6, 1, 0, 7, 3, 0, BASE_LIGHT, BASE_LIGHT, false);
1685
				this.generateBox(level, chunkBB, 7, 1, 1, 7, 3, 1, BASE_LIGHT, BASE_LIGHT, false);
1686
				this.placeBlock(level, BASE_GRAY, 1, 2, 0, chunkBB);
1687
				this.placeBlock(level, BASE_GRAY, 0, 2, 1, chunkBB);
1688
				this.placeBlock(level, BASE_GRAY, 1, 2, 7, chunkBB);
1689
				this.placeBlock(level, BASE_GRAY, 0, 2, 6, chunkBB);
1690
				this.placeBlock(level, BASE_GRAY, 6, 2, 7, chunkBB);
1691
				this.placeBlock(level, BASE_GRAY, 7, 2, 6, chunkBB);
1692
				this.placeBlock(level, BASE_GRAY, 6, 2, 0, chunkBB);
1693
				this.placeBlock(level, BASE_GRAY, 7, 2, 1, chunkBB);
1694
				if (!this.roomDefinition.hasOpening[Direction.SOUTH.get3DDataValue()]) {
1695
					this.generateBox(level, chunkBB, 1, 3, 0, 6, 3, 0, BASE_LIGHT, BASE_LIGHT, false);
1696
					this.generateBox(level, chunkBB, 1, 2, 0, 6, 2, 0, BASE_GRAY, BASE_GRAY, false);
1697
					this.generateBox(level, chunkBB, 1, 1, 0, 6, 1, 0, BASE_LIGHT, BASE_LIGHT, false);
1698
				}
1699
1700
				if (!this.roomDefinition.hasOpening[Direction.NORTH.get3DDataValue()]) {
1701
					this.generateBox(level, chunkBB, 1, 3, 7, 6, 3, 7, BASE_LIGHT, BASE_LIGHT, false);
1702
					this.generateBox(level, chunkBB, 1, 2, 7, 6, 2, 7, BASE_GRAY, BASE_GRAY, false);
1703
					this.generateBox(level, chunkBB, 1, 1, 7, 6, 1, 7, BASE_LIGHT, BASE_LIGHT, false);
1704
				}
1705
1706
				if (!this.roomDefinition.hasOpening[Direction.WEST.get3DDataValue()]) {
1707
					this.generateBox(level, chunkBB, 0, 3, 1, 0, 3, 6, BASE_LIGHT, BASE_LIGHT, false);
1708
					this.generateBox(level, chunkBB, 0, 2, 1, 0, 2, 6, BASE_GRAY, BASE_GRAY, false);
1709
					this.generateBox(level, chunkBB, 0, 1, 1, 0, 1, 6, BASE_LIGHT, BASE_LIGHT, false);
1710
				}
1711
1712
				if (!this.roomDefinition.hasOpening[Direction.EAST.get3DDataValue()]) {
1713
					this.generateBox(level, chunkBB, 7, 3, 1, 7, 3, 6, BASE_LIGHT, BASE_LIGHT, false);
1714
					this.generateBox(level, chunkBB, 7, 2, 1, 7, 2, 6, BASE_GRAY, BASE_GRAY, false);
1715
					this.generateBox(level, chunkBB, 7, 1, 1, 7, 1, 6, BASE_LIGHT, BASE_LIGHT, false);
1716
				}
1717
			} else if (this.mainDesign == 2) {
1718
				this.generateBox(level, chunkBB, 0, 1, 0, 0, 1, 7, BASE_LIGHT, BASE_LIGHT, false);
1719
				this.generateBox(level, chunkBB, 7, 1, 0, 7, 1, 7, BASE_LIGHT, BASE_LIGHT, false);
1720
				this.generateBox(level, chunkBB, 1, 1, 0, 6, 1, 0, BASE_LIGHT, BASE_LIGHT, false);
1721
				this.generateBox(level, chunkBB, 1, 1, 7, 6, 1, 7, BASE_LIGHT, BASE_LIGHT, false);
1722
				this.generateBox(level, chunkBB, 0, 2, 0, 0, 2, 7, BASE_BLACK, BASE_BLACK, false);
1723
				this.generateBox(level, chunkBB, 7, 2, 0, 7, 2, 7, BASE_BLACK, BASE_BLACK, false);
1724
				this.generateBox(level, chunkBB, 1, 2, 0, 6, 2, 0, BASE_BLACK, BASE_BLACK, false);
1725
				this.generateBox(level, chunkBB, 1, 2, 7, 6, 2, 7, BASE_BLACK, BASE_BLACK, false);
1726
				this.generateBox(level, chunkBB, 0, 3, 0, 0, 3, 7, BASE_LIGHT, BASE_LIGHT, false);
1727
				this.generateBox(level, chunkBB, 7, 3, 0, 7, 3, 7, BASE_LIGHT, BASE_LIGHT, false);
1728
				this.generateBox(level, chunkBB, 1, 3, 0, 6, 3, 0, BASE_LIGHT, BASE_LIGHT, false);
1729
				this.generateBox(level, chunkBB, 1, 3, 7, 6, 3, 7, BASE_LIGHT, BASE_LIGHT, false);
1730
				this.generateBox(level, chunkBB, 0, 1, 3, 0, 2, 4, BASE_BLACK, BASE_BLACK, false);
1731
				this.generateBox(level, chunkBB, 7, 1, 3, 7, 2, 4, BASE_BLACK, BASE_BLACK, false);
1732
				this.generateBox(level, chunkBB, 3, 1, 0, 4, 2, 0, BASE_BLACK, BASE_BLACK, false);
1733
				this.generateBox(level, chunkBB, 3, 1, 7, 4, 2, 7, BASE_BLACK, BASE_BLACK, false);
1734
				if (this.roomDefinition.hasOpening[Direction.SOUTH.get3DDataValue()]) {
1735
					this.generateWaterBox(level, chunkBB, 3, 1, 0, 4, 2, 0);
1736
				}
1737
1738
				if (this.roomDefinition.hasOpening[Direction.NORTH.get3DDataValue()]) {
1739
					this.generateWaterBox(level, chunkBB, 3, 1, 7, 4, 2, 7);
1740
				}
1741
1742
				if (this.roomDefinition.hasOpening[Direction.WEST.get3DDataValue()]) {
1743
					this.generateWaterBox(level, chunkBB, 0, 1, 3, 0, 2, 4);
1744
				}
1745
1746
				if (this.roomDefinition.hasOpening[Direction.EAST.get3DDataValue()]) {
1747
					this.generateWaterBox(level, chunkBB, 7, 1, 3, 7, 2, 4);
1748
				}
1749
			}
1750
1751
			if (centerPillar) {
1752
				this.generateBox(level, chunkBB, 3, 1, 3, 4, 1, 4, BASE_LIGHT, BASE_LIGHT, false);
1753
				this.generateBox(level, chunkBB, 3, 2, 3, 4, 2, 4, BASE_GRAY, BASE_GRAY, false);
1754
				this.generateBox(level, chunkBB, 3, 3, 3, 4, 3, 4, BASE_LIGHT, BASE_LIGHT, false);
1755
			}
1756
		}
1757
	}
1758
1759
	public static class OceanMonumentSimpleTopRoom extends OceanMonumentPieces.OceanMonumentPiece {
1760
		public OceanMonumentSimpleTopRoom(final Direction orientation, final OceanMonumentPieces.RoomDefinition definition) {
1761
			super(StructurePieceType.OCEAN_MONUMENT_SIMPLE_TOP_ROOM, 1, orientation, definition, 1, 1, 1);
1762
		}
1763
1764
		public OceanMonumentSimpleTopRoom(final CompoundTag tag) {
1765
			super(StructurePieceType.OCEAN_MONUMENT_SIMPLE_TOP_ROOM, tag);
1766
		}
1767
1768
		@Override
1769
		public void postProcess(
1770
			final WorldGenLevel level,
1771
			final StructureManager structureManager,
1772
			final ChunkGenerator generator,
1773
			final RandomSource random,
1774
			final BoundingBox chunkBB,
1775
			final ChunkPos chunkPos,
1776
			final BlockPos referencePos
1777
		) {
1778
			if (this.roomDefinition.index / 25 > 0) {
1779
				this.generateDefaultFloor(level, chunkBB, 0, 0, this.roomDefinition.hasOpening[Direction.DOWN.get3DDataValue()]);
1780
			}
1781
1782
			if (this.roomDefinition.connections[Direction.UP.get3DDataValue()] == null) {
1783
				this.generateBoxOnFillOnly(level, chunkBB, 1, 4, 1, 6, 4, 6, BASE_GRAY);
1784
			}
1785
1786
			for (int x = 1; x <= 6; x++) {
1787
				for (int z = 1; z <= 6; z++) {
1788
					if (random.nextInt(3) != 0) {
1789
						int y0 = 2 + (random.nextInt(4) == 0 ? 0 : 1);
1790
						BlockState wetSponge = Blocks.WET_SPONGE.defaultBlockState();
1791
						this.generateBox(level, chunkBB, x, y0, z, x, 3, z, wetSponge, wetSponge, false);
1792
					}
1793
				}
1794
			}
1795
1796
			this.generateBox(level, chunkBB, 0, 1, 0, 0, 1, 7, BASE_LIGHT, BASE_LIGHT, false);
1797
			this.generateBox(level, chunkBB, 7, 1, 0, 7, 1, 7, BASE_LIGHT, BASE_LIGHT, false);
1798
			this.generateBox(level, chunkBB, 1, 1, 0, 6, 1, 0, BASE_LIGHT, BASE_LIGHT, false);
1799
			this.generateBox(level, chunkBB, 1, 1, 7, 6, 1, 7, BASE_LIGHT, BASE_LIGHT, false);
1800
			this.generateBox(level, chunkBB, 0, 2, 0, 0, 2, 7, BASE_BLACK, BASE_BLACK, false);
1801
			this.generateBox(level, chunkBB, 7, 2, 0, 7, 2, 7, BASE_BLACK, BASE_BLACK, false);
1802
			this.generateBox(level, chunkBB, 1, 2, 0, 6, 2, 0, BASE_BLACK, BASE_BLACK, false);
1803
			this.generateBox(level, chunkBB, 1, 2, 7, 6, 2, 7, BASE_BLACK, BASE_BLACK, false);
1804
			this.generateBox(level, chunkBB, 0, 3, 0, 0, 3, 7, BASE_LIGHT, BASE_LIGHT, false);
1805
			this.generateBox(level, chunkBB, 7, 3, 0, 7, 3, 7, BASE_LIGHT, BASE_LIGHT, false);
1806
			this.generateBox(level, chunkBB, 1, 3, 0, 6, 3, 0, BASE_LIGHT, BASE_LIGHT, false);
1807
			this.generateBox(level, chunkBB, 1, 3, 7, 6, 3, 7, BASE_LIGHT, BASE_LIGHT, false);
1808
			this.generateBox(level, chunkBB, 0, 1, 3, 0, 2, 4, BASE_BLACK, BASE_BLACK, false);
1809
			this.generateBox(level, chunkBB, 7, 1, 3, 7, 2, 4, BASE_BLACK, BASE_BLACK, false);
1810
			this.generateBox(level, chunkBB, 3, 1, 0, 4, 2, 0, BASE_BLACK, BASE_BLACK, false);
1811
			this.generateBox(level, chunkBB, 3, 1, 7, 4, 2, 7, BASE_BLACK, BASE_BLACK, false);
1812
			if (this.roomDefinition.hasOpening[Direction.SOUTH.get3DDataValue()]) {
1813
				this.generateWaterBox(level, chunkBB, 3, 1, 0, 4, 2, 0);
1814
			}
1815
		}
1816
	}
1817
1818
	public static class OceanMonumentWingRoom extends OceanMonumentPieces.OceanMonumentPiece {
1819
		private int mainDesign;
1820
1821
		public OceanMonumentWingRoom(final Direction orientation, final BoundingBox boundingBox, final int randomValue) {
1822
			super(StructurePieceType.OCEAN_MONUMENT_WING_ROOM, orientation, 1, boundingBox);
1823
			this.mainDesign = randomValue & 1;
1824
		}
1825
1826
		public OceanMonumentWingRoom(final CompoundTag tag) {
1827
			super(StructurePieceType.OCEAN_MONUMENT_WING_ROOM, tag);
1828
		}
1829
1830
		@Override
1831
		public void postProcess(
1832
			final WorldGenLevel level,
1833
			final StructureManager structureManager,
1834
			final ChunkGenerator generator,
1835
			final RandomSource random,
1836
			final BoundingBox chunkBB,
1837
			final ChunkPos chunkPos,
1838
			final BlockPos referencePos
1839
		) {
1840
			if (this.mainDesign == 0) {
1841
				for (int i = 0; i < 4; i++) {
1842
					this.generateBox(level, chunkBB, 10 - i, 3 - i, 20 - i, 12 + i, 3 - i, 20, BASE_LIGHT, BASE_LIGHT, false);
1843
				}
1844
1845
				this.generateBox(level, chunkBB, 7, 0, 6, 15, 0, 16, BASE_LIGHT, BASE_LIGHT, false);
1846
				this.generateBox(level, chunkBB, 6, 0, 6, 6, 3, 20, BASE_LIGHT, BASE_LIGHT, false);
1847
				this.generateBox(level, chunkBB, 16, 0, 6, 16, 3, 20, BASE_LIGHT, BASE_LIGHT, false);
1848
				this.generateBox(level, chunkBB, 7, 1, 7, 7, 1, 20, BASE_LIGHT, BASE_LIGHT, false);
1849
				this.generateBox(level, chunkBB, 15, 1, 7, 15, 1, 20, BASE_LIGHT, BASE_LIGHT, false);
1850
				this.generateBox(level, chunkBB, 7, 1, 6, 9, 3, 6, BASE_LIGHT, BASE_LIGHT, false);
1851
				this.generateBox(level, chunkBB, 13, 1, 6, 15, 3, 6, BASE_LIGHT, BASE_LIGHT, false);
1852
				this.generateBox(level, chunkBB, 8, 1, 7, 9, 1, 7, BASE_LIGHT, BASE_LIGHT, false);
1853
				this.generateBox(level, chunkBB, 13, 1, 7, 14, 1, 7, BASE_LIGHT, BASE_LIGHT, false);
1854
				this.generateBox(level, chunkBB, 9, 0, 5, 13, 0, 5, BASE_LIGHT, BASE_LIGHT, false);
1855
				this.generateBox(level, chunkBB, 10, 0, 7, 12, 0, 7, BASE_BLACK, BASE_BLACK, false);
1856
				this.generateBox(level, chunkBB, 8, 0, 10, 8, 0, 12, BASE_BLACK, BASE_BLACK, false);
1857
				this.generateBox(level, chunkBB, 14, 0, 10, 14, 0, 12, BASE_BLACK, BASE_BLACK, false);
1858
1859
				for (int z = 18; z >= 7; z -= 3) {
1860
					this.placeBlock(level, LAMP_BLOCK, 6, 3, z, chunkBB);
1861
					this.placeBlock(level, LAMP_BLOCK, 16, 3, z, chunkBB);
1862
				}
1863
1864
				this.placeBlock(level, LAMP_BLOCK, 10, 0, 10, chunkBB);
1865
				this.placeBlock(level, LAMP_BLOCK, 12, 0, 10, chunkBB);
1866
				this.placeBlock(level, LAMP_BLOCK, 10, 0, 12, chunkBB);
1867
				this.placeBlock(level, LAMP_BLOCK, 12, 0, 12, chunkBB);
1868
				this.placeBlock(level, LAMP_BLOCK, 8, 3, 6, chunkBB);
1869
				this.placeBlock(level, LAMP_BLOCK, 14, 3, 6, chunkBB);
1870
				this.placeBlock(level, BASE_LIGHT, 4, 2, 4, chunkBB);
1871
				this.placeBlock(level, LAMP_BLOCK, 4, 1, 4, chunkBB);
1872
				this.placeBlock(level, BASE_LIGHT, 4, 0, 4, chunkBB);
1873
				this.placeBlock(level, BASE_LIGHT, 18, 2, 4, chunkBB);
1874
				this.placeBlock(level, LAMP_BLOCK, 18, 1, 4, chunkBB);
1875
				this.placeBlock(level, BASE_LIGHT, 18, 0, 4, chunkBB);
1876
				this.placeBlock(level, BASE_LIGHT, 4, 2, 18, chunkBB);
1877
				this.placeBlock(level, LAMP_BLOCK, 4, 1, 18, chunkBB);
1878
				this.placeBlock(level, BASE_LIGHT, 4, 0, 18, chunkBB);
1879
				this.placeBlock(level, BASE_LIGHT, 18, 2, 18, chunkBB);
1880
				this.placeBlock(level, LAMP_BLOCK, 18, 1, 18, chunkBB);
1881
				this.placeBlock(level, BASE_LIGHT, 18, 0, 18, chunkBB);
1882
				this.placeBlock(level, BASE_LIGHT, 9, 7, 20, chunkBB);
1883
				this.placeBlock(level, BASE_LIGHT, 13, 7, 20, chunkBB);
1884
				this.generateBox(level, chunkBB, 6, 0, 21, 7, 4, 21, BASE_LIGHT, BASE_LIGHT, false);
1885
				this.generateBox(level, chunkBB, 15, 0, 21, 16, 4, 21, BASE_LIGHT, BASE_LIGHT, false);
1886
				this.spawnElder(level, chunkBB, 11, 2, 16);
1887
			} else if (this.mainDesign == 1) {
1888
				this.generateBox(level, chunkBB, 9, 3, 18, 13, 3, 20, BASE_LIGHT, BASE_LIGHT, false);
1889
				this.generateBox(level, chunkBB, 9, 0, 18, 9, 2, 18, BASE_LIGHT, BASE_LIGHT, false);
1890
				this.generateBox(level, chunkBB, 13, 0, 18, 13, 2, 18, BASE_LIGHT, BASE_LIGHT, false);
1891
				int x = 9;
1892
				int z = 20;
1893
				int y = 5;
1894
1895
				for (int i = 0; i < 2; i++) {
1896
					this.placeBlock(level, BASE_LIGHT, x, 6, 20, chunkBB);
1897
					this.placeBlock(level, LAMP_BLOCK, x, 5, 20, chunkBB);
1898
					this.placeBlock(level, BASE_LIGHT, x, 4, 20, chunkBB);
1899
					x = 13;
1900
				}
1901
1902
				this.generateBox(level, chunkBB, 7, 3, 7, 15, 3, 14, BASE_LIGHT, BASE_LIGHT, false);
1903
				int var14 = 10;
1904
1905
				for (int i = 0; i < 2; i++) {
1906
					this.generateBox(level, chunkBB, var14, 0, 10, var14, 6, 10, BASE_LIGHT, BASE_LIGHT, false);
1907
					this.generateBox(level, chunkBB, var14, 0, 12, var14, 6, 12, BASE_LIGHT, BASE_LIGHT, false);
1908
					this.placeBlock(level, LAMP_BLOCK, var14, 0, 10, chunkBB);
1909
					this.placeBlock(level, LAMP_BLOCK, var14, 0, 12, chunkBB);
1910
					this.placeBlock(level, LAMP_BLOCK, var14, 4, 10, chunkBB);
1911
					this.placeBlock(level, LAMP_BLOCK, var14, 4, 12, chunkBB);
1912
					var14 = 12;
1913
				}
1914
1915
				var14 = 8;
1916
1917
				for (int i = 0; i < 2; i++) {
1918
					this.generateBox(level, chunkBB, var14, 0, 7, var14, 2, 7, BASE_LIGHT, BASE_LIGHT, false);
1919
					this.generateBox(level, chunkBB, var14, 0, 14, var14, 2, 14, BASE_LIGHT, BASE_LIGHT, false);
1920
					var14 = 14;
1921
				}
1922
1923
				this.generateBox(level, chunkBB, 8, 3, 8, 8, 3, 13, BASE_BLACK, BASE_BLACK, false);
1924
				this.generateBox(level, chunkBB, 14, 3, 8, 14, 3, 13, BASE_BLACK, BASE_BLACK, false);
1925
				this.spawnElder(level, chunkBB, 11, 5, 13);
1926
			}
1927
		}
1928
	}
1929
1930
	private static class RoomDefinition {
1931
		private final int index;
1932
		private final OceanMonumentPieces.RoomDefinition[] connections = new OceanMonumentPieces.RoomDefinition[6];
1933
		private final boolean[] hasOpening = new boolean[6];
1934
		private boolean claimed;
1935
		private boolean isSource;
1936
		private int scanIndex;
1937
1938
		public RoomDefinition(final int roomIndex) {
1939
			this.index = roomIndex;
1940
		}
1941
1942
		public void setConnection(final Direction direction, final OceanMonumentPieces.RoomDefinition definition) {
1943
			this.connections[direction.get3DDataValue()] = definition;
1944
			definition.connections[direction.getOpposite().get3DDataValue()] = this;
1945
		}
1946
1947
		public void updateOpenings() {
1948
			for (int i = 0; i < 6; i++) {
1949
				this.hasOpening[i] = this.connections[i] != null;
1950
			}
1951
		}
1952
1953
		public boolean findSource(final int scanIndex) {
1954
			if (this.isSource) {
1955
				return true;
1956
			}
1957
1958
			this.scanIndex = scanIndex;
1959
1960
			for (int i = 0; i < 6; i++) {
1961
				if (this.connections[i] != null && this.hasOpening[i] && this.connections[i].scanIndex != scanIndex && this.connections[i].findSource(scanIndex)) {
1962
					return true;
1963
				}
1964
			}
1965
1966
			return false;
1967
		}
1968
1969
		public boolean isSpecial() {
1970
			return this.index >= 75;
1971
		}
1972
1973
		public int countOpenings() {
1974
			int c = 0;
1975
1976
			for (int i = 0; i < 6; i++) {
1977
				if (this.hasOpening[i]) {
1978
					c++;
1979
				}
1980
			}
1981
1982
			return c;
1983
		}
1984
	}
1985
}
1986

Decompiled Minecraft 26.3 source of OceanMonumentPieces (net/minecraft/world/level/levelgen/structure/structures/OceanMonumentPieces.java) with Mojang official mappings, stored verbatim on the site.