public override void OnHeldInteractStart(ItemSlot itemslot, EntityAgent byEntity, BlockSelection blockSel, EntitySelection entitySel, bool firstEvent, ref EnumHandHandling handling) { if (blockSel == null) { return; } BlockEntity be = byEntity.World.BlockAccessor.GetBlockEntity(blockSel.Position.AddCopy(blockSel.Face.Opposite)); IPlayer byPlayer = null; if (byEntity is EntityPlayer) { byPlayer = byEntity.World.PlayerByUid(((EntityPlayer)byEntity).PlayerUID); } if (byPlayer != null && be is BlockEntityIngotMold) { BlockEntityIngotMold beim = (BlockEntityIngotMold)be; if (beim.OnPlayerInteract(byPlayer, blockSel.Face, blockSel.HitPosition)) { handling = EnumHandHandling.PreventDefault; } } }
public override bool OnBlockInteractStart(IWorldAccessor world, IPlayer byPlayer, BlockSelection blockSel) { if (blockSel == null) { return(false); } BlockEntity be = world.BlockAccessor.GetBlockEntity(blockSel.Position); if (be is BlockEntityIngotMold) { BlockEntityIngotMold beim = (BlockEntityIngotMold)be; return(beim.OnPlayerInteract(byPlayer, blockSel.Face, blockSel.HitPosition)); } return(false); }