Skip to content

Commit

Permalink
Fix potion filling/draining emi compat (#1349)
Browse files Browse the repository at this point in the history
* Fix #1340

* fix potential issue

* fix gametests
  • Loading branch information
IThundxr authored Mar 1, 2024
1 parent fba7fc2 commit e8b7fed
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -305,8 +305,7 @@ private void addDeferredRecipes(Consumer<EmiRecipe> consumer) {
.distinct()
.toList();
for (EmiStack stack : EmiApi.getIndexStacks()) {
if (stack.getKey() instanceof ItemVariant iv) {
Item i = iv.getItem();
if (stack.getKey() instanceof Item i) {
ItemStack is = stack.getItemStack();
if (i instanceof PotionItem) {
FluidStack potion = PotionFluidHandler.getFluidFromPotionItem(is);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -351,10 +351,12 @@ public long getTotalItems(BlockPos pos) {
public void assertAnyContained(BlockPos pos, Item... items) {
Storage<ItemVariant> storage = itemStorageAt(pos);
boolean noneFound = true;
for (Item item : items) {
if (storage.extract(ItemVariant.of(item), 1, null) > 0) {
noneFound = false;
break;
try (Transaction t = TransferUtil.getTransaction()) {
for (Item item : items) {
if (storage.extract(ItemVariant.of(item), 1, t) > 0) {
noneFound = false;
break;
}
}
}
if (noneFound)
Expand Down

0 comments on commit e8b7fed

Please sign in to comment.