Skip to content

Commit

Permalink
fix alchemist cauldron worldly container implementation
Browse files Browse the repository at this point in the history
  • Loading branch information
iron431 committed Sep 28, 2024
1 parent 15fdd59 commit 420d6a1
Showing 1 changed file with 5 additions and 8 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -476,16 +476,19 @@ protected static void createBottleEmptyInteraction(Object2ObjectOpenHashMap<Item
***********************************************************/
@Override
public int[] getSlotsForFace(Direction pSide) {
//any side has access to all four input items
return new int[]{0, 1, 2, 3};
}

@Override
public boolean canPlaceItemThroughFace(int pIndex, ItemStack pItemStack, @Nullable Direction pDirection) {
return inputItems.stream().anyMatch(ItemStack::isEmpty) && isValidInput(pItemStack);
//any side can insert a valid item into any empty slot
return inputItems.get(pIndex).isEmpty() && isValidInput(pItemStack);
}

@Override
public boolean canTakeItemThroughFace(int pIndex, ItemStack pStack, Direction pDirection) {
//cannot automatically withdraw items
return false;
}

Expand All @@ -507,17 +510,11 @@ public boolean isEmpty() {

@Override
public ItemStack getItem(int pSlot) {
/*
This should only be getting used by the hopper, but the hopper messing with the reference we return.
Therefore, we want to effectively make our stuff private because of the wacky rules the cauldron is subject to
This shouldn't mess with other stuff, but I'm unfortunately not familiar with the 150+ uses of the interface to say certainly. (and then there's other mods)
*/
return /*pSlot >= 0 && pSlot <= inputItems.size() ? inputItems.get(pSlot) : */ItemStack.EMPTY;
return pSlot >= 0 && pSlot <= inputItems.size() ? inputItems.get(pSlot) : ItemStack.EMPTY;
}

@Override
public ItemStack removeItem(int pSlot, int pAmount) {
//stack size is always one inside the cauldron, so we should be able to ignore amount
return pSlot >= 0 && pSlot <= inputItems.size() ? inputItems.remove(pSlot) : ItemStack.EMPTY;
}

Expand Down

0 comments on commit 420d6a1

Please sign in to comment.