public override WorldInteraction[] GetPlacedBlockInteractionHelp(IWorldAccessor world, BlockSelection selection, IPlayer forPlayer) { if (selection.SelectionBoxIndex == 0) { return(new WorldInteraction[] { new WorldInteraction() { ActionLangCode = "blockhelp-quern-addremoveitems", MouseButton = EnumMouseButton.Right } }.Append(base.GetPlacedBlockInteractionHelp(world, selection, forPlayer))); } else { return(new WorldInteraction[] { new WorldInteraction() { ActionLangCode = "blockhelp-quern-grind", MouseButton = EnumMouseButton.Right, ShouldApply = (wi, bs, es) => { BlockEntityQuern beQuern = world.BlockAccessor.GetBlockEntity(bs.Position) as BlockEntityQuern; return beQuern != null && beQuern.CanGrind(); } } }.Append(base.GetPlacedBlockInteractionHelp(world, selection, forPlayer))); } }
public override void OnBlockInteractStop(float secondsUsed, IWorldAccessor world, IPlayer byPlayer, BlockSelection blockSel) { BlockEntityQuern beQuern = world.BlockAccessor.GetBlockEntity(blockSel.Position) as BlockEntityQuern; if (beQuern != null) { beQuern.SetPlayerGrinding(byPlayer, false); } }
public override bool OnBlockInteractStep(float secondsUsed, IWorldAccessor world, IPlayer byPlayer, BlockSelection blockSel) { BlockEntityQuern beQuern = world.BlockAccessor.GetBlockEntity(blockSel.Position) as BlockEntityQuern; if (beQuern != null) { return(beQuern.CanGrind()); } return(false); }
public override bool OnBlockInteractCancel(float secondsUsed, IWorldAccessor world, IPlayer byPlayer, BlockSelection blockSel, EnumItemUseCancelReason cancelReason) { BlockEntityQuern beQuern = world.BlockAccessor.GetBlockEntity(blockSel.Position) as BlockEntityQuern; if (beQuern != null) { beQuern.SetPlayerGrinding(byPlayer, false); } return(true); }
public override bool OnBlockInteractStep(float secondsUsed, IWorldAccessor world, IPlayer byPlayer, BlockSelection blockSel) { BlockEntityQuern beQuern = world.BlockAccessor.GetBlockEntity(blockSel.Position) as BlockEntityQuern; if (beQuern != null && (blockSel.SelectionBoxIndex == 1 || beQuern.Inventory.openedByPlayerGUIds.Contains(byPlayer.PlayerUID))) { beQuern.IsGrinding(byPlayer); return(beQuern.CanGrind()); } return(false); }
public override bool OnBlockInteractStart(IWorldAccessor world, IPlayer byPlayer, BlockSelection blockSel) { BlockEntityQuern beQuern = world.BlockAccessor.GetBlockEntity(blockSel.Position) as BlockEntityQuern; if (beQuern != null && beQuern.CanGrind() && (blockSel.SelectionBoxIndex == 1 || beQuern.Inventory.openedByPlayerGUIds.Contains(byPlayer.PlayerUID))) { beQuern.SetPlayerGrinding(byPlayer, true); return(true); } return(base.OnBlockInteractStart(world, byPlayer, blockSel)); }
public override bool OnBlockInteractStart(IWorldAccessor world, IPlayer byPlayer, BlockSelection blockSel) { if (blockSel.SelectionBoxIndex == 1) { BlockEntityQuern beQuern = world.BlockAccessor.GetBlockEntity(blockSel.Position) as BlockEntityQuern; if (beQuern != null && beQuern.CanGrind()) { beQuern.SetPlayerGrinding(byPlayer, true); return(true); } } return(base.OnBlockInteractStart(world, byPlayer, blockSel)); }