Search in sources :

Example 1 with EntityTravelToDimensionEvent

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

the class ForgeHooks method onTravelToDimension.

public static boolean onTravelToDimension(Entity entity, int dimension) {
    EntityTravelToDimensionEvent event = new EntityTravelToDimensionEvent(entity, dimension);
    MinecraftForge.EVENT_BUS.post(event);
    if (event.isCanceled()) {
        // Revert variable back to true as it would have been set to false
        if (entity instanceof EntityMinecartContainer) {
            ((EntityMinecartContainer) entity).dropContentsWhenDead = true;
        }
    }
    return !event.isCanceled();
}
Also used : EntityMinecartContainer(net.minecraft.entity.item.EntityMinecartContainer) EntityTravelToDimensionEvent(net.minecraftforge.event.entity.EntityTravelToDimensionEvent)

Aggregations

EntityMinecartContainer (net.minecraft.entity.item.EntityMinecartContainer)1 EntityTravelToDimensionEvent (net.minecraftforge.event.entity.EntityTravelToDimensionEvent)1