Search in sources :

Example 1 with EntityPlaceEvent

use of net.minecraftforge.event.world.BlockEvent.EntityPlaceEvent in project MinecraftForge by MinecraftForge.

the class ForgeEventFactory method onBlockPlace.

public static boolean onBlockPlace(@Nullable Entity entity, @Nonnull BlockSnapshot blockSnapshot, @Nonnull Direction direction) {
    BlockState placedAgainst = blockSnapshot.getLevel().getBlockState(blockSnapshot.getPos().relative(direction.getOpposite()));
    EntityPlaceEvent event = new BlockEvent.EntityPlaceEvent(blockSnapshot, placedAgainst, entity);
    return MinecraftForge.EVENT_BUS.post(event);
}
Also used : EntityPlaceEvent(net.minecraftforge.event.world.BlockEvent.EntityPlaceEvent) BlockState(net.minecraft.world.level.block.state.BlockState)

Aggregations

BlockState (net.minecraft.world.level.block.state.BlockState)1 EntityPlaceEvent (net.minecraftforge.event.world.BlockEvent.EntityPlaceEvent)1