Beispiel #1
0
        public override bool Interact(Level level, Player player, BlockCoordinates blockCoordinates, BlockFace face, Vector3 faceCoord)
        {
            var itemInHand = player.Inventory.GetItemInHand();

            if (itemInHand is ItemDye && itemInHand.Metadata == 15)
            {
                var random = new Random();
                for (int i = 0; i < 3; i++)
                {
                    var particle = new LegacyParticle((int)ParticleType.VillagerHappy, level)
                    {
                        Position = (Vector3)Coordinates
                                   + (new Vector3(0.5f, 0.5f, 0.5f)
                                      + new Vector3((float)(random.NextDouble() - 0.5D), (float)(random.NextDouble() - 0.5D), (float)(random.NextDouble() - 0.5D)))
                    };
                    particle.Spawn();
                }

                if (random.NextDouble() < 0.45)
                {
                    OnTick(level, true);
                    return(true);
                }
            }

            return(false);
        }
Beispiel #2
0
        public override void DespawnEntity()
        {
            for (int i = 0; i < 6; i++)
            {
                var particle = new LegacyParticle(ParticleType.SnowballPoof, Level)
                {
                    Position = KnownPosition
                };
                particle.Spawn();
            }

            base.DespawnEntity();
        }