Class BlockInteractionUtils

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

public class BlockInteractionUtils extends Object
A utility class that contains useful functions for block-related interactions.
  • Constructor Details

    • BlockInteractionUtils

      public BlockInteractionUtils()
  • Method Details

    • runRootInteractionOnBlock

      public static void runRootInteractionOnBlock(@Nonnull Ref<EntityStore> ref, @Nonnull Store<EntityStore> store, @Nonnull String rootId, @Nullable BlockPosition targetBlock, @Nullable BlockPosition targetBlockRaw)
      Runs a root interaction as a Use on a block, after the interaction that found the block has ended. It applies the world allowlist and the interaction rules, as a player-started chain does. Call it on the world thread, since it writes to the store.
      Parameters:
      targetBlock - The block the root acts on. Null runs it with no block.
      targetBlockRaw - The raw block position. Null falls back to targetBlock.
    • isNaturalAction

      public static boolean isNaturalAction(@Nullable Ref<EntityStore> ref, @Nonnull ComponentAccessor<EntityStore> componentAccessor)
      Determines whether the block action is natural or artificial.

      Useful for preventing specific block rules from being considered while altering the world in creative mode.

      Parameters:
      ref - The entity reference of the instigating entity.
      componentAccessor - The ComponentAccessor for component access.
      Returns:
      true if it's a natural block action, false otherwise.
    • isNoPhysics

      public static boolean isNoPhysics(@Nullable Ref<EntityStore> ref, @Nonnull ComponentAccessor<EntityStore> componentAccessor)