Nuggets now use jsons, and nuggets now return proper subtypes

This commit is contained in:
ProfessorProspector 2016-12-11 10:58:20 -08:00
parent c880fbe2f8
commit 3da6083c68
26 changed files with 133 additions and 17 deletions

View file

@ -9,6 +9,7 @@ import techreborn.init.ModBlocks;
import techreborn.init.ModItems;
import techreborn.items.ItemGems;
import techreborn.items.ItemIngots;
import techreborn.items.ItemNuggets;
import techreborn.items.ItemPlates;
public class RegisterItemJsons {
@ -53,6 +54,11 @@ public class RegisterItemJsons {
String[] name = ItemPlates.types.clone();
registerBlockstate(ModItems.plate, i, name[i]);
}
for (int i = 0; i < ItemNuggets.types.length; ++i) {
String[] name = ItemNuggets.types.clone();
registerBlockstate(ModItems.nuggets, i, name[i]);
}
}
private static void registerBlocks() {

View file

@ -123,8 +123,7 @@ public class OreDict {
for (String type : ItemNuggets.types) {
if (type.equals(ModItems.META_PLACEHOLDER))
continue; //Aware of placeholders!
String oreDictName = "nugget" + OreDictUtils.toFirstUpper(type);
OreDictionary.registerOre(oreDictName, ItemNuggets.getNuggetByName(type));
OreDictionary.registerOre(CaseFormat.LOWER_UNDERSCORE.to(CaseFormat.LOWER_CAMEL, "nugget_" + type), ItemNuggets.getNuggetByName(type));
}
}

View file

@ -3,18 +3,17 @@ package techreborn.items;
import net.minecraft.creativetab.CreativeTabs;
import net.minecraft.item.Item;
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;
import java.util.List;
public class ItemNuggets extends ItemTextureBase {
public class ItemNuggets 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", ModItems.META_PLACEHOLDER, ModItems.META_PLACEHOLDER,
"hot_tungstensteel", "tungstensteel", "zinc", "refined_iron", ModItems.META_PLACEHOLDER, ModItems.META_PLACEHOLDER,
ModItems.META_PLACEHOLDER, "iron", "diamond" };
public ItemNuggets() {
@ -48,7 +47,8 @@ public class ItemNuggets extends ItemTextureBase {
}
// Adds Dusts SubItems To Creative Tab
public void getSubItems(Item item, CreativeTabs creativeTabs, List list) {
@Override
public void getSubItems(Item item, CreativeTabs creativeTabs, NonNullList list) {
for (int meta = 0; meta < types.length; ++meta) {
if (!types[meta].equals(ModItems.META_PLACEHOLDER)) {
list.add(new ItemStack(item, 1, meta));
@ -56,14 +56,4 @@ public class ItemNuggets extends ItemTextureBase {
}
}
@Override
public String getTextureName(int damage) {
return ModInfo.MOD_ID + ":items/nuggets/" + types[damage] + "Nugget";
}
@Override
public int getMaxMeta() {
return types.length;
}
}

View file

@ -0,0 +1,121 @@
{
"forge_marker": 1,
"defaults": {
"model": "builtin/generated",
"transform": "forge:default-item"
},
"variants": {
"type": {
"aluminum": {
"textures": {
"layer0": "techreborn:items/nugget/aluminum_nugget"
}
},
"brass": {
"textures": {
"layer0": "techreborn:items/nugget/brass_nugget"
}
},
"bronze": {
"textures": {
"layer0": "techreborn:items/nugget/bronze_nugget"
}
},
"chrome": {
"textures": {
"layer0": "techreborn:items/nugget/chrome_nugget"
}
},
"copper": {
"textures": {
"layer0": "techreborn:items/nugget/copper_nugget"
}
},
"electrum": {
"textures": {
"layer0": "techreborn:items/nugget/electrum_nugget"
}
},
"invar": {
"textures": {
"layer0": "techreborn:items/nugget/invar_nugget"
}
},
"iridium": {
"textures": {
"layer0": "techreborn:items/nugget/iridium_nugget"
}
},
"lead": {
"textures": {
"layer0": "techreborn:items/nugget/lead_nugget"
}
},
"nickel": {
"textures": {
"layer0": "techreborn:items/nugget/nickel_nugget"
}
},
"platinum": {
"textures": {
"layer0": "techreborn:items/nugget/platinum_nugget"
}
},
"silver": {
"textures": {
"layer0": "techreborn:items/nugget/silver_nugget"
}
},
"steel": {
"textures": {
"layer0": "techreborn:items/nugget/steel_nugget"
}
},
"tin": {
"textures": {
"layer0": "techreborn:items/nugget/tin_nugget"
}
},
"titanium": {
"textures": {
"layer0": "techreborn:items/nugget/titanium_nugget"
}
},
"tungsten": {
"textures": {
"layer0": "techreborn:items/nugget/tungsten_nugget"
}
},
"hot_tungstensteel": {
"textures": {
"layer0": "techreborn:items/nugget/hot_tungstensteel_nugget"
}
},
"tungstensteel": {
"textures": {
"layer0": "techreborn:items/nugget/tungstensteel_nugget"
}
},
"zinc": {
"textures": {
"layer0": "techreborn:items/nugget/zinc_nugget"
}
},
"refined_iron": {
"textures": {
"layer0": "techreborn:items/nugget/refined_iron_nugget"
}
},
"iron": {
"textures": {
"layer0": "techreborn:items/nugget/iron_nugget"
}
},
"diamond": {
"textures": {
"layer0": "techreborn:items/nugget/diamond_nugget"
}
}
}
}
}