Fix fluid autocrafting (#221)

* Fix fluid autocrafting

Depends on https://github.com/GTNewHorizons/Applied-Energistics-2-Unofficial/pull/545

* update

* update

* rename

* Add FluidCraftingInventoryHandler so that fluid crafting isn't handled in Pass 2

* update deps

---------

Co-authored-by: hiroscho <hiroscho.games@gmail.com>
Co-authored-by: Dream Master <dream-master@gmx.net>
This commit is contained in:
authored and GitHub committed 2024-08-18 14:29:36 +02:00
1 parent e09525bc88
commit c6c5d162a1
3 files changed
+45 -12

No files matched your search

@@ -264,9 +264,42 @@ public class TileFluidDiscretizer extends AENetworkTile implements IPriorityHost
}
}
private class FluidCraftingInventoryHandler extends MEInventoryHandler<IAEFluidStack> {
public FluidCraftingInventoryHandler(IMEInventory<IAEFluidStack> i, StorageChannel channel) {
super(i, channel);
}
@Override
public boolean isPrioritized(IAEFluidStack input) {
return true;
}
@Override
public boolean canAccept(IAEFluidStack input) {
ICraftingGrid craftingGrid;
try {
craftingGrid = getProxy().getGrid().getCache(ICraftingGrid.class);
} catch (GridAccessException e) {
return false;
}
if (craftingGrid instanceof CraftingGridCache craftingGridCache) {
return craftingGridCache.canAccept(ItemFluidDrop.newAeStack(input));
}
return false;
}
@Override
public boolean isAutoCraftingInventory() {
return true;
}
}
private class FluidCraftingInventory implements IMEInventory<IAEFluidStack> {
private final MEInventoryHandler<IAEFluidStack> invHandler = new MEInventoryHandler<>(this, getChannel());
private final MEInventoryHandler<IAEFluidStack> invHandler = new FluidCraftingInventoryHandler(
this,
getChannel());
FluidCraftingInventory() {
invHandler.setPriority(Integer.MAX_VALUE);