-
Notifications
You must be signed in to change notification settings - Fork 2
[1.21.1] Events
InsaneLib fires custom events on the NeoForge.EVENT_BUS. Subscribe to them using the standard NeoForge @SubscribeEvent mechanism.
Fired before eating effects (from FoodProperties) are applied to an entity. Cancelling the event prevents the vanilla effects from being applied.
Bus: NeoForge.EVENT_BUS | Cancellable: yes
| Method | Type | Info |
|---|---|---|
getEntity() |
LivingEntity |
The entity that ate the food |
getFoodProperties() |
FoodProperties |
The food properties of the eaten item |
Fired when a block is about to be burnt by fire.
Bus: NeoForge.EVENT_BUS | Cancellable: no
| Method | Type | Info |
|---|---|---|
getLevel() |
LevelAccessor |
The level the block is in |
getPos() |
BlockPos |
The position of the block |
getState() |
BlockState |
The block state that is about to be burnt |
Fired after a player has successfully eaten a cake block.
Bus: NeoForge.EVENT_BUS | Cancellable: no
| Method | Type | Info |
|---|---|---|
getEntity() |
Player |
The player who ate the cake |
getPos() |
BlockPos |
The position of the cake block |
getLevel() |
LevelAccessor |
The level the cake is in |
Fired when a falling block entity successfully lands.
Bus: NeoForge.EVENT_BUS | Cancellable: no
| Method | Type | Info |
|---|---|---|
getFallingBlock() |
FallingBlockEntity |
The falling block entity that landed |
Fired on ItemStack#hurt after the Unbreaking enchantment has been applied to the damage amount. Modify amount to change how much durability is actually consumed.
Bus: NeoForge.EVENT_BUS | Cancellable: no
| Method | Type | Info |
|---|---|---|
getStack() |
ItemStack |
The item stack being damaged |
getAmount() |
int |
The current damage amount (after Unbreaking) |
setAmount(int) |
— | Overrides the damage amount |
getOriginalAmount() |
int |
The damage amount before any modification |
getRandom() |
RandomSource |
The random source used for the hurt calculation |
getLivingEntity() |
LivingEntity (nullable) |
The entity holding the item, or null if none |
Fired when exhaustion is about to be added to a player. Modify amount to change how much exhaustion is applied.
Bus: NeoForge.EVENT_BUS | Cancellable: no
| Method | Type | Info |
|---|---|---|
getEntity() |
Player |
The player receiving exhaustion |
getAmount() |
float |
The current exhaustion amount |
setAmount(float) |
— | Overrides the exhaustion amount |
getOriginalAmount() |
float |
The exhaustion amount before any modification |
Fired when the game checks whether the player is allowed to sprint. Cancelling the event prevents the player from sprinting.
Bus: NeoForge.EVENT_BUS | Cancellable: yes | Side: client only
| Method | Type | Info |
|---|---|---|
getPlayer() |
LocalPlayer |
The local player attempting to sprint |
canSprint() |
boolean |
Returns true if the event has not been cancelled |
Fired when the game calculates the movement speed modifier applied while the player is using an item (e.g. drawing a bow). Modify speedModifier to change the slowdown. The vanilla default is 0.2.
Bus: NeoForge.EVENT_BUS | Cancellable: no | Side: client only
| Method | Type | Info |
|---|---|---|
getPlayer() |
LocalPlayer |
The local player using the item |
getUseItem() |
ItemStack |
The item currently being used |
getSpeedModifier() |
float |
The current speed modifier |
setSpeedModifier(float) |
— | Overrides the speed modifier |