Class BlockPlaceUtils

java.lang.Object
com.hypixel.hytale.server.core.modules.interaction.BlockPlaceUtils

public class BlockPlaceUtils extends Object
A class of useful utility functions for the process of placing a block.
  • 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 - The ItemContainer associated 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 - The Ref<ChunkStore> of the chunk section the block is being placed in.
      chunkStore - The ComponentAccessor<ChunkStore> for component access.
      entityStore - The ComponentAccessor<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 placement
      placedBlockTypeKey - the block type the client
      Returns:
      true if a block type can be validly used to place a given block type key, false otherwise