Move ingots, plates, and gems to jsons

This commit is contained in:
ProfessorProspector 2016-12-10 00:15:39 -08:00
parent 89ffb5d047
commit 2911e7f0ca
75 changed files with 495 additions and 197 deletions

View file

@ -6,13 +6,12 @@ import net.minecraft.item.ItemStack;
import net.minecraft.util.NonNullList;
import techreborn.client.TechRebornCreativeTabMisc;
import techreborn.init.ModItems;
import techreborn.lib.ModInfo;
import java.security.InvalidParameterException;
public class ItemGems extends ItemTextureBase {
public class ItemGems extends ItemTRNoDestroy {
public static final String[] types = new String[] { "ruby", "sapphire", "peridot", "redGarnet", "yellowGarnet" };
public static final String[] types = new String[] { "ruby", "sapphire", "peridot", "red_garnet", "yellow_garnet" };
public ItemGems() {
setCreativeTab(TechRebornCreativeTabMisc.instance);
@ -51,14 +50,4 @@ public class ItemGems extends ItemTextureBase {
}
}
@Override
public String getTextureName(int damage) {
return ModInfo.MOD_ID + ":items/gem/" + types[damage];
}
@Override
public int getMaxMeta() {
return types.length;
}
}

View file

@ -6,15 +6,14 @@ import net.minecraft.item.ItemStack;
import net.minecraft.util.NonNullList;
import techreborn.client.TechRebornCreativeTabMisc;
import techreborn.init.ModItems;
import techreborn.lib.ModInfo;
import java.security.InvalidParameterException;
public class ItemIngots extends ItemTextureBase {
public class ItemIngots extends ItemTRNoDestroy {
public static final String[] types = new String[] { "aluminum", "brass", "bronze", "chrome", "copper", "electrum",
"invar", "iridium", "lead", "nickel", "platinum", "silver", "steel", "tin", "titanium", "tungsten",
"hotTungstensteel", "tungstensteel", "zinc", "refinedIron", "advancedAlloy", "mixedMetal",
"iridiumAlloy"};
"hot_tungstensteel", "tungstensteel", "zinc", "refined_iron", "advanced_alloy", "mixed_metal",
"iridium_alloy" };
public ItemIngots() {
setCreativeTab(TechRebornCreativeTabMisc.instance);
@ -54,15 +53,4 @@ public class ItemIngots extends ItemTextureBase {
}
}
}
@Override
public String getTextureName(int damage) {
return ModInfo.MOD_ID + ":items/ingot/" + types[damage] + "Ingot";
}
@Override
public int getMaxMeta() {
return types.length;
}
}

View file

@ -1,5 +1,6 @@
package techreborn.items;
import com.google.common.base.CaseFormat;
import net.minecraft.creativetab.CreativeTabs;
import net.minecraft.item.Item;
import net.minecraft.item.ItemStack;
@ -7,12 +8,10 @@ import net.minecraft.util.NonNullList;
import net.minecraftforge.oredict.OreDictionary;
import techreborn.client.TechRebornCreativeTabMisc;
import techreborn.init.ModItems;
import techreborn.lib.ModInfo;
import techreborn.utils.OreDictUtils;
import java.security.InvalidParameterException;
public class ItemPlates extends ItemTextureBase {
public class ItemPlates extends ItemTRNoDestroy {
//Vanilla plates or plates not from ingots or gems
public static String[] types = new String[] {
@ -38,6 +37,20 @@ public class ItemPlates extends ItemTextureBase {
return getPlateByName(name, 1);
}
public static void registerType(String plateType) {
for (String type : types) {
if (type.equals(plateType))
return;
}
int plateIndex = types.length;
String[] newTypes = new String[plateIndex + 1];
System.arraycopy(types, 0, newTypes, 0, types.length);
types = newTypes;
newTypes[plateIndex] = plateType;
String oreName = "plate" + CaseFormat.LOWER_UNDERSCORE.to(CaseFormat.LOWER_CAMEL, plateType);
OreDictionary.registerOre(oreName, new ItemStack(ModItems.plate, 1, plateIndex));
}
@Override
// gets Unlocalized Name depending on meta data
public String getUnlocalizedName(ItemStack itemStack) {
@ -55,29 +68,4 @@ public class ItemPlates extends ItemTextureBase {
list.add(new ItemStack(item, 1, meta));
}
}
public static void registerType(String plateType) {
for (String type : types) {
if (type.equals(plateType))
return;
}
int plateIndex = types.length;
String[] newTypes = new String[plateIndex + 1];
System.arraycopy(types, 0, newTypes, 0, types.length);
types = newTypes;
newTypes[plateIndex] = plateType;
String oreName = "plate" + OreDictUtils.toFirstUpper(plateType);
OreDictionary.registerOre(oreName, new ItemStack(ModItems.plate, 1, plateIndex));
}
@Override
public String getTextureName(int damage) {
return ModInfo.MOD_ID + ":items/plate/" + types[damage] + "Plate";
}
@Override
public int getMaxMeta() {
return types.length;
}
}