Contents
- Description
- Nested Class Summary
- Constructor Summary
- Method Summary
- Constructor Details
- Method Details
- setBlock(ChunkGrid, Ref, ChunkSection, BlockSection, BlockComponentSection, HeightmapColumn, int, int, int, int, BlockType, int, int, int)
- setBlock(ChunkGrid, Ref, int, int, int, int, BlockType, int, int, int)
- setBlockPreLoad(ChunkSection, BlockSection, int, int, int, int, int, int)
- testPlaceBlock(ComponentAccessor, BlockSection, int, int, int, BlockType, int)
- testPlaceBlock(ComponentAccessor, BlockSection, int, int, int, BlockType, int, BlockOperations.TestBlockFunction)
- updateBlockArea(ChunkGrid, ChunkSection, BlockSection, BlockType, int, int, int, int)
- updateBlockArea(ChunkGrid, ChunkSection, BlockSection, int, int, int)
- spawnBlockParticles(ChunkGrid, int, int, int, int, int, boolean)
- setBlockInteractionState(ChunkGrid, Ref, int, int, int, BlockType, String, boolean)
- resolveBaseBlockPosition(ChunkGrid, BlockPosition)
- setBlock(ChunkStore, Ref, ChunkSection, BlockSection, BlockComponentSection, HeightmapColumn, int, int, int, int, BlockType, int, int, int)
- setBlock(ChunkStore, Ref, int, int, int, int, BlockType, int, int, int)
- updateBlockArea(ChunkStore, ChunkSection, BlockSection, BlockType, int, int, int, int)
- updateBlockArea(ChunkStore, ChunkSection, BlockSection, int, int, int)
- spawnBlockParticles(ChunkStore, int, int, int, int, int, boolean)
- setBlockInteractionState(ChunkStore, Ref, int, int, int, BlockType, String, boolean)
- resolveBaseBlockPosition(ChunkStore, BlockPosition)
Class BlockOperations
java.lang.Object
com.hypixel.hytale.server.core.universe.world.chunk.BlockOperations
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic interfaceDecides whether a placement test should still pass for a cell that is already occupied by the given block. -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic BlockPositionresolveBaseBlockPosition(ChunkGrid chunkGrid, BlockPosition position) Resolves the base block position for the given target position by following its filler offset back to the origin block.static BlockPositionresolveBaseBlockPosition(ChunkStore chunkStore, BlockPosition position) UseresolveBaseBlockPosition(ChunkGrid, BlockPosition)instead when applicable.static booleansetBlock(ChunkGrid chunkGrid, Ref<ChunkStore> sectionRef, int x, int y, int z, int id, BlockType blockType, int rotation, int filler, int settings) One-off overload that resolves the section and column components from a section reference, then forwards tosetBlock(ChunkGrid, Ref, ChunkSection, BlockSection, BlockComponentSection, HeightmapColumn, int, int, int, int, BlockType, int, int, int).static booleansetBlock(ChunkGrid chunkGrid, Ref<ChunkStore> sectionRef, ChunkSection section, BlockSection blockSection, BlockComponentSection blockComponentSection, HeightmapColumn heightmapColumn, int x, int y, int z, int id, BlockType blockType, int rotation, int filler, int settings) static booleansetBlock(ChunkStore chunkStore, Ref<ChunkStore> sectionRef, int x, int y, int z, int id, BlockType blockType, int rotation, int filler, int settings) UsesetBlock(ChunkGrid, Ref, int, int, int, int, BlockType, int, int, int)instead when applicable.static booleansetBlock(ChunkStore chunkStore, Ref<ChunkStore> sectionRef, ChunkSection section, BlockSection blockSection, BlockComponentSection blockComponentSection, HeightmapColumn heightmapColumn, int x, int y, int z, int id, BlockType blockType, int rotation, int filler, int settings) static voidsetBlockInteractionState(ChunkGrid chunkGrid, Ref<ChunkStore> chunkSectionReference, int x, int y, int z, BlockType blockType, String state, boolean force) static voidsetBlockInteractionState(ChunkStore chunkStore, Ref<ChunkStore> chunkSectionReference, int x, int y, int z, BlockType blockType, String state, boolean force) UsesetBlockInteractionState(ChunkGrid, Ref, int, int, int, BlockType, String, boolean)instead when applicable.static booleansetBlockPreLoad(ChunkSection section, BlockSection blockSection, int x, int y, int z, int id, int rotation, int filler) Applies a block change to a section holder during chunk pre-load processing, before the section is added to the store.static voidspawnBlockParticles(ChunkGrid chunkGrid, int oldBlockId, int newBlockId, int x, int y, int z, boolean isPhysics) Sends block particle effects to nearby players based on the type of block change.static voidspawnBlockParticles(ChunkStore chunkStore, int oldBlockId, int newBlockId, int x, int y, int z, boolean isPhysics) UsespawnBlockParticles(ChunkGrid, int, int, int, int, int, boolean)instead when applicable.static booleantestPlaceBlock(ComponentAccessor<ChunkStore> accessor, BlockSection section, int worldX, int worldY, int worldZ, BlockType blockTypeToTest, int rotationIndex) Overload oftestPlaceBlock(ComponentAccessor, BlockSection, int, int, int, BlockType, int, TestBlockFunction)that rejects any occupied cell.static booleantestPlaceBlock(ComponentAccessor<ChunkStore> accessor, BlockSection section, int worldX, int worldY, int worldZ, BlockType blockTypeToTest, int rotationIndex, BlockOperations.TestBlockFunction func) Tests whether a block of the given type and rotation could be placed at the given position, checking every cell covered by its rotated hitbox.static voidupdateBlockArea(ChunkGrid chunkGrid, ChunkSection chunkSection, BlockSection section, int x, int y, int z) Marks the 3x3x3 area around a single block as ticking.static voidupdateBlockArea(ChunkGrid chunkGrid, ChunkSection chunkSection, BlockSection section, BlockType blockType, int rotation, int x, int y, int z) Marks the surrounding area covered by the block's rotated bounding box as ticking, so those positions receive tick updates.static voidupdateBlockArea(ChunkStore chunkStore, ChunkSection chunkSection, BlockSection section, int x, int y, int z) UseupdateBlockArea(ChunkGrid, ChunkSection, BlockSection, int, int, int)instead when applicable.static voidupdateBlockArea(ChunkStore chunkStore, ChunkSection chunkSection, BlockSection section, BlockType blockType, int rotation, int x, int y, int z) UseupdateBlockArea(ChunkGrid, ChunkSection, BlockSection, BlockType, int, int, int, int)instead when applicable.
-
Constructor Details
-
BlockOperations
public BlockOperations()
-
-
Method Details
-
setBlock
public static boolean setBlock(ChunkGrid chunkGrid, Ref<ChunkStore> sectionRef, ChunkSection section, BlockSection blockSection, BlockComponentSection blockComponentSection, HeightmapColumn heightmapColumn, int x, int y, int z, int id, @Nonnull BlockType blockType, int rotation, int filler, int settings) -
setBlock
public static boolean setBlock(@Nonnull ChunkGrid chunkGrid, @Nonnull Ref<ChunkStore> sectionRef, int x, int y, int z, int id, @Nonnull BlockType blockType, int rotation, int filler, int settings) One-off overload that resolves the section and column components from a section reference, then forwards tosetBlock(ChunkGrid, Ref, ChunkSection, BlockSection, BlockComponentSection, HeightmapColumn, int, int, int, int, BlockType, int, int, int). Callers writing any blocks within a section should resolve the components once and use the full overload instead. -
setBlockPreLoad
public static boolean setBlockPreLoad(@Nonnull ChunkSection section, @Nonnull BlockSection blockSection, int x, int y, int z, int id, int rotation, int filler) Applies a block change to a section holder during chunk pre-load processing, before the section is added to the store. Writes the palette and the ticking flag only: lighting is computed after load, block entities, physics, fillers and replication need a live store reference, and the heightmap is derived from the final section contents after the pre-load events run. -
testPlaceBlock
public static boolean testPlaceBlock(ComponentAccessor<ChunkStore> accessor, BlockSection section, int worldX, int worldY, int worldZ, @Nonnull BlockType blockTypeToTest, int rotationIndex) Overload oftestPlaceBlock(ComponentAccessor, BlockSection, int, int, int, BlockType, int, TestBlockFunction)that rejects any occupied cell. -
testPlaceBlock
public static boolean testPlaceBlock(ComponentAccessor<ChunkStore> accessor, BlockSection section, int worldX, int worldY, int worldZ, @Nonnull BlockType blockTypeToTest, int rotationIndex, BlockOperations.TestBlockFunction func) Tests whether a block of the given type and rotation could be placed at the given position, checking every cell covered by its rotated hitbox. Does not modify the world. Returnsfalseif the block type has no hitbox asset, a cell falls in a section that isn't loaded, or a cell is occupied andfuncdoes not permit placing over it. -
updateBlockArea
public static void updateBlockArea(ChunkGrid chunkGrid, ChunkSection chunkSection, BlockSection section, BlockType blockType, int rotation, int x, int y, int z) Marks the surrounding area covered by the block's rotated bounding box as ticking, so those positions receive tick updates. For positions within the same chunk section, the ticking flag is set directly; for positions in other sections, the section is fetched asynchronously (without triggering chunk loading or generation).- Parameters:
chunkGrid- the chunk grid used to resolve cross-section referenceschunkSection- the chunk section containing the placed blocksection- the block section containing the placed blockblockType- the type of block being placed, used to look up its hitboxrotation- the block's rotation variant indexx- world x coordinate of the placed blocky- world y coordinate of the placed blockz- world z coordinate of the placed block
-
updateBlockArea
public static void updateBlockArea(ChunkGrid chunkGrid, ChunkSection chunkSection, BlockSection section, int x, int y, int z) Marks the 3x3x3 area around a single block as ticking. Use this for changes that are not a block placement, such as a fluid edit, where there is no hitbox to cover.- Parameters:
chunkGrid- the chunk grid used to resolve cross-section referenceschunkSection- the chunk section containing the changed blocksection- the block section containing the changed blockx- world x coordinate of the changed blocky- world y coordinate of the changed blockz- world z coordinate of the changed block
-
spawnBlockParticles
public static void spawnBlockParticles(ChunkGrid chunkGrid, int oldBlockId, int newBlockId, int x, int y, int z, boolean isPhysics) Sends block particle effects to nearby players based on the type of block change.- Placement (empty → block): sends a
BlockParticleEvent.Buildfor the new block - Removal (block → empty): sends a
BlockParticleEvent.BreakorBlockParticleEvent.Physicsfor the old block - Replacement (block → block): sends Break for the old block and Build for the new block
- Parameters:
chunkGrid- the chunk grid used to access the world notification handleroldBlockId- the block ID that was previously at this positionnewBlockId- the block ID now at this positionx- world x coordinate of the block changey- world y coordinate of the block changez- world z coordinate of the block changeisPhysics- whether the removal was caused by physics (e.g. gravity), which uses a different particle event than manual breaking
- Placement (empty → block): sends a
-
setBlockInteractionState
public static void setBlockInteractionState(@Nonnull ChunkGrid chunkGrid, @Nonnull Ref<ChunkStore> chunkSectionReference, int x, int y, int z, @Nonnull BlockType blockType, @Nonnull String state, boolean force) -
resolveBaseBlockPosition
@Nonnull public static BlockPosition resolveBaseBlockPosition(@Nonnull ChunkGrid chunkGrid, @Nonnull BlockPosition position) Resolves the base block position for the given target position by following its filler offset back to the origin block. Returns the input position unchanged if the block's chunk section is not loaded or it is not a filler block.- Parameters:
chunkGrid- The chunk grid to read the filler from.position- The candidate target block position.- Returns:
- The base block position, or
positionif no offset could be resolved.
-
setBlock
public static boolean setBlock(ChunkStore chunkStore, Ref<ChunkStore> sectionRef, ChunkSection section, BlockSection blockSection, BlockComponentSection blockComponentSection, HeightmapColumn heightmapColumn, int x, int y, int z, int id, @Nonnull BlockType blockType, int rotation, int filler, int settings) -
setBlock
public static boolean setBlock(@Nonnull ChunkStore chunkStore, @Nonnull Ref<ChunkStore> sectionRef, int x, int y, int z, int id, @Nonnull BlockType blockType, int rotation, int filler, int settings) UsesetBlock(ChunkGrid, Ref, int, int, int, int, BlockType, int, int, int)instead when applicable. -
updateBlockArea
public static void updateBlockArea(ChunkStore chunkStore, ChunkSection chunkSection, BlockSection section, BlockType blockType, int rotation, int x, int y, int z) UseupdateBlockArea(ChunkGrid, ChunkSection, BlockSection, BlockType, int, int, int, int)instead when applicable. -
updateBlockArea
public static void updateBlockArea(ChunkStore chunkStore, ChunkSection chunkSection, BlockSection section, int x, int y, int z) UseupdateBlockArea(ChunkGrid, ChunkSection, BlockSection, int, int, int)instead when applicable. -
spawnBlockParticles
public static void spawnBlockParticles(ChunkStore chunkStore, int oldBlockId, int newBlockId, int x, int y, int z, boolean isPhysics) UsespawnBlockParticles(ChunkGrid, int, int, int, int, int, boolean)instead when applicable. -
setBlockInteractionState
public static void setBlockInteractionState(@Nonnull ChunkStore chunkStore, @Nonnull Ref<ChunkStore> chunkSectionReference, int x, int y, int z, @Nonnull BlockType blockType, @Nonnull String state, boolean force) UsesetBlockInteractionState(ChunkGrid, Ref, int, int, int, BlockType, String, boolean)instead when applicable. -
resolveBaseBlockPosition
@Nonnull public static BlockPosition resolveBaseBlockPosition(@Nonnull ChunkStore chunkStore, @Nonnull BlockPosition position) UseresolveBaseBlockPosition(ChunkGrid, BlockPosition)instead when applicable.
-