Exemplo n.º 1
0
        public override void UseItem(Level world, Player player, BlockCoordinates blockCoordinates)
        {
            float force = 1.5f;

            Snowball snowBall = new Snowball(player, world)
            {
                KnownPosition = (PlayerLocation) player.KnownPosition.Clone(),
                Velocity = new Vector3(blockCoordinates.X, blockCoordinates.Y, blockCoordinates.Z).Normalize()*force
            };
            snowBall.KnownPosition.Y += 1.62f;
            snowBall.SpawnEntity();
        }
Exemplo n.º 2
0
        public override void UseItem(Level world, Player player, BlockCoordinates blockCoordinates)
        {
            float force = 1.5f;

            Snowball snowBall = new Snowball(null, world);
            snowBall.KnownPosition = (PlayerLocation) player.KnownPosition.Clone();
            snowBall.KnownPosition.Y += 1.62f;
            snowBall.Velocity = snowBall.KnownPosition.GetDirection() * (force);
            snowBall.BroadcastMovement = false;
            snowBall.DespawnOnImpact = true;
            snowBall.SpawnEntity();
        }
Exemplo n.º 3
0
        public override void UseItem(Level world, Player player, BlockCoordinates blockCoordinates)
        {
            var inventory = player.Inventory;
            var itemInHand = inventory.GetItemInHand();

            itemInHand.Count--;
            if (itemInHand.Count <= 0)
            {
                // set empty
                inventory.Slots[inventory.Slots.IndexOf(itemInHand)] = new ItemStack();
            }

            float force = 1.5f;

            Snowball snowBall = new Snowball(null, world);
            snowBall.KnownPosition = (PlayerLocation) player.KnownPosition.Clone();
            snowBall.KnownPosition.Y += 1.62f;
            snowBall.Velocity = snowBall.KnownPosition.GetDirection() * (force);
            snowBall.BroadcastMovement = false;
            snowBall.DespawnOnImpact = true;
            snowBall.SpawnEntity();
        }