1313import appeng .core .localization .PlayerMessages ;
1414import appeng .fluids .util .AEFluidInventory ;
1515import appeng .fluids .util .AEFluidStack ;
16+ import appeng .helpers .InventoryAction ;
1617import appeng .parts .reporting .AbstractPartEncoder ;
1718import appeng .tile .inventory .AppEngInternalInventory ;
1819import appeng .util .Platform ;
1920import appeng .util .item .AEItemStack ;
2021import com .glodblock .github .common .item .fake .FakeFluids ;
22+ import com .glodblock .github .common .item .fake .FakeItemRegister ;
2123import com .glodblock .github .integration .mek .FakeGases ;
2224import com .glodblock .github .inventory .GuiType ;
2325import com .glodblock .github .inventory .InventoryHandler ;
4850import net .minecraftforge .fml .common .Optional ;
4951import net .minecraftforge .items .IItemHandler ;
5052import net .minecraftforge .items .IItemHandlerModifiable ;
53+ import net .minecraftforge .items .ItemHandlerHelper ;
5154
5255import javax .annotation .Nonnull ;
5356import java .io .IOException ;
@@ -402,4 +405,25 @@ public static void onPatternTerminalChangeCrafting(final AbstractPartEncoder par
402405 }
403406 }
404407
408+ @ Optional .Method (modid = "mekeng" )
409+ public static GasStack gasAction (InventoryAction action , Slot slot , ItemStack stack ) {
410+ GasStack gas = null ;
411+ switch (action ) {
412+ case PICKUP_OR_SET_DOWN -> {
413+ gas = Util .getGasFromItem (stack );
414+ slot .putStack (FakeGases .packGas2Drops (gas ));
415+ }
416+ case SPLIT_OR_PLACE_SINGLE -> {
417+ gas = Util .getGasFromItem (ItemHandlerHelper .copyStackWithSize (stack , 1 ));
418+ final GasStack origin = FakeItemRegister .getStack (slot .getStack ());
419+ if (gas != null && gas .equals (origin )) {
420+ gas .amount += origin .amount ;
421+ if (gas .amount <= 0 ) gas = null ;
422+ }
423+ slot .putStack (FakeGases .packGas2Drops (gas ));
424+ }
425+ }
426+ return gas ;
427+ }
428+
405429}
0 commit comments