Contents
Class BlockPlaceUtils
java.lang.Object
com.hypixel.hytale.server.core.modules.interaction.BlockPlaceUtils
A class of useful utility functions for the process of placing a block.
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic booleancanPlaceBlock(BlockType blockType, String placedBlockTypeKey) Determines if a given block type can be used by an entity to place another block type (to handle validation of placement logic changing the placed block, such as placement rulesets)static booleanplaceBlock(Ref<EntityStore> ref, ItemStack itemStack, String blockTypeKey, ItemContainer itemContainer, org.joml.Vector3i placementNormal, org.joml.Vector3i blockPosition, BlockRotation blockRotation, byte activeSlot, boolean removeItemInHand, Ref<ChunkStore> sectionReference, ComponentAccessor<ChunkStore> chunkStore, ComponentAccessor<EntityStore> entityStore, boolean quickReplace, boolean quickRetype, boolean noPhysics) Called to handle a place block request from a specific player instance.
-
Constructor Details
-
BlockPlaceUtils
public BlockPlaceUtils()
-
-
Method Details
-
placeBlock
public static boolean placeBlock(@Nonnull Ref<EntityStore> ref, @Nullable ItemStack itemStack, @Nullable String blockTypeKey, @Nonnull ItemContainer itemContainer, @Nonnull org.joml.Vector3i placementNormal, @Nonnull org.joml.Vector3i blockPosition, @Nonnull BlockRotation blockRotation, byte activeSlot, boolean removeItemInHand, @Nonnull Ref<ChunkStore> sectionReference, @Nonnull ComponentAccessor<ChunkStore> chunkStore, @Nonnull ComponentAccessor<EntityStore> entityStore, boolean quickReplace, boolean quickRetype, boolean noPhysics) Called to handle a place block request from a specific player instance.- Parameters:
ref- The entity reference of the instigating entity.itemStack- The item stack that was in hand, if any.blockTypeKey- The block type key of the block to be placed, if any.itemContainer- TheItemContainerassociated with the instigating entity.placementNormal- The normal of the face of the block that was placed against.blockPosition- The target position to place the block.blockRotation- The rotation of the block.activeSlot- The active hotbar slot that the held item stack occupies.removeItemInHand- Whether to remove the item in the players hand after placing.sectionReference- TheRef<ChunkStore>of the chunk section the block is being placed in.chunkStore- TheComponentAccessor<ChunkStore>for component access.entityStore- TheComponentAccessor<EntityStore>for component access.quickReplace- The creative mode quick setting regarding replacing a block without having to break it.quickRetype- The creative mode quick setting regarding retyping a block in place without having to break it.noPhysics- Whether physics updates and placement validation should be suppressed.
-
canPlaceBlock
public static boolean canPlaceBlock(@Nonnull BlockType blockType, @Nonnull String placedBlockTypeKey) Determines if a given block type can be used by an entity to place another block type (to handle validation of placement logic changing the placed block, such as placement rulesets)- Parameters:
blockType- the block type used for placementplacedBlockTypeKey- the block type the client- Returns:
trueif a block type can be validly used to place a given block type key, false otherwise
-