Fix purification chamber being able to accept wrong gases directly from IGasItems #5502

Also improved handling overall for how IGasItem is treated by the GasConversionHandler, so that we better obey the gastank we are going to try and insert into
This commit is contained in:
pupnewfster committed 2019-06-08 11:28:38 -04:00
1 parent 33957bde59
commit 180183fcbd
7 files changed
+73 -89

No files matched your search

@@ -3,14 +3,11 @@ package mekanism.common.tile;
import java.util.Map;
import mekanism.api.gas.Gas;
import mekanism.api.gas.GasStack;
import mekanism.api.gas.IGasItem;
import mekanism.common.block.states.BlockStateMachine.MachineType;
import mekanism.common.recipe.RecipeHandler.Recipe;
import mekanism.common.recipe.inputs.AdvancedMachineInput;
import mekanism.common.recipe.machines.PurificationRecipe;
import mekanism.common.tile.prefab.TileEntityAdvancedElectricMachine;
import mekanism.common.util.GasUtils;
import net.minecraft.item.ItemStack;
import net.minecraft.util.EnumFacing;
public class TileEntityPurificationChamber extends TileEntityAdvancedElectricMachine<PurificationRecipe> {
@@ -37,20 +34,6 @@ public class TileEntityPurificationChamber extends TileEntityAdvancedElectricMac
return gasTank.canReceive(type) && isValidGas(type);
}
@Override
public void handleSecondaryFuel() {
ItemStack itemStack = inventory.get(1);
if (!itemStack.isEmpty() && gasTank.getNeeded() > 0 && itemStack.getItem() instanceof IGasItem) {
GasStack gas = ((IGasItem) itemStack.getItem()).getGas(itemStack);
if (gas != null) {
GasStack removed = GasUtils.removeGas(itemStack, gas.getGas(), gasTank.getNeeded());
gasTank.receive(removed, true);
return;
}
}
super.handleSecondaryFuel();
}
@Override
public boolean isValidGas(Gas gas) {
return Recipe.PURIFICATION_CHAMBER.containsRecipe(gas);