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 pType, int pGenDepth, BoundingBox pBoundingBox) StructurePiece
(StructurePieceType pType, CompoundTag pTag) -
Method Summary
Modifier and TypeMethodDescriptionprotected abstract void
addAdditionalSaveData
(StructurePieceSerializationContext pContext, CompoundTag pTag) void
addChildren
(StructurePiece pPiece, StructurePieceAccessor pPieces, RandomSource pRandom) protected boolean
canBeReplaced
(LevelReader pLevel, int pX, int pY, int pZ, BoundingBox pBox) static BoundingBox
createBoundingBox
(Stream<StructurePiece> pPieces) protected boolean
createChest
(ServerLevelAccessor pLevel, BoundingBox pBox, RandomSource pRandom, BlockPos pPos, ResourceKey<LootTable> pLootTable, BlockState pState) protected boolean
createChest
(WorldGenLevel pLevel, BoundingBox pBox, RandomSource pRandom, int pX, int pY, int pZ, ResourceKey<LootTable> pLootTable) protected boolean
createDispenser
(WorldGenLevel pLevel, BoundingBox pBox, RandomSource pRandom, int pX, int pY, int pZ, Direction pFacing, ResourceKey<LootTable> pLootTable) final CompoundTag
createTag
(StructurePieceSerializationContext pContext) protected void
fillColumnDown
(WorldGenLevel pLevel, BlockState pState, int pX, int pY, int pZ, BoundingBox pBox) static StructurePiece
findCollisionPiece
(List<StructurePiece> pPieces, BoundingBox pBoundingBox) protected void
generateAirBox
(WorldGenLevel pLevel, BoundingBox pBox, int pMinX, int pMinY, int pMinZ, int pMaxX, int pMaxY, int pMaxZ) protected void
generateBox
(WorldGenLevel pLevel, BoundingBox pBox, int pMinX, int pMinY, int pMinZ, int pMaxX, int pMaxY, int pMaxZ, boolean pAlwaysReplace, RandomSource pRandom, StructurePiece.BlockSelector pBlockSelector) protected void
generateBox
(WorldGenLevel pLevel, BoundingBox pBox, int pXMin, int pYMin, int pZMin, int pXMax, int pYMax, int pZMax, BlockState pBoundaryBlockState, BlockState pInsideBlockState, boolean pExistingOnly) Fill the given area with the selected blocksprotected void
generateBox
(WorldGenLevel pLevel, BoundingBox pBoundingBox, BoundingBox pBox, boolean pAlwaysReplace, RandomSource pRandom, StructurePiece.BlockSelector pBlockSelector) protected void
generateBox
(WorldGenLevel pLevel, BoundingBox pBoundingBox, BoundingBox pBox, BlockState pBoundaryBlockState, BlockState pInsideBlockState, boolean pExistingOnly) protected void
generateMaybeBox
(WorldGenLevel pLevel, BoundingBox pBox, RandomSource pRandom, float pChance, int pX1, int pY1, int pZ1, int pX2, int pY2, int pZ2, BlockState pEdgeState, BlockState pState, boolean pRequireNonAir, boolean pRequireSkylight) protected void
generateUpperHalfSphere
(WorldGenLevel pLevel, BoundingBox pBox, int pMinX, int pMinY, int pMinZ, int pMaxX, int pMaxY, int pMaxZ, BlockState pState, boolean pExcludeAir) protected BlockState
getBlock
(BlockGetter pLevel, int pX, int pY, int pZ, BoundingBox pBox) int
protected static Direction
getRandomHorizontalDirection
(RandomSource pRandom) getType()
protected BlockPos.MutableBlockPos
getWorldPos
(int pX, int pY, int pZ) protected int
getWorldX
(int pX, int pZ) protected int
getWorldY
(int pY) protected int
getWorldZ
(int pX, int pZ) boolean
isCloseToChunk
(ChunkPos pChunkPos, int pDistance) protected boolean
isInterior
(LevelReader pLevel, int pX, int pY, int pZ, BoundingBox pBox) protected boolean
isReplaceableByStructures
(BlockState pState) protected static BoundingBox
makeBoundingBox
(int pX, int pY, int pZ, Direction pDirection, int pOffsetX, int pOffsetY, int pOffsetZ) protected void
maybeGenerateBlock
(WorldGenLevel pLevel, BoundingBox pBox, RandomSource pRandom, float pChance, int pX, int pY, int pZ, BlockState pState) void
move
(int pX, int pY, int pZ) protected void
placeBlock
(WorldGenLevel pLevel, BlockState pBlockstate, int pX, int pY, int pZ, BoundingBox pBoundingbox) abstract void
postProcess
(WorldGenLevel pLevel, StructureManager pStructureManager, ChunkGenerator pGenerator, RandomSource pRandom, BoundingBox pBox, ChunkPos pChunkPos, BlockPos pPos) static BlockState
reorient
(BlockGetter pLevel, BlockPos pPos, BlockState pState) void
setGenDepth
(int pGenDepth) void
setOrientation
(Direction pOrientation)
-
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 pX, int pY, int pZ, Direction pDirection, int pOffsetX, int pOffsetY, int pOffsetZ) -
getRandomHorizontalDirection
-
createTag
-
addAdditionalSaveData
protected abstract void addAdditionalSaveData(StructurePieceSerializationContext pContext, CompoundTag pTag) -
addChildren
public void addChildren(StructurePiece pPiece, StructurePieceAccessor pPieces, RandomSource pRandom) -
postProcess
public abstract void postProcess(WorldGenLevel pLevel, StructureManager pStructureManager, ChunkGenerator pGenerator, RandomSource pRandom, BoundingBox pBox, ChunkPos pChunkPos, BlockPos pPos) -
getBoundingBox
-
getGenDepth
public int getGenDepth() -
setGenDepth
public void setGenDepth(int pGenDepth) -
isCloseToChunk
-
getLocatorPosition
-
getWorldPos
-
getWorldX
protected int getWorldX(int pX, int pZ) -
getWorldY
protected int getWorldY(int pY) -
getWorldZ
protected int getWorldZ(int pX, int pZ) -
placeBlock
protected void placeBlock(WorldGenLevel pLevel, BlockState pBlockstate, int pX, int pY, int pZ, BoundingBox pBoundingbox) -
canBeReplaced
-
getBlock
-
isInterior
-
generateAirBox
protected void generateAirBox(WorldGenLevel pLevel, BoundingBox pBox, int pMinX, int pMinY, int pMinZ, int pMaxX, int pMaxY, int pMaxZ) -
generateBox
protected void generateBox(WorldGenLevel pLevel, BoundingBox pBox, int pXMin, int pYMin, int pZMin, int pXMax, int pYMax, int pZMax, BlockState pBoundaryBlockState, BlockState pInsideBlockState, boolean pExistingOnly) Fill the given area with the selected blocks -
generateBox
protected void generateBox(WorldGenLevel pLevel, BoundingBox pBoundingBox, BoundingBox pBox, BlockState pBoundaryBlockState, BlockState pInsideBlockState, boolean pExistingOnly) -
generateBox
protected void generateBox(WorldGenLevel pLevel, BoundingBox pBox, int pMinX, int pMinY, int pMinZ, int pMaxX, int pMaxY, int pMaxZ, boolean pAlwaysReplace, RandomSource pRandom, StructurePiece.BlockSelector pBlockSelector) -
generateBox
protected void generateBox(WorldGenLevel pLevel, BoundingBox pBoundingBox, BoundingBox pBox, boolean pAlwaysReplace, RandomSource pRandom, StructurePiece.BlockSelector pBlockSelector) -
generateMaybeBox
protected void generateMaybeBox(WorldGenLevel pLevel, BoundingBox pBox, RandomSource pRandom, float pChance, int pX1, int pY1, int pZ1, int pX2, int pY2, int pZ2, BlockState pEdgeState, BlockState pState, boolean pRequireNonAir, boolean pRequireSkylight) -
maybeGenerateBlock
protected void maybeGenerateBlock(WorldGenLevel pLevel, BoundingBox pBox, RandomSource pRandom, float pChance, int pX, int pY, int pZ, BlockState pState) -
generateUpperHalfSphere
protected void generateUpperHalfSphere(WorldGenLevel pLevel, BoundingBox pBox, int pMinX, int pMinY, int pMinZ, int pMaxX, int pMaxY, int pMaxZ, BlockState pState, boolean pExcludeAir) -
fillColumnDown
protected void fillColumnDown(WorldGenLevel pLevel, BlockState pState, int pX, int pY, int pZ, BoundingBox pBox) -
isReplaceableByStructures
-
createChest
protected boolean createChest(WorldGenLevel pLevel, BoundingBox pBox, RandomSource pRandom, int pX, int pY, int pZ, ResourceKey<LootTable> pLootTable) -
reorient
-
createChest
protected boolean createChest(ServerLevelAccessor pLevel, BoundingBox pBox, RandomSource pRandom, BlockPos pPos, ResourceKey<LootTable> pLootTable, @Nullable BlockState pState) -
createDispenser
protected boolean createDispenser(WorldGenLevel pLevel, BoundingBox pBox, RandomSource pRandom, int pX, int pY, int pZ, Direction pFacing, ResourceKey<LootTable> pLootTable) -
move
public void move(int pX, int pY, int pZ) -
createBoundingBox
-
findCollisionPiece
@Nullable public static StructurePiece findCollisionPiece(List<StructurePiece> pPieces, BoundingBox pBoundingBox) -
getOrientation
-
setOrientation
-
getRotation
-
getMirror
-
getType
-