Example #1
0
		protected virtual void HandlePlayerDropItem(McpeDropItem message)
		{
			lock (Inventory)
			{
				var stack = message.item.Value;
				Log.Debug($"Player {Username} drops item with inv slot: {message.itemtype} and Item ID: {stack.Id} with count item count: {stack.Count}");


				if (!VerifyItemStack(stack)) return;

				// Clear current inventory slot.
				{
					var itemEntity = new ItemEntity(Level, stack.Item)
					{
						Velocity = KnownPosition.GetDirection()*0.7,
						KnownPosition =
						{
							X = KnownPosition.X,
							Y = KnownPosition.Y + 1.62f,
							Z = KnownPosition.Z
						},
						Count = stack.Count
					};

					itemEntity.SpawnEntity();
				}
			}
		}
Example #2
0
        protected virtual void HandlePlayerDropItem(McpeDropItem message)
        {
            if (!Inventory.HasItem(message.item)) return;

            ItemStack itemStack = message.item.Value;

            Item item = ItemFactory.GetItem(itemStack.Id, itemStack.Metadata);

            var itemEntity = new ItemEntity(Level, item)
            {
                KnownPosition =
                {
                    X = KnownPosition.X,
                    Y = KnownPosition.Y,
                    Z = KnownPosition.Z
                },
                Count = itemStack.Count
            };

            itemEntity.SpawnEntity();
        }