TechReborn/src/main/java/techreborn/items/ItemCells.java

50 lines
1.6 KiB
Java
Raw Normal View History

2015-04-17 00:42:05 +02:00
package techreborn.items;
2016-03-25 10:47:34 +01:00
2015-04-17 00:42:05 +02:00
import net.minecraft.item.ItemStack;
import net.minecraftforge.fluids.Fluid;
import net.minecraftforge.fluids.FluidRegistry;
import org.apache.commons.lang3.Validate;
import reborncore.common.util.StringUtils;
import techreborn.init.ModItems;
2015-04-17 00:42:05 +02:00
public class ItemCells
2016-03-25 10:47:34 +01:00
{
@Deprecated
2016-03-25 10:47:34 +01:00
public static final String[] types = new String[] { "Berylium", "biomass", "calciumCarbonate", "calcium", "carbon",
"chlorine", "deuterium", "diesel", "ethanol", "glyceryl", "helium3", "helium", "heliumPlasma", "hydrogen",
"ice", "lithium", "mercury", "methane", "nitrocarbon", "nitroCoalfuel", "nitroDiesel", "nitrogen",
"nitrogenDioxide", "oil", "potassium", "seedOil", "silicon", "sodium", "sodiumPersulfate", "sodiumSulfide",
"sulfur", "sulfuricAcid", "tritium", "wolframium", "empty", "lava", "water" };
@Deprecated
public static ItemStack getCellByName(String name, int count, boolean lookForIC2)
2016-03-25 10:47:34 +01:00
{
return getCellByName(name, count);
2016-03-25 10:47:34 +01:00
}
public static ItemStack getCellByName(String name, int count)
2016-03-25 10:47:34 +01:00
{
if(name.equalsIgnoreCase("empty") || name.equalsIgnoreCase("cell")){
return new ItemStack(ModItems.emptyCell, count);
}
2016-03-25 10:47:34 +01:00
Fluid fluid = FluidRegistry.getFluid("fluid" + name.toLowerCase());
if(fluid == null) {
fluid = FluidRegistry.getFluid(name.toLowerCase());
if(fluid == null) {
fluid = FluidRegistry.getFluid("fluid" + StringUtils.toFirstCapital(name.toLowerCase()));
2016-03-25 10:47:34 +01:00
}
}
Validate.notNull(fluid, "The fluid " + name + " could not be found");
return DynamicCell.getCellWithFluid(fluid, count);
2016-03-25 10:47:34 +01:00
}
public static ItemStack getCellByName(String name)
{
return getCellByName(name, 1);
}
2015-04-17 00:42:05 +02:00
}