StaffItemHandler

public abstract class StaffItemHandler(source)

Provides functionality for a staff, when an item is inserted into it.

See also

Constructors

Link copied to clipboard

Properties

Link copied to clipboard
public final static StaffItemHandler DEFAULT
Link copied to clipboard
private final Integer maxUseTime

The number of ticks the staff can be used for using the current item.

Functions

Link copied to clipboard
public ActionResult attack(ItemStack staffStack, World world, LivingEntity attacker, Hand hand)

Called on both the client and the server by Staff Mod, when an entity attacks nothing (left clicks on air).

Link copied to clipboard
public ActionResult attackBlock(ItemStack staffStack, World world, LivingEntity attacker, BlockPos target, Direction side, Hand hand)

Called on both the client and the server by Fabric API, when an entity attacks a block.

Link copied to clipboard
public ActionResult attackEntity(ItemStack staffStack, World world, LivingEntity attacker, Entity target, Hand hand)

Called on both the client by Staff Mod and the server by Fabric API, when an entity attacks an entity.

Link copied to clipboard
public ItemStack finishUsing(ItemStack staffStack, World world, LivingEntity user)

Called on both the client and the server by Minecraft, when an entity finishes using the staff (usage ticks reach maxUseTime).

Link copied to clipboard

Gets the attribute modifiers (damage, attack speed, etc.) of the staff when held.

Link copied to clipboard
Link copied to clipboard
public Unit onStoppedUsing(ItemStack staffStack, World world, LivingEntity user, Integer remainingUseTicks)

Called on both the client and the server by Minecraft, when an entity stops using the staff before being used for maxUseTime. If that time is reached, finishUsing will be called.

Link copied to clipboard
public Unit usageTick(ItemStack staffStack, World world, LivingEntity user, Integer remainingUseTicks)

Called on both the client and the server by Minecraft every tick an entity uses the staff.

Link copied to clipboard
public TypedActionResult<ItemStack> use(ItemStack staffStack, World world, PlayerEntity user, Hand hand)

Called on both the client and the server by Minecraft when the player uses the staff.

Link copied to clipboard
public ActionResult useOnBlock(ItemStack staffStack, World world, LivingEntity user, BlockPos target, Direction side, Hand hand)

Called on both the client and the server by Minecraft, when an entity uses the staff on a block. This method may not be called, if the block handles the use event (for example, a chest).

Link copied to clipboard
public ActionResult useOnEntity(ItemStack staffStack, World world, LivingEntity user, LivingEntity target, Hand hand)

Called on both the client and the server by Minecraft, when an entity uses the staff on an entity. This method may not be called, if the entity handles the use event (for example, a horse). This method will not be called, if the player is in spectator mode.