Class PaperItemBehavior
java.lang.Object
net.momirealms.craftengine.core.item.behavior.ItemBehavior
fr.robie.machineengine.api.paper.PaperItemBehavior
public abstract class PaperItemBehavior
extends net.momirealms.craftengine.core.item.behavior.ItemBehavior
A CraftEngine item behavior written with Bukkit types (D32): right-clicks with the item in the main
hand arrive as one
use(Use), whether on a block or in the air, and useOnEntity(Player, ItemStack, Entity) on an
entity. Return true when the click was handled: it is then cancelled, as a listener would.
CraftEngine calls these on the player's thread. A click on a vanilla block that opens something
(a chest, a furnace) reaches the item only while the player sneaks; a click on a machine reaches it
only when the behavior is also a MachineTool.
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic final recordA right-click with the item. -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionprotected booleanuse(@NotNull PaperItemBehavior.Use use) final net.momirealms.craftengine.core.entity.player.InteractionResultuse(net.momirealms.craftengine.core.world.World world, @Nullable net.momirealms.craftengine.core.entity.player.Player player, net.momirealms.craftengine.core.entity.player.InteractionHand hand) final net.momirealms.craftengine.core.entity.player.InteractionResultuseOnBlock(net.momirealms.craftengine.core.world.context.UseOnContext context) final net.momirealms.craftengine.core.entity.player.InteractionResultuseOnEntity(net.momirealms.craftengine.core.world.context.InteractEntityContext context) protected booleanuseOnEntity(@NotNull org.bukkit.entity.Player player, @NotNull org.bukkit.inventory.ItemStack item, @NotNull org.bukkit.entity.Entity target) Methods inherited from class net.momirealms.craftengine.core.item.behavior.ItemBehavior
getFirst, let, onBreakBlock
-
Constructor Details
-
PaperItemBehavior
public PaperItemBehavior()
-
-
Method Details
-
use
- Returns:
- whether the click was handled (it is cancelled)
-
useOnEntity
protected boolean useOnEntity(@NotNull @NotNull org.bukkit.entity.Player player, @NotNull @NotNull org.bukkit.inventory.ItemStack item, @NotNull @NotNull org.bukkit.entity.Entity target) - Returns:
- whether the click was handled (it is cancelled)
-
useOnBlock
public final net.momirealms.craftengine.core.entity.player.InteractionResult useOnBlock(net.momirealms.craftengine.core.world.context.UseOnContext context) - Overrides:
useOnBlockin classnet.momirealms.craftengine.core.item.behavior.ItemBehavior
-
use
public final net.momirealms.craftengine.core.entity.player.InteractionResult use(net.momirealms.craftengine.core.world.World world, @Nullable net.momirealms.craftengine.core.entity.player.Player player, net.momirealms.craftengine.core.entity.player.InteractionHand hand) - Overrides:
usein classnet.momirealms.craftengine.core.item.behavior.ItemBehavior
-
useOnEntity
public final net.momirealms.craftengine.core.entity.player.InteractionResult useOnEntity(net.momirealms.craftengine.core.world.context.InteractEntityContext context) - Overrides:
useOnEntityin classnet.momirealms.craftengine.core.item.behavior.ItemBehavior
-