Package net.neoforged.neoforge.event.entity.player
@ParametersAreNonnullByDefault
package net.neoforged.neoforge.event.entity.player
-
ClassDescriptionBase class used for advancement-related events.Fired when the player earns an advancement.Fired when the player's progress on an advancement criterion is granted or revoked.Fired when the player removes a "repaired" item from the Anvil's Output slot.ArrowLooseEvent is fired when a player stops using a bow.
This event is fired whenever a player stops using a bow inBowItem.releaseUsing(ItemStack, Level, LivingEntity, int)
.
ArrowLooseEvent.bow
contains the ItemBow ItemStack that was used in this event.
ArrowLooseEvent.charge
contains the value for how much the player had charged before stopping the shot.
This event isICancellableEvent
.
If this event is canceled, the player does not stop using the bow.
For crossbows, the charge will always be 1; Set it to -1 in order to prevent firing the arrow.ArrowNockEvent is fired when a player begins using a bow.
This event is fired whenever a player begins using a bow inBowItem.use(Level, Player, InteractionHand)
.
This event isICancellableEvent
.AttackEntityEvent is fired when a player attacks an Entity.
This event is fired whenever a player attacks an Entity inPlayer.attack(Entity)
.
AttackEntityEvent.target
contains the Entity that was damaged by the player.This event is called when a player attempts to use bone meal on a block.This event is fired when the game checks if a sleeping entity may continue sleeping.Called fromServerPlayer.startSleepInBed(BlockPos)
when a player attempts to sleep.This event is fired when a player attacks an entity inPlayer.attack(Entity)
.Parent class of the two events that fire when aPlayer
collides with anItemEntity
.This event is fired when anItemEntity
on the ground has been picked up by the player and after the item is added to the player's inventory.This event is fired when a player collides with anItemEntity
on the ground.This event is called when a player fishes an item.This event will fire when the player is opped or deopped.PlayerDestroyItemEvent is fired when a player destroys an item.
This event is fired whenever a player destroys an item inMultiPlayerGameMode.destroyBlock(BlockPos)
,MultiPlayerGameMode.useItem(Player, InteractionHand)
,MultiPlayerGameMode.useItemOn(LocalPlayer, InteractionHand, BlockHitResult)
,Player.attack(Entity)
,Player#hurtCurrentlyUsedShield(float)
,Player.interactOn(Entity, InteractionHand)
,CommonHooks.getCraftingRemainingItem(ItemStack)
,ServerPlayerGameMode.useItem(ServerPlayer, Level, ItemStack, InteractionHand)
,ServerPlayerGameMode.useItemOn(ServerPlayer, Level, ItemStack, InteractionHand, BlockHitResult)
andServerPlayerGameMode.destroyBlock(BlockPos)
.
PlayerDestroyItemEvent.original
contains the original ItemStack before the item was destroyed.PlayerEvent is fired whenever an event involving aPlayer
occurs.BreakSpeed is fired when a player attempts to harvest a block.
This event is fired whenever a player attempts to harvest a block inPlayer.getDigSpeed(BlockState, BlockPos)
.
This event is fired via theEventHooks.getBreakSpeed(Player, BlockState, float, BlockPos)
.
PlayerEvent.BreakSpeed.state
contains the block being broken.Fired when the EntityPlayer is cloned, typically caused by the impl sending a RESPAWN_PLAYER event.HarvestCheck is fired when a player attempts to harvest a block.
This event is fired whenever a player attempts to harvest a block inPlayer.hasCorrectToolForDrops(BlockState)
.
This event is fired via theEventHooks.doPlayerHarvestCheck(Player, BlockState, BlockGetter, BlockPos)
.
PlayerEvent.HarvestCheck.state
contains theBlockState
that is being checked for harvesting.The player is being loaded from the world save.NameFormat is fired when a player's display name is retrieved.
This event is fired whenever a player's name is retrieved inPlayer.getDisplayName()
orPlayer.refreshDisplayName()
.
This event is fired via theEventHooks.getPlayerDisplayName(Player, Component)
.
PlayerEvent.NameFormat.username
contains the username of the player.Fired when the game type of a server player is changed to a different value than what it was previously.The player is being saved to the world store.Fired when an Entity is started to be "tracked" by this player (the player receives updates about this entity, e.g.Fired when an Entity is stopped to be "tracked" by this player (the player no longer receives updates about this entity, e.g.TabListNameFormat is fired when a player's display name for the tablist is retrieved.
This event is fired whenever a player's display name for the tablist is retrieved inServerPlayer.getTabListDisplayName()
orServerPlayer.refreshTabListName()
.
This event is fired via theEventHooks.getPlayerTabListDisplayName(Player)
.
PlayerEvent.TabListNameFormat.getDisplayName()
contains the display name of the player or null if the client should determine the display name itself.Occurs when a player falls, but is able to fly.Fired byGui.HeartType.forPlayer(net.minecraft.world.entity.player.Player)
to allow mods to change the heart sprite which is displayed in the player's health bar.PlayerInteractEvent is fired when a player interacts in some way.This event is fired on both sides when the player right clicks an entity.This event is fired on both sides whenever a player right clicks an entity.This event is fired when a player left clicks while targeting a block.This event is fired on the client side when the player left clicks empty space with any ItemStack.This event is fired on both sides whenever the player right clicks while targeting a block.This event is fired on the client side when the player right clicks empty space with an empty hand.This event is fired on both sides before the player triggersItem.use(Level, Player, InteractionHand)
.This event is fired on the server when a connection has started the Forge handshake, Forge will wait for all enqueued work to be completed before proceeding further with the login process.Fired byinvalid reference
PlayerList#respawn(ServerPlayer, boolean)
This event is fired when a player's spawn point is set or reset.
The event can be canceled, which will prevent the spawn point from being changed.This event is fired fromPhantomSpawner.tick(net.minecraft.server.level.ServerLevel, boolean, boolean)
when phantoms would attempt to be spawned, with one event fired per player.Controls if the spawn attempt for the group of phantoms will occur.This event is fired when the player is waking up.
This is merely for purposes of listening for this to happen.
There is nothing that can be manipulated with this event.PlayerXpEvent is fired whenever an event involving player experience occurs.This event is fired when the player's experience level changes through thePlayer.giveExperienceLevels(int)
method.This event is fired after the player collides with an experience orb, but before the player has been given the experience.This event is fired when the player's experience changes through thePlayer.giveExperiencePoints(int)
method.Fired when a player trades with anAbstractVillager
.