Flattened parts
This commit is contained in:
parent
de45f3e68d
commit
8987311694
28 changed files with 515 additions and 437 deletions
|
@ -28,7 +28,6 @@ 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;
|
||||
|
||||
|
||||
public class ItemCells {
|
||||
|
|
|
@ -24,85 +24,46 @@
|
|||
|
||||
package techreborn.items;
|
||||
|
||||
import com.google.common.base.CaseFormat;
|
||||
import net.minecraft.creativetab.CreativeTabs;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.util.NonNullList;
|
||||
import net.minecraft.world.World;
|
||||
import techreborn.Core;
|
||||
import techreborn.client.EGui;
|
||||
import techreborn.init.ModItems;
|
||||
import techreborn.utils.TechRebornCreativeTab;
|
||||
|
||||
import java.security.InvalidParameterException;
|
||||
|
||||
public class ItemParts extends ItemTR {
|
||||
public static final String[] types = new String[] { "energy_flow_circuit", "data_control_circuit", "data_storage_circuit",
|
||||
"data_orb", "diamond_grinding_head", "diamond_saw_blade", "tungsten_grinding_head", "helium_coolant_simple",
|
||||
"helium_coolant_triple", "helium_coolant_six", "nak_coolant_simple", "nak_coolant_triple", "nak_coolant_six",
|
||||
"cupronickel_heating_coil", "nichrome_heating_coil", "kanthal_heating_coil", "super_conductor",
|
||||
"thorium_cell", "double_thorium_cell", "quad_thorium_cell", "plutonium_cell", "double_plutonium_cell",
|
||||
"quad_plutonium_cell", "computer_monitor", "machine_parts", "neutron_reflector", "iridium_neutron_reflector",
|
||||
"thick_neutron_reflector", "electronic_circuit", "advanced_circuit", "sap", "rubber", "scrap",
|
||||
"carbon_mesh", "carbon_fiber", "coolant_simple", "coolant_triple", "coolant_six"};
|
||||
|
||||
public ItemParts() {
|
||||
this.setCreativeTab(TechRebornCreativeTab.instance);
|
||||
this.setHasSubtypes(true);
|
||||
this.setTranslationKey("techreborn.part");
|
||||
}
|
||||
|
||||
public static ItemStack getPartByName(String name, final int count) {
|
||||
//TODO: Change all recipes n' shit to use proper snake_case names so I don't have to do this bullshit
|
||||
if (name.equals("NaKCoolantSimple"))
|
||||
name = "nak_coolant_simple";
|
||||
if (name.equals("NaKCoolantTriple"))
|
||||
name = "nak_coolant_triple";
|
||||
if (name.equals("NaKCoolantSix"))
|
||||
name = "nak_coolant_six";
|
||||
if (name.equals("superconductor"))
|
||||
name = "super_conductor";
|
||||
if (name.equals("carbonfiber"))
|
||||
name = "carbon_fiber";
|
||||
if (name.equals("carbonmesh"))
|
||||
name = "carbon_mesh";
|
||||
if (name.equals("rubberSap"))
|
||||
name = "sap";
|
||||
name = CaseFormat.LOWER_CAMEL.to(CaseFormat.LOWER_UNDERSCORE, name);
|
||||
for (int i = 0; i < ItemParts.types.length; i++) {
|
||||
if (ItemParts.types[i].equalsIgnoreCase(name)) {
|
||||
return new ItemStack(ModItems.PARTS, count, i);
|
||||
}
|
||||
}
|
||||
throw new InvalidParameterException("The part " + name + " could not be found.");
|
||||
}
|
||||
|
||||
public static ItemStack getPartByName(final String name) {
|
||||
return ItemParts.getPartByName(name, 1);
|
||||
}
|
||||
|
||||
@Override
|
||||
// gets Unlocalized Name depending on meta data
|
||||
public String getTranslationKey(final ItemStack itemStack) {
|
||||
int meta = itemStack.getItemDamage();
|
||||
if (meta < 0 || meta >= ItemParts.types.length) {
|
||||
meta = 0;
|
||||
}
|
||||
|
||||
return super.getTranslationKey() + "." + ItemParts.types[meta];
|
||||
}
|
||||
|
||||
// Adds Dusts SubItems To Creative Tab
|
||||
@Override
|
||||
public void getSubItems(final CreativeTabs creativeTabs, final NonNullList<ItemStack> list) {
|
||||
if (!isInCreativeTab(creativeTabs)) {
|
||||
return;
|
||||
}
|
||||
for (int meta = 0; meta < ItemParts.types.length; ++meta) {
|
||||
list.add(new ItemStack(this, 1, meta));
|
||||
}
|
||||
}
|
||||
// public static ItemStack getPartByName(String name, final int count) {
|
||||
// //TODO: Change all recipes n' shit to use proper snake_case names so I don't have to do this bullshit
|
||||
// if (name.equals("NaKCoolantSimple"))
|
||||
// name = "nak_coolant_simple";
|
||||
// if (name.equals("NaKCoolantTriple"))
|
||||
// name = "nak_coolant_triple";
|
||||
// if (name.equals("NaKCoolantSix"))
|
||||
// name = "nak_coolant_six";
|
||||
// if (name.equals("superconductor"))
|
||||
// name = "super_conductor";
|
||||
// if (name.equals("carbonfiber"))
|
||||
// name = "carbon_fiber";
|
||||
// if (name.equals("carbonmesh"))
|
||||
// name = "carbon_mesh";
|
||||
// if (name.equals("rubberSap"))
|
||||
// name = "sap";
|
||||
// name = CaseFormat.LOWER_CAMEL.to(CaseFormat.LOWER_UNDERSCORE, name);
|
||||
// for (int i = 0; i < ItemParts.types.length; i++) {
|
||||
// if (ItemParts.types[i].equalsIgnoreCase(name)) {
|
||||
// return new ItemStack(ModItems.PARTS, count, i);
|
||||
// }
|
||||
// }
|
||||
// throw new InvalidParameterException("The part " + name + " could not be found.");
|
||||
// }
|
||||
//
|
||||
// public static ItemStack getPartByName(final String name) {
|
||||
// return ItemParts.getPartByName(name, 1);
|
||||
// }
|
||||
|
||||
public ItemStack onItemRightClick(final ItemStack itemStack, final World world, final EntityPlayer player) {
|
||||
switch (itemStack.getItemDamage()) {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue