Contents
- Description
- Nested Class Summary
- Field Summary
- Constructor Summary
- Method Summary
- Field Details
- Constructor Details
- Method Details
- forEachFillerBlock(BlockBoundingBoxes.RotatedVariantBoxes, TriIntConsumer)
- forEachFillerBlock(float, BlockBoundingBoxes.RotatedVariantBoxes, TriIntConsumer)
- forEachFillerBlock(float, int, BlockBoundingBoxes.RotatedVariantBoxes, TriIntConsumer)
- forEachFillerBlock(float, int, int, int, BlockBoundingBoxes.RotatedVariantBoxes, TriIntConsumer)
- testFillerBlocks(BlockBoundingBoxes.RotatedVariantBoxes, TriIntPredicate)
- testFillerBlocks(float, BlockBoundingBoxes.RotatedVariantBoxes, TriIntPredicate)
- packedMinCell(BlockBoundingBoxes.RotatedVariantBoxes)
- packedMaxCell(BlockBoundingBoxes.RotatedVariantBoxes)
- multiCellFootprint(int, int)
- isFootprintFree(LongOpenHashSet, int, int, int, BlockBoundingBoxes.RotatedVariantBoxes)
- isFootprintFree(Int3OpenHashSet, int, int, int, BlockBoundingBoxes.RotatedVariantBoxes)
- markFootprint(LongOpenHashSet, int, int, int, BlockBoundingBoxes.RotatedVariantBoxes)
- markFootprint(Int3OpenHashSet, int, int, int, BlockBoundingBoxes.RotatedVariantBoxes)
- validateBlock(int, int, int, int, int, int, A, B, FillerBlockUtil.FillerFetcher)
- pack(int, int, int)
- unpackX(int)
- unpackY(int)
- unpackZ(int)
- removeFillerBlocksAt(ComponentAccessor, BlockSection, BlockComponentSection, int, int, int, int, int, int, FillerBlockUtil.ChangeReason)
- setFillerBlocksAt(ComponentAccessor, Ref, BlockSection, BlockComponentSection, int, int, int, int, int, int, FillerBlockUtil.ChangeReason)
Class FillerBlockUtil
java.lang.Object
com.hypixel.hytale.server.core.util.FillerBlockUtil
- Since:
- 19/4/18
- Version:
- 1.0
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic enumstatic interfacestatic enum -
Field Summary
Fields -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic voidforEachFillerBlock(float threshold, int expandX, int expandY, int expandZ, BlockBoundingBoxes.RotatedVariantBoxes blockBoundingBoxes, TriIntConsumer consumer) static voidforEachFillerBlock(float threshold, int expand, BlockBoundingBoxes.RotatedVariantBoxes blockBoundingBoxes, TriIntConsumer consumer) static voidforEachFillerBlock(float threshold, BlockBoundingBoxes.RotatedVariantBoxes blockBoundingBoxes, TriIntConsumer consumer) static voidforEachFillerBlock(BlockBoundingBoxes.RotatedVariantBoxes blockBoundingBoxes, TriIntConsumer consumer) static booleanisFootprintFree(Int3OpenHashSet occupied, int x, int y, int z, BlockBoundingBoxes.RotatedVariantBoxes boxes) Tests whether every cell of theboxesfootprint anchored at world (x,y,z) is absent fromoccupied.static booleanisFootprintFree(it.unimi.dsi.fastutil.longs.LongOpenHashSet occupied, int x, int y, int z, BlockBoundingBoxes.RotatedVariantBoxes boxes) Tests whether every cell of theboxesfootprint anchored at world (x,y,z) is absent fromoccupied.static voidmarkFootprint(Int3OpenHashSet occupied, int x, int y, int z, BlockBoundingBoxes.RotatedVariantBoxes boxes) Adds every cell of theboxesfootprint anchored at world (x,y,z) tooccupied, keyed by coordinate asisFootprintFree(Int3OpenHashSet, int, int, int, BlockBoundingBoxes.RotatedVariantBoxes)describes.static voidmarkFootprint(it.unimi.dsi.fastutil.longs.LongOpenHashSet occupied, int x, int y, int z, BlockBoundingBoxes.RotatedVariantBoxes boxes) Adds every cell of theboxesfootprint anchored at world (x,y,z) tooccupiedso later placements in the same pass cannot land on it.multiCellFootprint(int blockId, int rotation) Returns the rotated boxes of a block whose hitbox protrudes past the unit cube (a multi-cell block), ornullfor single-cell blocks, unknown ids, or blocks without a hitbox.static intpack(int x, int y, int z) static intpackedMaxCell(BlockBoundingBoxes.RotatedVariantBoxes blockBoundingBoxes) Returns the highest cell of a footprint, packed withpack(int, int, int).static intpackedMinCell(BlockBoundingBoxes.RotatedVariantBoxes blockBoundingBoxes) Returns the lowest cell of a footprint, packed withpack(int, int, int).static voidremoveFillerBlocksAt(ComponentAccessor<ChunkStore> accessor, BlockSection blockSection, BlockComponentSection blockComponentSection, int x, int y, int z, int blockId, int filler, int rotation, FillerBlockUtil.ChangeReason changeReason) Removes all sibling filler blocks belonging to the same multi-block structure as the block at (x,y,z).static voidsetFillerBlocksAt(ComponentAccessor<ChunkStore> accessor, Ref<ChunkStore> ref, BlockSection blockSection, BlockComponentSection blockComponentSection, int x, int y, int z, int blockId, int filler, int rotation, FillerBlockUtil.ChangeReason changeReason) Places all sibling filler blocks for the multi-block structure that the block at (x,y,z) belongs to.static booleantestFillerBlocks(float threshold, BlockBoundingBoxes.RotatedVariantBoxes blockBoundingBoxes, TriIntPredicate predicate) static booleantestFillerBlocks(BlockBoundingBoxes.RotatedVariantBoxes blockBoundingBoxes, TriIntPredicate predicate) static intunpackX(int val) static intunpackY(int val) static intunpackZ(int val) static <A,B> FillerBlockUtil.ValidationResult validateBlock(int x, int y, int z, int blockId, int rotation, int filler, A a, B b, FillerBlockUtil.FillerFetcher<A, B> fetcher)
-
Field Details
-
THRESHOLD
public static final float THRESHOLD- See Also:
-
NO_FILLER
public static final int NO_FILLER- See Also:
-
-
Constructor Details
-
FillerBlockUtil
public FillerBlockUtil()
-
-
Method Details
-
forEachFillerBlock
public static void forEachFillerBlock(@Nonnull BlockBoundingBoxes.RotatedVariantBoxes blockBoundingBoxes, @Nonnull TriIntConsumer consumer) -
forEachFillerBlock
public static void forEachFillerBlock(float threshold, @Nonnull BlockBoundingBoxes.RotatedVariantBoxes blockBoundingBoxes, @Nonnull TriIntConsumer consumer) -
forEachFillerBlock
public static void forEachFillerBlock(float threshold, int expand, @Nonnull BlockBoundingBoxes.RotatedVariantBoxes blockBoundingBoxes, @Nonnull TriIntConsumer consumer) -
forEachFillerBlock
public static void forEachFillerBlock(float threshold, int expandX, int expandY, int expandZ, @Nonnull BlockBoundingBoxes.RotatedVariantBoxes blockBoundingBoxes, @Nonnull TriIntConsumer consumer) -
testFillerBlocks
public static boolean testFillerBlocks(@Nonnull BlockBoundingBoxes.RotatedVariantBoxes blockBoundingBoxes, @Nonnull TriIntPredicate predicate) -
testFillerBlocks
public static boolean testFillerBlocks(float threshold, @Nonnull BlockBoundingBoxes.RotatedVariantBoxes blockBoundingBoxes, @Nonnull TriIntPredicate predicate) -
packedMinCell
Returns the lowest cell of a footprint, packed withpack(int, int, int). Together withpackedMaxCell(BlockBoundingBoxes.RotatedVariantBoxes)it gives the inclusive offset range thatforEachFillerBlock(BlockBoundingBoxes.RotatedVariantBoxes, TriIntConsumer)walks. -
packedMaxCell
Returns the highest cell of a footprint, packed withpack(int, int, int). -
multiCellFootprint
@Nullable public static BlockBoundingBoxes.RotatedVariantBoxes multiCellFootprint(int blockId, int rotation) Returns the rotated boxes of a block whose hitbox protrudes past the unit cube (a multi-cell block), ornullfor single-cell blocks, unknown ids, or blocks without a hitbox. Callers use the result both to decide whether filler handling is required and to iterate the footprint viaforEachFillerBlock(BlockBoundingBoxes.RotatedVariantBoxes, TriIntConsumer). -
isFootprintFree
public static boolean isFootprintFree(@Nonnull it.unimi.dsi.fastutil.longs.LongOpenHashSet occupied, int x, int y, int z, @Nonnull BlockBoundingBoxes.RotatedVariantBoxes boxes) Tests whether every cell of theboxesfootprint anchored at world (x,y,z) is absent fromoccupied. Used to tile multi-cell blocks within a single edit pass without overlap. -
isFootprintFree
public static boolean isFootprintFree(@Nonnull Int3OpenHashSet occupied, int x, int y, int z, @Nonnull BlockBoundingBoxes.RotatedVariantBoxes boxes) Tests whether every cell of theboxesfootprint anchored at world (x,y,z) is absent fromoccupied.BlockUtil.pack(int, int, int)cannot hold the Y of a cubic world, so an edit that reaches any Y keys its occupancy by coordinate instead. -
markFootprint
public static void markFootprint(@Nonnull it.unimi.dsi.fastutil.longs.LongOpenHashSet occupied, int x, int y, int z, @Nonnull BlockBoundingBoxes.RotatedVariantBoxes boxes) Adds every cell of theboxesfootprint anchored at world (x,y,z) tooccupiedso later placements in the same pass cannot land on it. -
markFootprint
public static void markFootprint(@Nonnull Int3OpenHashSet occupied, int x, int y, int z, @Nonnull BlockBoundingBoxes.RotatedVariantBoxes boxes) Adds every cell of theboxesfootprint anchored at world (x,y,z) tooccupied, keyed by coordinate asisFootprintFree(Int3OpenHashSet, int, int, int, BlockBoundingBoxes.RotatedVariantBoxes)describes. -
validateBlock
public static <A,B> FillerBlockUtil.ValidationResult validateBlock(int x, int y, int z, int blockId, int rotation, int filler, A a, B b, @Nonnull FillerBlockUtil.FillerFetcher<A, B> fetcher) -
pack
public static int pack(int x, int y, int z) -
unpackX
public static int unpackX(int val) -
unpackY
public static int unpackY(int val) -
unpackZ
public static int unpackZ(int val) -
removeFillerBlocksAt
public static void removeFillerBlocksAt(@Nonnull ComponentAccessor<ChunkStore> accessor, BlockSection blockSection, BlockComponentSection blockComponentSection, int x, int y, int z, int blockId, int filler, int rotation, FillerBlockUtil.ChangeReason changeReason) Removes all sibling filler blocks belonging to the same multi-block structure as the block at (x,y,z). The filler offset is unpacked to locate the base (origin) block, then every filler position in the hitbox bounding box is cleared — except the position being removed by the caller.Filler blocks in the same chunk section are removed synchronously via the provided
blockSection. Filler blocks in other sections are removed synchronously if the section is already loaded, or asynchronously if it needs to be fetched.- Parameters:
accessor- component accessor for looking up chunk datablockSection- the block section containing the block at (x, y, z)x- world x coordinate of the block being removedy- world y coordinate of the block being removedz- world z coordinate of the block being removedblockId- the block type ID at (x, y, z), used to match sibling fillersfiller- the packed filler offset of this block relative to the base blockrotation- the rotation index of the multi-block structurechangeReason- controls whether particles are spawned for removed fillers
-
setFillerBlocksAt
public static void setFillerBlocksAt(@Nonnull ComponentAccessor<ChunkStore> accessor, @Nonnull Ref<ChunkStore> ref, BlockSection blockSection, BlockComponentSection blockComponentSection, int x, int y, int z, int blockId, int filler, int rotation, FillerBlockUtil.ChangeReason changeReason) Places all sibling filler blocks for the multi-block structure that the block at (x,y,z) belongs to. The filler offset is unpacked to locate the base (origin) block, then every filler position in the hitbox bounding box is written — except the caller's own position.Filler blocks in the same chunk section are placed synchronously via the provided
blockSection. Filler blocks in other sections are placed synchronously if the section is already loaded, or asynchronously if it needs to be fetched.- Parameters:
accessor- component accessor for looking up chunk dataref- reference to the chunk sectionblockSection- the block section containing the block at (x, y, z)x- world x coordinate of the block being placedy- world y coordinate of the block being placedz- world z coordinate of the block being placedblockId- the block type ID at (x, y, z), written to all filler positionsfiller- the packed filler offset of this block relative to the base blockrotation- the rotation index of the multi-block structurechangeReason- controls whether particles are spawned when replacing existing blocks
-