public virtual bool TryPutItem(IPlayer player) { if (OwnStackSize >= MaxStackSize) { return(false); } IItemSlot hotbarSlot = player.InventoryManager.ActiveHotbarSlot; if (hotbarSlot.Itemstack == null) { return(false); } IItemSlot invSlot = inventory.GetSlot(0); if (invSlot.Itemstack == null) { invSlot.Itemstack = hotbarSlot.Itemstack.Clone(); invSlot.Itemstack.StackSize = 0; api.World.PlaySoundAt(SoundLocation, pos.X, pos.Y, pos.Z, null, false); } if (invSlot.Itemstack.Equals(api.World, hotbarSlot.Itemstack, GlobalConstants.IgnoredStackAttributes)) { int q = GameMath.Min(hotbarSlot.StackSize, TakeQuantity, MaxStackSize - OwnStackSize); invSlot.Itemstack.StackSize += q; if (player.WorldData.CurrentGameMode != EnumGameMode.Creative) { hotbarSlot.TakeOut(q); hotbarSlot.OnItemSlotModified(null); } api.World.PlaySoundAt(SoundLocation, pos.X, pos.Y, pos.Z, player, false); MarkDirty(); Cuboidf[] collBoxes = api.World.BlockAccessor.GetBlock(pos).GetCollisionBoxes(api.World.BlockAccessor, pos); if (collBoxes != null && collBoxes.Length > 0 && CollisionTester.AabbIntersect(collBoxes[0], pos.X, pos.Y, pos.Z, player.Entity.CollisionBox, player.Entity.LocalPos.XYZ)) { player.Entity.LocalPos.Y += collBoxes[0].Y2 - (player.Entity.LocalPos.Y - (int)player.Entity.LocalPos.Y); } return(true); } return(false); }