コード例 #1
0
        public override string GetPlacedBlockInfo(IWorldAccessor world, BlockPos Pos, IPlayer forPlayer)
        {
            StringBuilder            builder         = new StringBuilder(base.GetPlacedBlockInfo(world, Pos, forPlayer));
            BlockEntityDryingStation craftingStation = (Pos.BlockEntity(world) as BlockEntityDryingStation);
            ItemStack stack = craftingStation?.inventory?[0]?.Itemstack;

            builder = stack != null?builder.AppendLine().AppendLine(stack.StackSize + "x " +
                                                                    Lang.Get("incontainer-" + stack.Class.ToString().ToLowerInvariant() + "-" + stack.Collectible.Code.Path)) : builder;

            return(builder.ToString());
        }
コード例 #2
0
        public override string GetPlacedBlockInfo(IWorldAccessor world, BlockPos Pos, IPlayer forPlayer)
        {
            StringBuilder            builder         = new StringBuilder(base.GetPlacedBlockInfo(world, Pos, forPlayer));
            BlockEntityDryingStation craftingStation = (Pos.BlockEntity(world) as BlockEntityDryingStation);
            ItemStack stack = craftingStation?.inventory?[0]?.Itemstack;

            builder = stack != null?builder.AppendLine().AppendLine(stack.StackSize + "x " +
                                                                    Lang.Get("incontainer-" + stack.Class.ToString().ToLowerInvariant() + "-" + stack.Collectible.Code.Path)) : builder.AppendLine();

            if (craftingStation != null)
            {
                int hours = (int)Math.Round(craftingStation.timeWhenDone - world.Calendar.TotalHours);
                hours = hours < 0 ? 0 : hours;

                builder.AppendLine("Remaining Drying Time: " + hours.ToString() + " Hours");
            }
            return(builder.ToString());
        }