Contents
Class BlockInteractionUtils
java.lang.Object
com.hypixel.hytale.server.core.modules.interaction.BlockInteractionUtils
A utility class that contains useful functions for block-related interactions.
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic booleanisNaturalAction(Ref<EntityStore> ref, ComponentAccessor<EntityStore> componentAccessor) Determines whether the block action is natural or artificial.static booleanisNoPhysics(Ref<EntityStore> ref, ComponentAccessor<EntityStore> componentAccessor) static voidrunRootInteractionOnBlock(Ref<EntityStore> ref, Store<EntityStore> store, String rootId, BlockPosition targetBlock, BlockPosition targetBlockRaw) Runs a root interaction as a Use on a block, after the interaction that found the block has ended.
-
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 totargetBlock.
-
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- TheComponentAccessorfor component access.- Returns:
trueif it's a natural block action,falseotherwise.
-
isNoPhysics
public static boolean isNoPhysics(@Nullable Ref<EntityStore> ref, @Nonnull ComponentAccessor<EntityStore> componentAccessor)
-