Class EntityMobGriefingEvent
java.lang.Object
net.neoforged.bus.api.Event
net.neoforged.neoforge.event.entity.EntityEvent
net.neoforged.neoforge.event.entity.EntityMobGriefingEvent
EntityMobGriefingEvent is fired when mob griefing is about to occur and allows an event listener to specify whether it should or not.
This event is fired when ever the mob griefing game rule is checked.
This event is fired when ever the mob griefing game rule is checked.
-
Nested Class Summary
Nested classes/interfaces inherited from class net.neoforged.neoforge.event.entity.EntityEvent
EntityEvent.EnteringSection, EntityEvent.EntityConstructing, EntityEvent.Size
-
Field Summary
Modifier and TypeFieldDescriptionprivate boolean
private final boolean
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionboolean
canGrief()
Returns if the entity is allowed to perform the griefing action.boolean
Returns if the mob griefing game rule is enabled.void
setCanGrief
(boolean canGrief) Changes if the entity is allowed to perform the griefing action.Methods inherited from class net.neoforged.neoforge.event.entity.EntityEvent
getEntity
-
Field Details
-
isMobGriefingEnabled
private final boolean isMobGriefingEnabled -
canGrief
private boolean canGrief
-
-
Constructor Details
-
EntityMobGriefingEvent
-
-
Method Details
-
isMobGriefingEnabled
public boolean isMobGriefingEnabled()Returns if the mob griefing game rule is enabled.The default state of this event is equivalent to this value.
-
setCanGrief
public void setCanGrief(boolean canGrief) Changes if the entity is allowed to perform the griefing action.- Parameters:
canGrief
- True if the action should be allowed, false otherwise.
-
canGrief
public boolean canGrief()Returns if the entity is allowed to perform the griefing action.- Returns:
- if the entity is allowed to perform the griefing action
-