|
2 | 2 |
|
3 | 3 | import com.jaquadro.minecraft.storagedrawers.block.tile.TileEntityDrawers;
|
4 | 4 | import com.jaquadro.minecraft.storagedrawers.client.renderer.StorageRenderItem;
|
| 5 | +import com.jaquadro.minecraft.storagedrawers.item.ItemUpgrade; |
5 | 6 | import net.minecraft.entity.player.EntityPlayer;
|
6 | 7 | import net.minecraft.entity.player.InventoryPlayer;
|
7 | 8 | import net.minecraft.inventory.Container;
|
@@ -113,23 +114,28 @@ public ItemStack transferStackInSlot (EntityPlayer player, int slotIndex) {
|
113 | 114 |
|
114 | 115 | // Try merge inventory to upgrades
|
115 | 116 | else if (slotIndex >= inventoryStart && slotIndex < hotbarEnd && slotStack != null) {
|
116 |
| - /*if (slotStack.getItem() == ModItems.upgrade || slotStack.getItem() == ModItems.upgradeStatus || slotStack.getItem() == ModItems.upgradeVoid) { |
| 117 | + if (slotStack.getItem() instanceof ItemUpgrade) { |
117 | 118 | ItemStack slotStack1 = slotStack.copy();
|
118 | 119 | slotStack1.stackSize = 1;
|
119 | 120 |
|
120 | 121 | if (!mergeItemStack(slotStack1, upgradeStart, upgradeEnd, false)) {
|
121 |
| - if (slotIndex >= inventoryStart && slotIndex < hotbarEnd) { |
| 122 | + if (slotIndex >= inventoryStart && slotIndex < hotbarStart) { |
122 | 123 | if (!mergeItemStack(slotStack, hotbarStart, hotbarEnd, false))
|
123 | 124 | return null;
|
124 | 125 | } else if (slotIndex >= hotbarStart && slotIndex < hotbarEnd && !mergeItemStack(slotStack, inventoryStart, hotbarStart, false))
|
125 | 126 | return null;
|
126 | 127 | }
|
127 | 128 | else {
|
128 | 129 | slotStack.stackSize--;
|
129 |
| - } |
130 |
| - }*/ |
| 130 | + if (slotStack.stackSize == 0) |
| 131 | + slot.putStack(null); |
| 132 | + else |
| 133 | + slot.onSlotChanged(); |
131 | 134 |
|
132 |
| - if (slotIndex >= inventoryStart && slotIndex < hotbarStart) { |
| 135 | + slot.onPickupFromSlot(player, slotStack); |
| 136 | + return null; |
| 137 | + } |
| 138 | + } else if (slotIndex >= inventoryStart && slotIndex < hotbarStart) { |
133 | 139 | if (!mergeItemStack(slotStack, hotbarStart, hotbarEnd, false))
|
134 | 140 | return null;
|
135 | 141 | } else if (slotIndex >= hotbarStart && slotIndex < hotbarEnd && !mergeItemStack(slotStack, inventoryStart, hotbarStart, false))
|
|
0 commit comments