StaffHandler

public abstract class StaffHandler(source)

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

Inheritors

Constructors

Link copied to clipboard

Types

Link copied to clipboard
public class Empty extends StaffHandler

Handler of a staff with no item inserted into it.

Link copied to clipboard
public class Fallback extends StaffHandler

Default implementation of StaffHandler. Used for staffs with no registered handler.

Link copied to clipboard

Properties

Link copied to clipboard

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

Link copied to clipboard
public final static StaffHandler.Registry Registry

Functions

Link copied to clipboard
public Boolean allowComponentsUpdateAnimation(ItemStack oldStaffStack, ItemStack newStaffStack, PlayerEntity player, Hand hand)

Called on the client side by Fabric API, when the NBT of the held item gets updated.

Link copied to clipboard
public Boolean allowReequipAnimation(ItemStack oldStaffStack, ItemStack newStaffStack, Boolean selectedSlotChanged)

Called on the client side by Neo/Forge, when the NBT of the held item gets updated.

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

Called on both the client by Architectury API and the server by Staff Mod, when an entity attacks thin air with a staff.

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

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

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

Called on both the client by Fabric/Neo/Forge API and the server by Fabric/Neo/Forge API, when an entity attacks an entity with a staff.

Link copied to clipboard
public Boolean canSwingHand(ItemStack staffStack, World world, LivingEntity holder, Hand hand)

Called on both the client and the server by Staff Mod on Fabric and Neo/Forge API on Neo/Forge, when an entity holding a staff tries to swing its hand.

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

Returns if attacking with the staff should disable the target's shield.

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 getMaxUseTime).

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

Called on both the client and the server my Minecraft to get the number of ticks the staff can be used for using the current item.

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 getMaxUseTime. 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, LivingEntity 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.