Exemplo n.º 1
0
        public override bool OnBlockInteractStart(IWorldAccessor world, IPlayer byPlayer, BlockSelection blockSel)
        {
            BlockPos pos = blockSel.Position;

            if (!ControllerBlock)
            {
                pos = GetControllerBlockPositionOrNull(blockSel.Position);
            }

            if (pos == null)
            {
                return(base.OnBlockInteractStart(world, byPlayer, blockSel));
            }

            BlockEntityStoneCoffin besc = world.BlockAccessor.GetBlockEntity(pos) as BlockEntityStoneCoffin;

            if (besc != null)
            {
                bool placed = besc.Interact(byPlayer, !ControllerBlock);
                (byPlayer as IClientPlayer)?.TriggerFpAnimation(EnumHandInteract.HeldItemInteract);
                return(true);
            }

            return(base.OnBlockInteractStart(world, byPlayer, blockSel));
        }
        public int GetTemperature(IWorldAccessor world, BlockPos pos)
        {
            if (!ControllerBlock)
            {
                pos = GetControllerBlockPositionOrNull(pos);
            }

            if (pos == null)
            {
                return(0);
            }

            BlockEntityStoneCoffin besc = world.BlockAccessor.GetBlockEntity(pos) as BlockEntityStoneCoffin;

            if (besc != null)
            {
                return(besc.CoffinTemperature);
            }

            return(0);
        }