Updated getByName functions
Added storage block functions Fixed a bunch of getX() typeos
This commit is contained in:
parent
5c48dda843
commit
0f6747f703
15 changed files with 62 additions and 51 deletions
|
@ -15,9 +15,20 @@ import net.minecraftforge.common.util.ForgeDirection;
|
|||
import techreborn.client.TechRebornCreativeTabMisc;
|
||||
import cpw.mods.fml.relauncher.Side;
|
||||
import cpw.mods.fml.relauncher.SideOnly;
|
||||
import techreborn.init.ModBlocks;
|
||||
|
||||
public class BlockStorage extends Block {
|
||||
|
||||
public static ItemStack getStorageBlockByName(String name, int count)
|
||||
{
|
||||
for (int i = 0; i < types.length; i++) {
|
||||
if (types[i].equals(name)) {
|
||||
return new ItemStack(ModBlocks.storage, count, i);
|
||||
}
|
||||
}
|
||||
return BlockStorage2.getStorageBlockByName(name, count);
|
||||
}
|
||||
|
||||
public static final String[] types = new String[]
|
||||
{ "silver", "aluminum", "titanium", "chrome", "steel", "brass", "lead",
|
||||
"electrum", "zinc", "platinum", "tungsten", "nickel", "invar", "osmium",
|
||||
|
|
|
@ -1,5 +1,6 @@
|
|||
package techreborn.blocks;
|
||||
|
||||
import java.security.InvalidParameterException;
|
||||
import java.util.List;
|
||||
import java.util.Random;
|
||||
|
||||
|
@ -15,9 +16,20 @@ import net.minecraftforge.common.util.ForgeDirection;
|
|||
import techreborn.client.TechRebornCreativeTabMisc;
|
||||
import cpw.mods.fml.relauncher.Side;
|
||||
import cpw.mods.fml.relauncher.SideOnly;
|
||||
import techreborn.init.ModBlocks;
|
||||
|
||||
public class BlockStorage2 extends Block {
|
||||
|
||||
public static ItemStack getStorageBlockByName(String name, int count)
|
||||
{
|
||||
for (int i = 0; i < types.length; i++) {
|
||||
if (types[i].equals(name)) {
|
||||
return new ItemStack(ModBlocks.storage2, count, i);
|
||||
}
|
||||
}
|
||||
throw new InvalidParameterException("The storage block " + name + " could not be found.");
|
||||
}
|
||||
|
||||
public static final String[] types = new String[]
|
||||
{ "tungstensteel", "lodestone", "tellurium", "iridium_reinforced_tungstensteel",
|
||||
"iridium_reinforced_stone", "ruby", "sapphire", "peridot", "yellow_garnet", "red_garnet" };
|
||||
|
|
|
@ -301,7 +301,7 @@ public class ModItems {
|
|||
OreDictionary.registerOre("gemYellowGarnet", ItemGems.getGemByName("yellowGarnet"));
|
||||
|
||||
// Dusts
|
||||
OreDictionary.registerOre("dustAlmandine", ItemDusts.getDustByName("almadine"));
|
||||
OreDictionary.registerOre("dustAlmandine", ItemDusts.getDustByName("almandine"));
|
||||
OreDictionary.registerOre("dustAluminumBrass", ItemDusts.getDustByName("aluminumBrass"));
|
||||
OreDictionary.registerOre("dustAluminum", ItemDusts.getDustByName("aluminum"));
|
||||
OreDictionary.registerOre("dustAluminium", ItemDusts.getDustByName("aluminum"));
|
||||
|
@ -643,7 +643,7 @@ public class ModItems {
|
|||
OreDictionary.registerOre("plateBrass", ItemPlates.getPlateByName("brass"));
|
||||
OreDictionary.registerOre("plateBronze", ItemPlates.getPlateByName("bronze"));
|
||||
OreDictionary.registerOre("plateCoal", ItemPlates.getPlateByName("coal"));
|
||||
OreDictionary.registerOre("plateChrome", ItemPlates.getPlateByName("chome"));
|
||||
OreDictionary.registerOre("plateChrome", ItemPlates.getPlateByName("chrome"));
|
||||
OreDictionary.registerOre("plateCopper", ItemPlates.getPlateByName("copper"));
|
||||
OreDictionary.registerOre("plateDiamond", ItemPlates.getPlateByName("diamond"));
|
||||
OreDictionary.registerOre("plateElectrum", ItemPlates.getPlateByName("electrum"));
|
||||
|
|
|
@ -1,5 +1,6 @@
|
|||
package techreborn.items;
|
||||
|
||||
import java.security.InvalidParameterException;
|
||||
import java.util.List;
|
||||
|
||||
import net.minecraft.client.renderer.texture.IIconRegister;
|
||||
|
@ -13,14 +14,12 @@ import techreborn.init.ModItems;
|
|||
public class ItemCrushedOre extends Item {
|
||||
public static ItemStack getCrushedOreByName(String name, int count)
|
||||
{
|
||||
int index = -1;
|
||||
for (int i = 0; i < types.length; i++) {
|
||||
if (types[i].equals(name)) {
|
||||
index = i;
|
||||
break;
|
||||
return new ItemStack(ModItems.crushedOre, count, i);
|
||||
}
|
||||
}
|
||||
return new ItemStack(ModItems.crushedOre, count, index);
|
||||
throw new InvalidParameterException("The gem " + name + " could not be found.");
|
||||
}
|
||||
|
||||
public static ItemStack getCrushedOreByName(String name)
|
||||
|
|
|
@ -1,5 +1,6 @@
|
|||
package techreborn.items;
|
||||
|
||||
import java.security.InvalidParameterException;
|
||||
import java.util.List;
|
||||
|
||||
import net.minecraft.client.renderer.texture.IIconRegister;
|
||||
|
@ -14,14 +15,12 @@ public class ItemDustTiny extends ItemTR {
|
|||
|
||||
public static ItemStack getTinyDustByName(String name, int count)
|
||||
{
|
||||
int index = -1;
|
||||
for (int i = 0; i < types.length; i++) {
|
||||
if (types[i].equals(name)) {
|
||||
index = i;
|
||||
break;
|
||||
return new ItemStack(ModItems.tinyDusts, count, i);
|
||||
}
|
||||
}
|
||||
return new ItemStack(ModItems.tinyDusts, count, index);
|
||||
throw new InvalidParameterException("The gem " + name + " could not be found.");
|
||||
}
|
||||
|
||||
public static ItemStack getTinyDustByName(String name)
|
||||
|
|
|
@ -1,5 +1,6 @@
|
|||
package techreborn.items;
|
||||
|
||||
import java.security.InvalidParameterException;
|
||||
import java.util.List;
|
||||
|
||||
import net.minecraft.client.renderer.texture.IIconRegister;
|
||||
|
@ -13,14 +14,12 @@ import techreborn.init.ModItems;
|
|||
public class ItemDusts extends ItemTR {
|
||||
public static ItemStack getDustByName(String name, int count)
|
||||
{
|
||||
int index = -1;
|
||||
for (int i = 0; i < types.length; i++) {
|
||||
if (types[i].equals(name)) {
|
||||
index = i;
|
||||
break;
|
||||
return new ItemStack(ModItems.dusts, count, i);
|
||||
}
|
||||
}
|
||||
return new ItemStack(ModItems.dusts, count, index);
|
||||
throw new InvalidParameterException("The gem " + name + " could not be found.");
|
||||
}
|
||||
|
||||
public static ItemStack getDustByName(String name)
|
||||
|
|
|
@ -1,5 +1,6 @@
|
|||
package techreborn.items;
|
||||
|
||||
import java.security.InvalidParameterException;
|
||||
import java.util.List;
|
||||
|
||||
import net.minecraft.client.renderer.texture.IIconRegister;
|
||||
|
@ -14,14 +15,12 @@ public class ItemDustsSmall extends ItemTR {
|
|||
|
||||
public static ItemStack getSmallDustByName(String name, int count)
|
||||
{
|
||||
int index = -1;
|
||||
for (int i = 0; i < types.length; i++) {
|
||||
if (types[i].equals(name)) {
|
||||
index = i;
|
||||
break;
|
||||
return new ItemStack(ModItems.smallDusts, count, i);
|
||||
}
|
||||
}
|
||||
return new ItemStack(ModItems.smallDusts, count, index);
|
||||
throw new InvalidParameterException("The small dust " + name + " could not be found.");
|
||||
}
|
||||
|
||||
public static ItemStack getSmallDustByName(String name)
|
||||
|
|
|
@ -1,5 +1,6 @@
|
|||
package techreborn.items;
|
||||
|
||||
import java.security.InvalidParameterException;
|
||||
import java.util.List;
|
||||
|
||||
import net.minecraft.client.renderer.texture.IIconRegister;
|
||||
|
@ -14,14 +15,12 @@ public class ItemGems extends Item {
|
|||
|
||||
public static ItemStack getGemByName(String name, int count)
|
||||
{
|
||||
int index = -1;
|
||||
for (int i = 0; i < types.length; i++) {
|
||||
if (types[i].equals(name)) {
|
||||
index = i;
|
||||
break;
|
||||
return new ItemStack(ModItems.gems, count, i);
|
||||
}
|
||||
}
|
||||
return new ItemStack(ModItems.gems, count, index);
|
||||
throw new InvalidParameterException("The gem " + name + " could not be found.");
|
||||
}
|
||||
|
||||
public static ItemStack getGemByName(String name)
|
||||
|
|
|
@ -1,5 +1,6 @@
|
|||
package techreborn.items;
|
||||
|
||||
import java.security.InvalidParameterException;
|
||||
import java.util.List;
|
||||
|
||||
import net.minecraft.client.renderer.texture.IIconRegister;
|
||||
|
@ -13,14 +14,12 @@ import techreborn.init.ModItems;
|
|||
public class ItemIngots extends Item {
|
||||
public static ItemStack getIngotByName(String name, int count)
|
||||
{
|
||||
int index = -1;
|
||||
for (int i = 0; i < types.length; i++) {
|
||||
if (types[i].equals(name)) {
|
||||
index = i;
|
||||
break;
|
||||
return new ItemStack(ModItems.ingots, count, i);
|
||||
}
|
||||
}
|
||||
return new ItemStack(ModItems.ingots, count, index);
|
||||
throw new InvalidParameterException("The ingot " + name + " could not be found.");
|
||||
}
|
||||
|
||||
public static ItemStack getIngotByName(String name)
|
||||
|
|
|
@ -1,5 +1,6 @@
|
|||
package techreborn.items;
|
||||
|
||||
import java.security.InvalidParameterException;
|
||||
import java.util.List;
|
||||
|
||||
import net.minecraft.client.renderer.texture.IIconRegister;
|
||||
|
@ -14,14 +15,12 @@ public class ItemNuggets extends Item {
|
|||
|
||||
public static ItemStack getNuggetByName(String name, int count)
|
||||
{
|
||||
int index = -1;
|
||||
for (int i = 0; i < types.length; i++) {
|
||||
if (types[i].equals(name)) {
|
||||
index = i;
|
||||
break;
|
||||
return new ItemStack(ModItems.nuggets, count, i);
|
||||
}
|
||||
}
|
||||
return new ItemStack(ModItems.nuggets, count, index);
|
||||
throw new InvalidParameterException("The nugget " + name + " could not be found.");
|
||||
}
|
||||
|
||||
public static ItemStack getNuggetByName(String name)
|
||||
|
|
|
@ -1,5 +1,6 @@
|
|||
package techreborn.items;
|
||||
|
||||
import java.security.InvalidParameterException;
|
||||
import java.util.List;
|
||||
|
||||
import net.minecraft.client.renderer.texture.IIconRegister;
|
||||
|
@ -17,14 +18,12 @@ import techreborn.init.ModItems;
|
|||
public class ItemParts extends Item {
|
||||
public static ItemStack getPartByName(String name, int count)
|
||||
{
|
||||
int index = -1;
|
||||
for (int i = 0; i < types.length; i++) {
|
||||
if (types[i].equals(name)) {
|
||||
index = i;
|
||||
break;
|
||||
return new ItemStack(ModItems.parts, count, i);
|
||||
}
|
||||
}
|
||||
return new ItemStack(ModItems.parts, count, index);
|
||||
throw new InvalidParameterException("The part " + name + " could not be found.");
|
||||
}
|
||||
|
||||
public static ItemStack getPartByName(String name)
|
||||
|
|
|
@ -1,5 +1,6 @@
|
|||
package techreborn.items;
|
||||
|
||||
import java.security.InvalidParameterException;
|
||||
import java.util.List;
|
||||
|
||||
import net.minecraft.client.renderer.texture.IIconRegister;
|
||||
|
@ -14,14 +15,12 @@ public class ItemPlates extends ItemTR {
|
|||
|
||||
public static ItemStack getPlateByName(String name, int count)
|
||||
{
|
||||
int index = -1;
|
||||
for (int i = 0; i < types.length; i++) {
|
||||
if (types[i].equals(name)) {
|
||||
index = i;
|
||||
break;
|
||||
return new ItemStack(ModItems.plate, count, i);
|
||||
}
|
||||
}
|
||||
return new ItemStack(ModItems.plate, count, index);
|
||||
throw new InvalidParameterException("The plate " + name + " could not be found.");
|
||||
}
|
||||
|
||||
public static ItemStack getPlateByName(String name)
|
||||
|
@ -31,7 +30,7 @@ public class ItemPlates extends ItemTR {
|
|||
|
||||
public static final String[] types = new String[]
|
||||
{ "aluminum", "batteryAlloy", "brass", "bronze", "carbon",
|
||||
"chrome", "copper", "diamond", "electrum", "emerald",
|
||||
"chrome", "coal", "copper", "diamond", "electrum", "emerald",
|
||||
"gold", "invar", "iridium", "iron", "lapis", "lead",
|
||||
"magnalium", "nickel", "obsidian", "osmium",
|
||||
"peridot", "platinum", "redGarnet", "redstone",
|
||||
|
|
|
@ -1,5 +1,6 @@
|
|||
package techreborn.items;
|
||||
|
||||
import java.security.InvalidParameterException;
|
||||
import java.util.List;
|
||||
|
||||
import net.minecraft.client.renderer.texture.IIconRegister;
|
||||
|
@ -14,14 +15,12 @@ public class ItemPurifiedCrushedOre extends Item {
|
|||
|
||||
public static ItemStack getPurifiedCrushedOreByName(String name, int count)
|
||||
{
|
||||
int index = -1;
|
||||
for (int i = 0; i < types.length; i++) {
|
||||
if (types[i].equals(name)) {
|
||||
index = i;
|
||||
break;
|
||||
return new ItemStack(ModItems.purifiedCrushedOre, count, i);
|
||||
}
|
||||
}
|
||||
return new ItemStack(ModItems.purifiedCrushedOre, count, index);
|
||||
throw new InvalidParameterException("The crushed ore " + name + " could not be found.");
|
||||
}
|
||||
|
||||
public static ItemStack getPurifiedCrushedOreByName(String name)
|
||||
|
|
|
@ -1,5 +1,6 @@
|
|||
package techreborn.items;
|
||||
|
||||
import java.security.InvalidParameterException;
|
||||
import java.util.List;
|
||||
|
||||
import net.minecraft.client.renderer.texture.IIconRegister;
|
||||
|
@ -14,14 +15,12 @@ public class ItemRods extends Item {
|
|||
|
||||
public static ItemStack getRodByName(String name, int count)
|
||||
{
|
||||
int index = -1;
|
||||
for (int i = 0; i < types.length; i++) {
|
||||
if (types[i].equals(name)) {
|
||||
index = i;
|
||||
break;
|
||||
return new ItemStack(ModItems.rods, count, i);
|
||||
}
|
||||
}
|
||||
return new ItemStack(ModItems.rods, count, index);
|
||||
throw new InvalidParameterException("The rod " + name + " could not be found.");
|
||||
}
|
||||
|
||||
public static ItemStack getRodByName(String name)
|
||||
|
|
|
@ -10,19 +10,18 @@ import techreborn.api.upgrade.IMachineUpgrade;
|
|||
import techreborn.client.TechRebornCreativeTabMisc;
|
||||
import techreborn.init.ModItems;
|
||||
|
||||
import java.security.InvalidParameterException;
|
||||
import java.util.List;
|
||||
|
||||
public class ItemUpgrade extends ItemTR implements IMachineUpgrade {
|
||||
|
||||
public static ItemStack getUpgradeByName(String name, int count) {
|
||||
int index = -1;
|
||||
for (int i = 0; i < types.length; i++) {
|
||||
if (types[i].equals(name)) {
|
||||
index = i;
|
||||
break;
|
||||
return new ItemStack(ModItems.plate, count, i);
|
||||
}
|
||||
}
|
||||
return new ItemStack(ModItems.plate, count, index);
|
||||
throw new InvalidParameterException("The upgrade " + name + " could not be found.");
|
||||
}
|
||||
|
||||
public static ItemStack getUpgradeByName(String name) {
|
||||
|
|
Loading…
Add table
Reference in a new issue