mirror of
https://github.com/Thorfusion/Mekanism-Community-Edition.git
synced 2026-11-26 06:42:56 +00:00
NEI Support for GasifyableAPI
Adds NEI Support for mods that use the new Gasifyable API
This commit is contained in:
1 parent
1d671e7594
commit
ec828a3d4a
4 files changed
+31
-41
No files matched your search
@@ -4,13 +4,13 @@ import mekanism.common.util.MekanismUtils;
|
||||
import net.minecraft.item.ItemStack;
|
||||
|
||||
import java.util.ArrayList;
|
||||
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
public class GasifyableItems {
|
||||
|
||||
static HashMap<String, GasStack> gasifyableItems = new HashMap<String, GasStack>();
|
||||
static HashMap<String, GasStack> gasifyableItems = new HashMap<>();
|
||||
static List<Gas> validGases = new ArrayList<>();
|
||||
|
||||
/**
|
||||
@@ -51,9 +51,23 @@ public class GasifyableItems {
|
||||
return null;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the oredict associated to a gas.
|
||||
* @param gas type of gas to check its paired oredict
|
||||
* @return oredict associated to this gas
|
||||
*/
|
||||
public static String getItemFromGas(Gas gas) {
|
||||
|
||||
for (Map.Entry<String, GasStack> map : gasifyableItems.entrySet()) {
|
||||
if(map.getValue().getGas() == gas)
|
||||
return map.getKey();
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* defines which gases the Chemical Injection Chamber can accept.
|
||||
* Defines which gases the Chemical Injection Chamber can accept.
|
||||
* @param gas type of gas to check validity
|
||||
* @return if block accepts gas
|
||||
*/
|
||||
|
||||
@@ -5,8 +5,7 @@ import java.util.Collection;
|
||||
import java.util.List;
|
||||
|
||||
import mekanism.api.gas.Gas;
|
||||
import mekanism.api.gas.GasRegistry;
|
||||
import mekanism.api.util.ListUtils;
|
||||
import mekanism.api.gas.GasifyableItems;
|
||||
import mekanism.client.gui.GuiChemicalInjectionChamber;
|
||||
import mekanism.client.gui.element.GuiProgress.ProgressBar;
|
||||
import mekanism.common.Tier.GasTankTier;
|
||||
@@ -46,46 +45,24 @@ public class ChemicalInjectionChamberRecipeHandler extends AdvancedMachineRecipe
|
||||
@Override
|
||||
public List<ItemStack> getFuelStacks(Gas gasType)
|
||||
{
|
||||
if(gasType == GasRegistry.getGas("sulfuricAcid"))
|
||||
{
|
||||
List<ItemStack> fuels = new ArrayList<ItemStack>();
|
||||
fuels.addAll(OreDictionary.getOres("dustSulfur"));
|
||||
if(GasifyableItems.isGasValidGasifyable(gasType)) {
|
||||
|
||||
for(GasTankTier tier : GasTankTier.values())
|
||||
{
|
||||
fuels.add(MekanismUtils.getFullGasTank(tier, GasRegistry.getGas("sulfuricAcid")));
|
||||
String oredict = GasifyableItems.getItemFromGas(gasType);
|
||||
List<ItemStack> fuels = new ArrayList<>();
|
||||
|
||||
if (oredict != null && !OreDictionary.getOres(oredict).isEmpty())
|
||||
fuels.addAll(OreDictionary.getOres(oredict));
|
||||
|
||||
if (gasType.isVisible()) {
|
||||
|
||||
for (GasTankTier tier : GasTankTier.values())
|
||||
fuels.add(MekanismUtils.getFullGasTank(tier, gasType));
|
||||
}
|
||||
|
||||
return fuels;
|
||||
}
|
||||
else if(gasType == GasRegistry.getGas("water"))
|
||||
{
|
||||
for(GasTankTier tier : GasTankTier.values())
|
||||
{
|
||||
return ListUtils.asList(MekanismUtils.getFullGasTank(tier, GasRegistry.getGas("water")));
|
||||
}
|
||||
}
|
||||
else if(gasType == GasRegistry.getGas("hydrogenChloride"))
|
||||
{
|
||||
List<ItemStack> fuels = new ArrayList<ItemStack>();
|
||||
fuels.addAll(OreDictionary.getOres("dustSalt"));
|
||||
|
||||
for(GasTankTier tier : GasTankTier.values())
|
||||
{
|
||||
fuels.add(MekanismUtils.getFullGasTank(tier, GasRegistry.getGas("hydrogenChloride")));
|
||||
}
|
||||
|
||||
return fuels;
|
||||
}
|
||||
else if(gasType == GasRegistry.getGas("molasse"))
|
||||
{
|
||||
List<ItemStack> fuels = new ArrayList<ItemStack>();
|
||||
fuels.addAll(OreDictionary.getOres("dustSugar"));
|
||||
|
||||
return fuels;
|
||||
}
|
||||
|
||||
return new ArrayList<ItemStack>();
|
||||
return new ArrayList<>();
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -1448,7 +1448,6 @@ public class Mekanism
|
||||
GasifyableItems.registerGasifyables("dustSulfur", GasRegistry.getGas("sulfuricAcid"), 2);
|
||||
GasifyableItems.registerGasifyables("dustSalt", GasRegistry.getGas("hydrogenChloride"), 2);
|
||||
GasifyableItems.registerGasifyables("dustSugar", GasRegistry.getGas("molasse"), 90);
|
||||
GasifyableItems.registerGasifyables("listAllSugar", GasRegistry.getGas("molasse"), 90);
|
||||
|
||||
GasifyableItems.registerGasifyables(GasRegistry.getGas("water"));
|
||||
|
||||
|
||||
@@ -45,7 +45,7 @@ public class TileEntityChemicalInjectionChamber extends TileEntityAdvancedElectr
|
||||
}
|
||||
else
|
||||
if(Block.getBlockFromItem(itemstack.getItem()) == MekanismBlocks.GasTank && ((IGasItem)itemstack.getItem()).getGas(itemstack) != null &&
|
||||
isValidGas(((IGasItem)itemstack.getItem()).getGas(itemstack).getGas())) return new GasStack(GasRegistry.getGas("sulfuricAcid"), 1);
|
||||
isValidGas(((IGasItem)itemstack.getItem()).getGas(itemstack).getGas())) return new GasStack(((IGasItem)itemstack.getItem()).getGas(itemstack).getGas(), 1);
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user