StaffItemHandler

abstract class StaffItemHandler(source)

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

See also

Inheritors

Constructors

Link copied to clipboard
constructor()

Types

Link copied to clipboard
object Companion
Link copied to clipboard
Link copied to clipboard

Properties

Link copied to clipboard
open val maxUseTime: Int

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

Link copied to clipboard
@get:Environment(value = EnvType.CLIENT)
abstract val staffItemRenderer: IStaffItemRenderer

The renderer of the item added to the staff, which renders the item as part of the staff model.

Functions

Link copied to clipboard
open fun allowNbtUpdateAnimation(oldStaffStack: ItemStack, newStaffStack: ItemStack, player: PlayerEntity, hand: Hand): Boolean

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

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

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

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

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

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

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

Link copied to clipboard
open fun finishUsing(staffStack: ItemStack, world: World, user: LivingEntity): ItemStack

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
open fun onStoppedUsing(staffStack: ItemStack, world: World, user: LivingEntity, remainingUseTicks: Int)

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
open fun usageTick(staffStack: ItemStack, world: World, user: LivingEntity, remainingUseTicks: Int)

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

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

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

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

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
open fun useOnEntity(staffStack: ItemStack, world: World, user: LivingEntity, target: LivingEntity, hand: Hand): ActionResult

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.