Ejemplo n.º 1
0
        public void OnEnd()
        {
            var coordinates = _entity.KnownPosition;
            var direction   = Vector3.Normalize(coordinates.GetHeadDirection());

            BlockCoordinates coord = new Vector3(coordinates.X + direction.X, coordinates.Y, coordinates.Z + direction.Z);

            Block broken = null;

            if (_entity.Level.GetBlock(coord) is TallGrass)
            {
                broken = _entity.Level.GetBlock(coord);
                _entity.Level.SetAir(coord);
            }
            else
            {
                coord += BlockCoordinates.Down;
                broken = _entity.Level.GetBlock(coord);
                _entity.Level.SetBlock(new Dirt {
                    Coordinates = coord
                });
            }
            DestroyBlockParticle particle = new DestroyBlockParticle(_entity.Level, broken);

            particle.Spawn();
        }
Ejemplo n.º 2
0
        public virtual void BreakBlock(Level world, bool silent = false)
        {
            world.SetAir(Coordinates);

            if (!silent)
            {
                DestroyBlockParticle particle = new DestroyBlockParticle(world, this);
                particle.Spawn();
            }

            UpdateBlocks(world);
        }
Ejemplo n.º 3
0
        public virtual void BreakBlock(Level world, BlockFace face, bool silent = false)
        {
            world.SetAir(Coordinates);

            if (!silent)
            {
                var particle = new DestroyBlockParticle(world, this);
                particle.Spawn();
            }

            UpdateBlocks(world);
            world.BroadcastSound(Coordinates, LevelSoundEventType.BreakBlock, Id);
        }