Search in sources :

Example 1 with EntityMobGriefingEvent

use of net.minecraftforge.event.entity.EntityMobGriefingEvent in project MinecraftForge by MinecraftForge.

the class ForgeEventFactory method getMobGriefingEvent.

public static boolean getMobGriefingEvent(Level world, Entity entity) {
    EntityMobGriefingEvent event = new EntityMobGriefingEvent(entity);
    MinecraftForge.EVENT_BUS.post(event);
    Result result = event.getResult();
    return result == Result.DEFAULT ? world.getGameRules().getBoolean(GameRules.RULE_MOBGRIEFING) : result == Result.ALLOW;
}
Also used : EntityMobGriefingEvent(net.minecraftforge.event.entity.EntityMobGriefingEvent) InteractionResult(net.minecraft.world.InteractionResult) Result(net.minecraftforge.eventbus.api.Event.Result) HitResult(net.minecraft.world.phys.HitResult)

Aggregations

InteractionResult (net.minecraft.world.InteractionResult)1 HitResult (net.minecraft.world.phys.HitResult)1 EntityMobGriefingEvent (net.minecraftforge.event.entity.EntityMobGriefingEvent)1 Result (net.minecraftforge.eventbus.api.Event.Result)1