public override bool OnBlockInteractStart(IWorldAccessor world, IPlayer byPlayer, BlockSelection blockSel)
        {
            BlockEntityCondenser be = world.BlockAccessor.GetBlockEntity(blockSel.Position) as BlockEntityCondenser;

            if (be?.OnBlockInteractStart(byPlayer, blockSel) == true)
            {
                return(true);
            }

            return(base.OnBlockInteractStart(world, byPlayer, blockSel));
        }
示例#2
0
        private void onBurnTick(float dt)
        {
            if (firepitStage == 6 && !IsBurning)
            {
                GetBehavior <BEBehaviorFirepitAmbient>()?.ToggleAmbientSounds(false);
                firepitStage++;
                MarkDirty(true);
            }

            if (IsBurning)
            {
                heatLiquid(dt);
            }

            double dh = Api.World.Calendar.TotalHours - lastTickTotalHours;

            if (dh > 0.1f)
            {
                if (IsBurning)
                {
                    fuelHours -= (float)dh;
                }
                lastTickTotalHours = Api.World.Calendar.TotalHours;
            }


            var props = DistProps;

            if (InputStackTemp >= 75 && props != null)
            {
                distillationAccum += dt * props.Ratio;

                if (distillationAccum >= 0.2f)
                {
                    distillationAccum -= 0.2f;

                    for (int i = 0; i < 4; i++)
                    {
                        BlockEntityCondenser becd = Api.World.BlockAccessor.GetBlockEntity(Pos.AddCopy(BlockFacing.HORIZONTALS[i])) as BlockEntityCondenser;
                        if (becd != null)
                        {
                            props?.DistilledStack.Resolve(Api.World, "distillationprops");
                            if (becd.ReceiveDistillate(inventory[0], props))
                            {
                                break;
                            }
                        }
                    }
                }
            }
        }
        public override string GetPlacedBlockInfo(IWorldAccessor world, BlockPos pos, IPlayer forPlayer)
        {
            StringBuilder dsc = new StringBuilder();

            dsc.AppendLine(base.GetPlacedBlockInfo(world, pos, forPlayer));

            BlockEntityCondenser be = world.BlockAccessor.GetBlockEntity(pos) as BlockEntityCondenser;

            if (be?.Inventory[1].Empty == false)
            {
                BlockLiquidContainerBase block = be.Inventory[1].Itemstack.Collectible as BlockLiquidContainerBase;
                dsc.Append("Bucket: ");
                block.GetContentInfo(be.Inventory[1], dsc, world);
            }

            return(dsc.ToString());
        }