Esempio n. 1
0
        public override bool OnBlockInteractStart(IWorldAccessor world, IPlayer byPlayer, BlockSelection blockSel)
        {
            if (world.Side.IsServer())
            {
                BlockEntityWell well = blockSel.Position.BlockEntity(world) as BlockEntityWell;
                well?.Interact(byPlayer.InventoryManager.ActiveHotbarSlot, byPlayer.Entity);
            }
            else
            {
                (byPlayer as IClientPlayer).TriggerFpAnimation(EnumHandInteract.HeldItemInteract);
            }

            return(true);
        }
Esempio n. 2
0
        public override string GetPlacedBlockInfo(IWorldAccessor world, BlockPos pos, IPlayer forPlayer)
        {
            StringBuilder   bdr  = new StringBuilder(base.GetPlacedBlockInfo(world, pos, forPlayer));
            BlockEntityWell well = pos.BlockEntity(world) as BlockEntityWell;

            if (well != null)
            {
                int progress = (int)GameMath.Min((float)Math.Round(100 * well.MiningProgress), 100f);
                bdr.AppendLine("Depth: " + well.Depth)
                .AppendLine("FoundLiquid: " + well.FoundLiquidCode)
                .AppendLine("Mining Progress: " + progress + "%")
                .AppendLine("Mining Difficulty: " + Math.Round(100 * (1.0f - well.Difficulty)) + "%");
            }

            return(bdr.ToString());
        }