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

44 lines
1.6 KiB
Java
Raw Normal View History

2015-04-17 00:42:05 +02:00
package techreborn.items;
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
2016-10-08 21:46:16 +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",
2016-10-08 21:46:16 +02:00
"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" };
2016-03-25 10:47:34 +01:00
@Deprecated
2016-10-08 21:46:16 +02:00
public static ItemStack getCellByName(String name, int count, boolean lookForIC2) {
return getCellByName(name, count);
2016-03-25 10:47:34 +01:00
}
2016-10-08 21:46:16 +02:00
public static ItemStack getCellByName(String name, int count) {
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());
2016-10-08 21:46:16 +02:00
if (fluid == null) {
fluid = FluidRegistry.getFluid(name.toLowerCase());
2016-10-08 21:46:16 +02:00
if (fluid == null) {
fluid = FluidRegistry.getFluid("fluid" + StringUtils.toFirstCapital(name.toLowerCase()));
2016-03-25 10:47:34 +01:00
}
}
2016-10-08 21:46:16 +02:00
Validate.notNull(fluid, "The fluid " + name + " could not be found");
return DynamicCell.getCellWithFluid(fluid, count);
2016-03-25 10:47:34 +01:00
}
2016-10-08 21:46:16 +02:00
public static ItemStack getCellByName(String name) {
2016-03-25 10:47:34 +01:00
return getCellByName(name, 1);
}
2015-04-17 00:42:05 +02:00
}