Skip to content

Commit

Permalink
fix creative crates on contraptions crashing
Browse files Browse the repository at this point in the history
  • Loading branch information
TropheusJ committed Aug 3, 2023
1 parent d7a7d53 commit b616f99
Showing 1 changed file with 16 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -40,10 +40,14 @@ public long extract(ItemVariant resource, long maxAmount, TransactionContext tra
return 0;
}

protected ItemStack getStack() {
ItemStack stack = suppliedItemStack.get();
return stack == null || stack.isEmpty() ? ItemStack.EMPTY : stack;
}

@Override
public boolean isResourceBlank() {
ItemStack stack = suppliedItemStack.get();
return stack == null || stack.isEmpty();
return getStack().isEmpty();
}

@Override
Expand All @@ -63,6 +67,16 @@ public long getCapacity() {

// avoid the slot list

@Override
public ItemStack getStackInSlot(int slot) {
return getStack();
}

@Override
public ItemVariant getVariantInSlot(int slot) {
return getResource();
}

@Override
public Iterator<StorageView<ItemVariant>> iterator() {
return SingleSlotStorage.super.iterator(); // singleton iterator on this
Expand Down

0 comments on commit b616f99

Please sign in to comment.