Skip to content

Commit

Permalink
Fix null stacks being used in Chute and creative cache
Browse files Browse the repository at this point in the history
  • Loading branch information
founderio committed Dec 15, 2018
1 parent 95e6a9a commit a3bc4c3
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 9 deletions.
10 changes: 5 additions & 5 deletions common/net/teamio/taam/content/common/TileEntityChute.java
Original file line number Diff line number Diff line change
Expand Up @@ -38,14 +38,14 @@ public int insertItemAt(ItemStack stack, int slot, boolean simulate) {

ItemStack notAdded = ItemHandlerHelper.insertItemStacked(target, stack, simulate);
int added = stack.getCount();
if(notAdded != null)
if(!InventoryUtils.isEmpty(notAdded))
added -= notAdded.getCount();
return added;
}

@Override
public ItemStack removeItemAt(int slot, int amount, boolean simulate) {
return null;
return ItemStack.EMPTY;
}

@Override
Expand Down Expand Up @@ -145,14 +145,14 @@ public ItemStack insertItem(int slot, ItemStack stack, boolean simulate) {
item.motionZ = 0;
world.spawnEntity(item);
}
return null;
return ItemStack.EMPTY;
}
return stack;
}

@Override
public ItemStack getStackInSlot(int slot) {
return null;
return ItemStack.EMPTY;
}

@Override
Expand All @@ -167,7 +167,7 @@ public int getSlotLimit(int slot) {

@Override
public ItemStack extractItem(int slot, int amount, boolean simulate) {
return null;
return ItemStack.EMPTY;
}
};
}
Expand Down
8 changes: 4 additions & 4 deletions common/net/teamio/taam/conveyors/OutputChute.java
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@ public static boolean chuteMechanicsOutput(World world, BlockPos oututPosition,
// Output to world
for(int i = 0; i < backlog.length; i++) {
ItemStack itemStack = backlog[i];
if(itemStack == null) {
if(InventoryUtils.isEmpty(itemStack)) {
continue;
}
EntityItem item = new EntityItem(world, entX, entY, entZ, itemStack);
Expand All @@ -75,19 +75,19 @@ public static boolean chuteMechanicsOutput(World world, BlockPos oututPosition,
item.motionZ = 0;
world.spawnEntity(item);
wasAble = true;
backlog[i] = null;
backlog[i] = ItemStack.EMPTY;
}

hasOutputLeft = false;
} else {
// Output to inventory
for(int i = 0; i < backlog.length; i++) {
ItemStack itemStack = backlog[i];
if(itemStack == null) {
if(InventoryUtils.isEmpty(itemStack)) {
continue;
}
backlog[i] = ItemHandlerHelper.insertItemStacked(outputInventory, itemStack, false);
if(backlog[i] == null) {
if(backlog[i] == ItemStack.EMPTY) {
wasAble = true;
} else {
hasOutputLeft = true;
Expand Down

0 comments on commit a3bc4c3

Please sign in to comment.