Java Code Examples for net.minecraftforge.oredict.OreDictionary#getOreName()

The following examples show how to use net.minecraftforge.oredict.OreDictionary#getOreName() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: InventoryUtils.java    From enderutilities with GNU Lesser General Public License v3.0 6 votes vote down vote up
public static boolean doesStackMatchOreDictName(ItemStack stack, String name)
{
    int[] ids = OreDictionary.getOreIDs(stack);

    for (int id : ids)
    {
        String oreName = OreDictionary.getOreName(id);

        if (oreName.startsWith(name))
        {
            return true;
        }
    }

    return false;
}
 
Example 2
Source File: CircuitImprintLoader.java    From bartworks with MIT License 5 votes vote down vote up
private static String getTypeFromOreDict(ItemStack[] outputs) {
    int[] oreIDS = OreDictionary.getOreIDs(outputs[0]);

    if (oreIDS.length < 1)
        return "";

    return OreDictionary.getOreName(oreIDS[0]);
}
 
Example 3
Source File: ThaumcraftApi.java    From AdvancedMod with GNU General Public License v3.0 5 votes vote down vote up
/**
 * Returns the bonus item produced from a smelting operation in the infernal furnace
 * @param in The input of the smelting operation. e.g. new ItemStack(oreGold)
 * @return the The bonus item that can be produced
 */
public static ItemStack getSmeltingBonus(ItemStack in) {
	ItemStack out = smeltingBonus.get(Arrays.asList(in.getItem(),in.getItemDamage()));
	if (out==null) {
		out = smeltingBonus.get(Arrays.asList(in.getItem(),OreDictionary.WILDCARD_VALUE));
	}
	if (out==null) {
		String od = OreDictionary.getOreName( OreDictionary.getOreID(in));
		out = smeltingBonus.get(od);
	}
	return out;
}
 
Example 4
Source File: ThaumcraftApi.java    From Chisel-2 with GNU General Public License v2.0 5 votes vote down vote up
/**
 * Returns the bonus item produced from a smelting operation in the infernal furnace
 * @param in The input of the smelting operation. e.g. new ItemStack(oreGold)
 * @return the The bonus item that can be produced
 */
public static ItemStack getSmeltingBonus(ItemStack in) {
	ItemStack out = smeltingBonus.get(Arrays.asList(in.getItem(),in.getItemDamage()));
	if (out==null) {
		out = smeltingBonus.get(Arrays.asList(in.getItem(),OreDictionary.WILDCARD_VALUE));
	}
	if (out==null) {
		String od = OreDictionary.getOreName( OreDictionary.getOreID(in));
		out = smeltingBonus.get(od);
	}
	return out;
}
 
Example 5
Source File: ThaumcraftApi.java    From GardenCollection with MIT License 5 votes vote down vote up
/**
 * Returns the bonus item produced from a smelting operation in the infernal furnace
 * @param in The input of the smelting operation. e.g. new ItemStack(oreGold)
 * @return the The bonus item that can be produced
 */
public static ItemStack getSmeltingBonus(ItemStack in) {
	ItemStack out = smeltingBonus.get(Arrays.asList(in.getItem(),in.getItemDamage()));
	if (out==null) {
		out = smeltingBonus.get(Arrays.asList(in.getItem(),OreDictionary.WILDCARD_VALUE));
	}
	if (out==null) {
		String od = OreDictionary.getOreName( OreDictionary.getOreID(in));
		out = smeltingBonus.get(od);
	}
	return out;
}
 
Example 6
Source File: ThaumcraftApi.java    From ForbiddenMagic with Do What The F*ck You Want To Public License 5 votes vote down vote up
/**
 * Returns the bonus item produced from a smelting operation in the infernal furnace
 * @param in The input of the smelting operation. e.g. new ItemStack(oreGold)
 * @return the The bonus item that can be produced
 */
public static ItemStack getSmeltingBonus(ItemStack in) {
	ItemStack out = smeltingBonus.get(Arrays.asList(in.getItem(),in.getItemDamage()));
	if (out==null) {
		out = smeltingBonus.get(Arrays.asList(in.getItem(),OreDictionary.WILDCARD_VALUE));
	}
	if (out==null) {
		String od = OreDictionary.getOreName( OreDictionary.getOreID(in));
		out = smeltingBonus.get(od);
	}
	return out;
}
 
Example 7
Source File: DyeUtils.java    From WearableBackpacks with MIT License 5 votes vote down vote up
/** Gets the dye color of the item stack by checking the ore dictionary.
 *  Return -1 if the stack is not a dye. */
public static int getDyeColor(ItemStack stack) {
	if (stack.isEmpty()) return -1;
	int[] oreIds = OreDictionary.getOreIDs(stack);
	for (int ore : oreIds) {
		String name = OreDictionary.getOreName(ore);
		Integer color = dyes.get(name);
		if (color != null) return color;
	}
	return -1;
}
 
Example 8
Source File: ThaumcraftApi.java    From PneumaticCraft with GNU General Public License v3.0 5 votes vote down vote up
/**
 * Returns the bonus item produced from a smelting operation in the infernal furnace
 * @param in The input of the smelting operation. e.g. new ItemStack(oreGold)
 * @return the The bonus item that can be produced
 */
public static ItemStack getSmeltingBonus(ItemStack in) {
	ItemStack out = smeltingBonus.get(Arrays.asList(in.getItem(),in.getItemDamage()));
	if (out==null) {
		out = smeltingBonus.get(Arrays.asList(in.getItem(),OreDictionary.WILDCARD_VALUE));
	}
	if (out==null) {
		String od = OreDictionary.getOreName( OreDictionary.getOreID(in));
		out = smeltingBonus.get(od);
	}
	return out;
}
 
Example 9
Source File: TileEntityPlasticMixer.java    From PneumaticCraft with GNU General Public License v3.0 5 votes vote down vote up
public static int getDyeIndex(ItemStack stack){
    int[] ids = OreDictionary.getOreIDs(stack);
    for(int id : ids) {
        String name = OreDictionary.getOreName(id);
        for(int i = 0; i < DYES.length; i++) {
            if(DYES[i].equals(name)) return i;
        }
    }
    return -1;
}
 
Example 10
Source File: CircuitPartLoader.java    From bartworks with MIT License 4 votes vote down vote up
public static void makeCircuitParts() {
    ItemList[] itemLists = values();
    for (ItemList single : itemLists) {
        if (!single.hasBeenSet())
            continue;
        if (
                single.toString().contains("Wafer") ||
                        single.toString().contains("Circuit_Silicon_Ingot") ||
                        single.toString().contains("Raw") ||
                        single.toString().contains("raw") ||
                        single.toString().contains("Glass_Tube") ||
                        single == Circuit_Parts_GlassFiber ||
                        single == Circuit_Parts_Advanced ||
                        single == Circuit_Parts_Wiring_Advanced ||
                        single == Circuit_Parts_Wiring_Elite ||
                        single == Circuit_Parts_Wiring_Basic ||
                        single == Circuit_Integrated ||
                        single == Circuit_Parts_PetriDish ||
                        single == Circuit_Parts_Vacuum_Tube ||
                        single == Circuit_Integrated_Good ||
                        single == Circuit_Parts_Capacitor ||
                        single == Circuit_Parts_Diode ||
                        single == Circuit_Parts_Resistor ||
                        single == Circuit_Parts_Transistor

        ){
            CircuitImprintLoader.blacklistSet.add(single.get(1));
            continue;
        }
        ItemStack itemStack = single.get(1);
        if (!GT_Utility.isStackValid(itemStack))
            continue;
        int[] oreIDS = OreDictionary.getOreIDs(itemStack);
        if (oreIDS.length > 1)
            continue;
        String name = null;
        if (oreIDS.length == 1)
            name = OreDictionary.getOreName(oreIDS[0]);
        if ((name == null || name.isEmpty()) && (single.toString().contains("Circuit") || single.toString().contains("circuit") || single.toString().contains("board")) && single.getBlock() == Blocks.air) {
            ArrayList<String> toolTip = new ArrayList<>();
            if (FMLCommonHandler.instance().getEffectiveSide().isClient())
                single.getItem().addInformation(single.get(1).copy(), null, toolTip, true);
            String tt = (toolTip.size() > 0 ? toolTip.get(0) : "");
            //  tt += "Internal Name = "+single;
            String localised = GT_LanguageManager.getTranslation(GT_LanguageManager.getTranslateableItemStackName(itemStack));
            BW_Meta_Items.getNEWCIRCUITS().addItem(CircuitImprintLoader.reverseIDs, "Wrap of " + localised+"s", tt);
            GT_Values.RA.addAssemblerRecipe(new ItemStack[]{single.get(16).copy(), GT_Utility.getIntegratedCircuit(16)}, Materials.Plastic.getMolten(72),BW_Meta_Items.getNEWCIRCUITS().getStack(CircuitImprintLoader.reverseIDs),600,30);
            CircuitImprintLoader.circuitIIconRefs.put(CircuitImprintLoader.reverseIDs,single);
            CircuitImprintLoader.reverseIDs--;
        }
    }
}
 
Example 11
Source File: OreDictionaryInterface.java    From Thermos with GNU General Public License v3.0 4 votes vote down vote up
@Override
public String getOreName(OreDictionaryEntry entry) {
    return OreDictionary.getOreName(entry.getId());
}