Class StructurePiece
java.lang.Object
net.minecraft.world.level.levelgen.structure.StructurePiece
- Direct Known Subclasses:
BuriedTreasurePieces.BuriedTreasurePiece
,MineshaftPieces.MineShaftPiece
,NetherFortressPieces.NetherBridgePiece
,OceanMonumentPieces.OceanMonumentPiece
,PoolElementStructurePiece
,ScatteredFeaturePiece
,StrongholdPieces.StrongholdPiece
,TemplateStructurePiece
-
Nested Class Summary
Nested Classes -
Field Summary
FieldsModifier and TypeFieldDescriptionprotected BoundingBox
protected static final BlockState
protected int
private static final org.slf4j.Logger
private Mirror
private Direction
private Rotation
private final StructurePieceType
-
Constructor Summary
ConstructorsModifierConstructorDescriptionprotected
StructurePiece
(StructurePieceType type, int genDepth, BoundingBox boundingBox) StructurePiece
(StructurePieceType type, CompoundTag tag) -
Method Summary
Modifier and TypeMethodDescriptionprotected abstract void
void
addChildren
(StructurePiece piece, StructurePieceAccessor pieces, RandomSource random) protected boolean
canBeReplaced
(LevelReader level, int x, int y, int z, BoundingBox box) static BoundingBox
createBoundingBox
(Stream<StructurePiece> pieces) protected boolean
createChest
(ServerLevelAccessor level, BoundingBox box, RandomSource random, BlockPos pos, ResourceKey<LootTable> lootTable, BlockState state) protected boolean
createChest
(WorldGenLevel level, BoundingBox box, RandomSource random, int x, int y, int z, ResourceKey<LootTable> lootTable) protected boolean
createDispenser
(WorldGenLevel level, BoundingBox box, RandomSource random, int x, int y, int z, Direction facing, ResourceKey<LootTable> lootTable) final CompoundTag
protected void
fillColumnDown
(WorldGenLevel level, BlockState state, int x, int y, int z, BoundingBox box) static StructurePiece
findCollisionPiece
(List<StructurePiece> pieces, BoundingBox boundingBox) protected void
generateAirBox
(WorldGenLevel level, BoundingBox box, int minX, int minY, int minZ, int maxX, int maxY, int maxZ) protected void
generateBox
(WorldGenLevel level, BoundingBox box, int minX, int minY, int minZ, int maxX, int maxY, int maxZ, boolean alwaysReplace, RandomSource random, StructurePiece.BlockSelector blockSelector) protected void
generateBox
(WorldGenLevel level, BoundingBox box, int xMin, int yMin, int zMin, int xMax, int yMax, int zMax, BlockState boundaryBlockState, BlockState insideBlockState, boolean existingOnly) Fill the given area with the selected blocksprotected void
generateBox
(WorldGenLevel level, BoundingBox boundingBox, BoundingBox box, boolean alwaysReplace, RandomSource random, StructurePiece.BlockSelector blockSelector) protected void
generateBox
(WorldGenLevel level, BoundingBox boundingBox, BoundingBox box, BlockState boundaryBlockState, BlockState insideBlockState, boolean existingOnly) protected void
generateMaybeBox
(WorldGenLevel level, BoundingBox box, RandomSource random, float chance, int x1, int y1, int z1, int x2, int y2, int z2, BlockState edgeState, BlockState state, boolean requireNonAir, boolean requireSkylight) protected void
generateUpperHalfSphere
(WorldGenLevel level, BoundingBox box, int minX, int minY, int minZ, int maxX, int maxY, int maxZ, BlockState state, boolean excludeAir) protected BlockState
getBlock
(BlockGetter level, int x, int y, int z, BoundingBox box) int
protected static Direction
getType()
protected BlockPos.MutableBlockPos
getWorldPos
(int x, int y, int z) protected int
getWorldX
(int x, int z) protected int
getWorldY
(int y) protected int
getWorldZ
(int x, int z) boolean
isCloseToChunk
(ChunkPos chunkPos, int distance) protected boolean
isInterior
(LevelReader level, int x, int y, int z, BoundingBox box) protected boolean
protected static BoundingBox
makeBoundingBox
(int x, int y, int z, Direction direction, int offsetX, int offsetY, int offsetZ) protected void
maybeGenerateBlock
(WorldGenLevel level, BoundingBox box, RandomSource random, float chance, int x, int y, int z, BlockState state) void
move
(int x, int y, int z) protected void
placeBlock
(WorldGenLevel level, BlockState blockstate, int x, int y, int z, BoundingBox boundingbox) abstract void
postProcess
(WorldGenLevel level, StructureManager structureManager, ChunkGenerator generator, RandomSource random, BoundingBox box, ChunkPos chunkPos, BlockPos pos) static BlockState
reorient
(BlockGetter level, BlockPos pos, BlockState state) void
setGenDepth
(int genDepth) void
setOrientation
(Direction orientation)
-
Field Details
-
LOGGER
private static final org.slf4j.Logger LOGGER -
CAVE_AIR
-
boundingBox
-
orientation
-
mirror
-
rotation
-
genDepth
protected int genDepth -
type
-
SHAPE_CHECK_BLOCKS
-
-
Constructor Details
-
StructurePiece
-
StructurePiece
-
-
Method Details
-
makeBoundingBox
protected static BoundingBox makeBoundingBox(int x, int y, int z, Direction direction, int offsetX, int offsetY, int offsetZ) -
getRandomHorizontalDirection
-
createTag
-
addAdditionalSaveData
protected abstract void addAdditionalSaveData(StructurePieceSerializationContext context, CompoundTag tag) -
addChildren
-
postProcess
public abstract void postProcess(WorldGenLevel level, StructureManager structureManager, ChunkGenerator generator, RandomSource random, BoundingBox box, ChunkPos chunkPos, BlockPos pos) -
getBoundingBox
-
getGenDepth
public int getGenDepth() -
setGenDepth
public void setGenDepth(int genDepth) -
isCloseToChunk
-
getLocatorPosition
-
getWorldPos
-
getWorldX
protected int getWorldX(int x, int z) -
getWorldY
protected int getWorldY(int y) -
getWorldZ
protected int getWorldZ(int x, int z) -
placeBlock
protected void placeBlock(WorldGenLevel level, BlockState blockstate, int x, int y, int z, BoundingBox boundingbox) -
canBeReplaced
-
getBlock
-
isInterior
-
generateAirBox
protected void generateAirBox(WorldGenLevel level, BoundingBox box, int minX, int minY, int minZ, int maxX, int maxY, int maxZ) -
generateBox
protected void generateBox(WorldGenLevel level, BoundingBox box, int xMin, int yMin, int zMin, int xMax, int yMax, int zMax, BlockState boundaryBlockState, BlockState insideBlockState, boolean existingOnly) Fill the given area with the selected blocks -
generateBox
protected void generateBox(WorldGenLevel level, BoundingBox boundingBox, BoundingBox box, BlockState boundaryBlockState, BlockState insideBlockState, boolean existingOnly) -
generateBox
protected void generateBox(WorldGenLevel level, BoundingBox box, int minX, int minY, int minZ, int maxX, int maxY, int maxZ, boolean alwaysReplace, RandomSource random, StructurePiece.BlockSelector blockSelector) -
generateBox
protected void generateBox(WorldGenLevel level, BoundingBox boundingBox, BoundingBox box, boolean alwaysReplace, RandomSource random, StructurePiece.BlockSelector blockSelector) -
generateMaybeBox
protected void generateMaybeBox(WorldGenLevel level, BoundingBox box, RandomSource random, float chance, int x1, int y1, int z1, int x2, int y2, int z2, BlockState edgeState, BlockState state, boolean requireNonAir, boolean requireSkylight) -
maybeGenerateBlock
protected void maybeGenerateBlock(WorldGenLevel level, BoundingBox box, RandomSource random, float chance, int x, int y, int z, BlockState state) -
generateUpperHalfSphere
protected void generateUpperHalfSphere(WorldGenLevel level, BoundingBox box, int minX, int minY, int minZ, int maxX, int maxY, int maxZ, BlockState state, boolean excludeAir) -
fillColumnDown
protected void fillColumnDown(WorldGenLevel level, BlockState state, int x, int y, int z, BoundingBox box) -
isReplaceableByStructures
-
createChest
protected boolean createChest(WorldGenLevel level, BoundingBox box, RandomSource random, int x, int y, int z, ResourceKey<LootTable> lootTable) -
reorient
-
createChest
protected boolean createChest(ServerLevelAccessor level, BoundingBox box, RandomSource random, BlockPos pos, ResourceKey<LootTable> lootTable, @Nullable BlockState state) -
createDispenser
protected boolean createDispenser(WorldGenLevel level, BoundingBox box, RandomSource random, int x, int y, int z, Direction facing, ResourceKey<LootTable> lootTable) -
move
public void move(int x, int y, int z) -
createBoundingBox
-
findCollisionPiece
@Nullable public static StructurePiece findCollisionPiece(List<StructurePiece> pieces, BoundingBox boundingBox) -
getOrientation
-
setOrientation
-
getRotation
-
getMirror
-
getType
-