Class ItemFishedEvent
java.lang.Object
net.neoforged.bus.api.Event
net.neoforged.neoforge.event.entity.EntityEvent
net.neoforged.neoforge.event.entity.living.LivingEvent
net.neoforged.neoforge.event.entity.player.PlayerEvent
net.neoforged.neoforge.event.entity.player.ItemFishedEvent
- All Implemented Interfaces:
net.neoforged.bus.api.ICancellableEvent
This event is called when a player fishes an item.
This event is
ICancellableEvent
Canceling the event will cause the player to receive no items at all.
The hook will still take the damage specified-
Nested Class Summary
Nested classes/interfaces inherited from class net.neoforged.neoforge.event.entity.player.PlayerEvent
PlayerEvent.BreakSpeed, PlayerEvent.Clone, PlayerEvent.HarvestCheck, PlayerEvent.ItemCraftedEvent, PlayerEvent.ItemSmeltedEvent, PlayerEvent.LoadFromFile, PlayerEvent.NameFormat, PlayerEvent.PlayerChangedDimensionEvent, PlayerEvent.PlayerChangeGameModeEvent, PlayerEvent.PlayerLoggedInEvent, PlayerEvent.PlayerLoggedOutEvent, PlayerEvent.PlayerRespawnEvent, PlayerEvent.SaveToFile, PlayerEvent.StartTracking, PlayerEvent.StopTracking, PlayerEvent.TabListNameFormat
Nested classes/interfaces inherited from class net.neoforged.neoforge.event.entity.living.LivingEvent
LivingEvent.LivingJumpEvent, LivingEvent.LivingVisibilityEvent
Nested classes/interfaces inherited from class net.neoforged.neoforge.event.entity.EntityEvent
EntityEvent.EnteringSection, EntityEvent.EntityConstructing, EntityEvent.Size
-
Field Summary
Fields -
Constructor Summary
ConstructorsConstructorDescriptionItemFishedEvent
(List<net.minecraft.world.item.ItemStack> stacks, int rodDamage, net.minecraft.world.entity.projectile.FishingHook hook) -
Method Summary
Modifier and TypeMethodDescriptionvoid
damageRodBy
(int rodDamage) Specifies the amount of damage that the fishing rod should take.net.minecraft.core.NonNullList
<net.minecraft.world.item.ItemStack> getDrops()
Use this to get the items the player will receive.net.minecraft.world.entity.projectile.FishingHook
Use this to stuff related to the hook itself, like the position of the bobber.int
Get the damage the rod will take.Methods inherited from class net.neoforged.neoforge.event.entity.player.PlayerEvent
getEntity
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
Methods inherited from interface net.neoforged.bus.api.ICancellableEvent
isCanceled, setCanceled
-
Field Details
-
stacks
private final net.minecraft.core.NonNullList<net.minecraft.world.item.ItemStack> stacks -
hook
private final net.minecraft.world.entity.projectile.FishingHook hook -
rodDamage
private int rodDamage
-
-
Constructor Details
-
ItemFishedEvent
public ItemFishedEvent(List<net.minecraft.world.item.ItemStack> stacks, int rodDamage, net.minecraft.world.entity.projectile.FishingHook hook)
-
-
Method Details
-
getRodDamage
public int getRodDamage()Get the damage the rod will take.- Returns:
- The damage the rod will take
-
damageRodBy
public void damageRodBy(@Nonnegative int rodDamage) Specifies the amount of damage that the fishing rod should take. This is not added to the pre-existing damage to be taken.- Parameters:
rodDamage
- The damage the rod will take. Must be nonnegative
-
getDrops
public net.minecraft.core.NonNullList<net.minecraft.world.item.ItemStack> getDrops()Use this to get the items the player will receive. You cannot use this to modify the drops the player will get. If you want to affect the loot, you should use LootTables. -
getHookEntity
public net.minecraft.world.entity.projectile.FishingHook getHookEntity()Use this to stuff related to the hook itself, like the position of the bobber.
-