mirror of
https://github.com/GTNewHorizons/Mantle.git
synced 2026-11-18 11:19:20 +00:00
Fix tile inventory
This commit is contained in:
1 parent
5a997ae395
commit
b153a00bbf
1 file changed
+7
-10
@@ -21,6 +21,8 @@ import java.util.Arrays;
|
||||
|
||||
import javax.annotation.Nonnull;
|
||||
|
||||
import slimeknights.mantle.util.ItemStackList;
|
||||
|
||||
// Updated version of InventoryLogic in Mantle. Also contains a few bugfixes
|
||||
public class TileInventory extends MantleTileEntity implements IInventory {
|
||||
|
||||
@@ -81,17 +83,12 @@ public class TileInventory extends MantleTileEntity implements IInventory {
|
||||
}
|
||||
|
||||
public void resize(int size) {
|
||||
//TODO: Make sure this didn't break inventory contents.
|
||||
NonNullList<ItemStack> oldInventory = inventory;
|
||||
|
||||
inventory = NonNullList.<ItemStack> withSize(size, ItemStack.EMPTY);
|
||||
|
||||
for (int i = 0; i < size; i++) {
|
||||
ItemStack itemStack = oldInventory.get(i);
|
||||
if (!itemStack.isEmpty()) {
|
||||
inventory.set(i, itemStack);
|
||||
}
|
||||
ItemStackList newInventory = ItemStackList.withSize(size);
|
||||
|
||||
for (int i = 0; i < size && i < inventory.size(); i++) {
|
||||
newInventory.set(i, inventory.get(i));
|
||||
}
|
||||
inventory = newInventory;
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
Reference in new issue
Block a user