Flattened dusts.

This commit is contained in:
drcrazy 2018-08-24 14:56:25 +03:00
parent 1ee9ffb007
commit edd4e0df3e
23 changed files with 365 additions and 856 deletions

View file

@ -24,88 +24,45 @@
package techreborn.items;
import com.google.common.base.CaseFormat;
import net.minecraft.creativetab.CreativeTabs;
import net.minecraft.init.Items;
import net.minecraft.item.ItemStack;
import net.minecraft.util.NonNullList;
import techreborn.events.TRRecipeHandler;
import techreborn.init.ModItems;
import techreborn.utils.TechRebornCreativeTab;
import java.security.InvalidParameterException;
public class ItemDusts extends ItemTR {
public static final String[] types = new String[] { "almandine", "aluminum", "andradite", "ashes", "basalt",
"bauxite", "brass", "bronze", "calcite", "charcoal", "chrome", "cinnabar", "clay", "coal", "copper",
"dark_ashes", "diamond", "electrum", "emerald", "ender_eye", "ender_pearl", "endstone", "flint", "galena",
"gold", "grossular", "invar", "iron", "lazurite", "lead", "magnesium", "manganese", "marble", "netherrack",
"nickel", "obsidian", "peridot", "phosphorous", "platinum", "pyrite", "pyrope", "red_garnet",
"ruby", "saltpeter", "sapphire", "saw_dust", "silver", "sodalite", "spessartine", "sphalerite", "steel",
"sulfur", "tin", "titanium", "tungsten", "uvarovite", "yellow_garnet", "zinc",
"andesite", "diorite", "granite" };
public ItemDusts() {
setTranslationKey("techreborn.dust");
//setHasSubtypes(true);
setCreativeTab(TechRebornCreativeTab.instance);
TRRecipeHandler.hideEntry(this);
}
public static ItemStack getDustByName(String name, int count) {
name = CaseFormat.LOWER_CAMEL.to(CaseFormat.LOWER_UNDERSCORE, name);
for (int i = 0; i < types.length; i++) {
if (types[i].equalsIgnoreCase(name)) {
return new ItemStack(ModItems.DUSTS, count, i);
}
}
if (name.equalsIgnoreCase("glowstone")) {
return new ItemStack(Items.GLOWSTONE_DUST, count);
}
if (name.equalsIgnoreCase("redstone")) {
return new ItemStack(Items.REDSTONE, count);
}
if (name.equalsIgnoreCase("gunpowder")) {
return new ItemStack(Items.GUNPOWDER, count);
}
throw new InvalidParameterException("The dust " + name + " could not be found.");
}
public static ItemStack getDustByName(String name) {
return getDustByName(name, 1);
}
public static boolean hasDust(String name){
for(String type : types){
if(type.equals(name)){
return true;
}
}
return false;
}
/* @Override
// gets Unlocalized Name depending on meta data
public String getTranslationKey(ItemStack itemStack) {
int meta = itemStack.getItemDamage();
if (meta < 0 || meta >= types.length) {
meta = 0;
}
return super.getTranslationKey() + "." + types[meta];
}*/
/* // Adds Dusts SubItems To Creative Tab
@Override
public void getSubItems(CreativeTabs creativeTabs, NonNullList<ItemStack> list) {
if (!isInCreativeTab(creativeTabs)) {
return;
}
for (int meta = 0; meta < types.length; ++meta) {
list.add(new ItemStack(this, 1, meta));
}
}*/
// public static ItemStack getDustByName(String name, int count) {
// name = CaseFormat.LOWER_CAMEL.to(CaseFormat.LOWER_UNDERSCORE, name);
// for (int i = 0; i < types.length; i++) {
// if (types[i].equalsIgnoreCase(name)) {
// return new ItemStack(ModItems.DUSTS, count, i);
// }
// }
//
// if (name.equalsIgnoreCase("glowstone")) {
// return new ItemStack(Items.GLOWSTONE_DUST, count);
// }
// if (name.equalsIgnoreCase("redstone")) {
// return new ItemStack(Items.REDSTONE, count);
// }
// if (name.equalsIgnoreCase("gunpowder")) {
// return new ItemStack(Items.GUNPOWDER, count);
// }
// throw new InvalidParameterException("The dust " + name + " could not be found.");
// }
//
// public static ItemStack getDustByName(String name) {
// return getDustByName(name, 1);
// }
//
// public static boolean hasDust(String name){
// for(String type : types){
// if(type.equals(name)){
// return true;
// }
// }
// return false;
// }
}