Java Code Examples for net.minecraftforge.oredict.OreDictionary#WILDCARD_VALUE
The following examples show how to use
net.minecraftforge.oredict.OreDictionary#WILDCARD_VALUE .
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: ThaumcraftApi.java From Chisel-2 with GNU General Public License v2.0 | 6 votes |
/** * Checks to see if the passed item/block already has aspects associated with it. * @param id * @param meta * @return */ public static boolean exists(Item item, int meta) { AspectList tmp = ThaumcraftApi.objectTags.get(Arrays.asList(item,meta)); if (tmp==null) { tmp = ThaumcraftApi.objectTags.get(Arrays.asList(item,OreDictionary.WILDCARD_VALUE)); if (meta==OreDictionary.WILDCARD_VALUE && tmp==null) { int index=0; do { tmp = ThaumcraftApi.objectTags.get(Arrays.asList(item,index)); index++; } while (index<16 && tmp==null); } if (tmp==null) return false; } return true; }
Example 2
Source File: UniqueMetaIdentifier.java From GardenCollection with MIT License | 6 votes |
public UniqueMetaIdentifier (String compoundName) { String[] parts1 = compoundName.split(";"); String[] parts2 = parts1[0].split(":"); this.modId = parts2[0]; if (parts2.length >= 2) this.name = parts2[1]; else this.name = ""; if (parts1.length >= 2) this.meta = Integer.parseInt(parts1[1]); else if (parts2.length > 2) this.meta = Integer.parseInt(parts2[parts2.length - 1]); else this.meta = OreDictionary.WILDCARD_VALUE; }
Example 3
Source File: OreDictionaryDumper.java From NEI-Integration with MIT License | 6 votes |
@Override public Iterable<String[]> dump(int mode) { List<String[]> list = new LinkedList<String[]>(); List<String> oreNames = Arrays.asList(OreDictionary.getOreNames()); Collections.sort(oreNames); for (String oreName : oreNames) { List<ItemStack> ores = OreDictionary.getOres(oreName); String displayName; for (ItemStack ore : ores) { if (ore.getItemDamage() == OreDictionary.WILDCARD_VALUE) { displayName = "(wildcard)"; } else { try { displayName = ore.getDisplayName(); } catch (Exception e) { displayName = "-"; } } list.add(new String[] { oreName, ore.toString(), Item.itemRegistry.getNameForObject(ore.getItem()), displayName, String.valueOf(ore.getItemDamage() == OreDictionary.WILDCARD_VALUE) }); } } return list; }
Example 4
Source File: ThaumcraftApi.java From ForbiddenMagic with Do What The F*ck You Want To Public License | 6 votes |
/** * Checks to see if the passed item/block already has aspects associated with it. * @param id * @param meta * @return */ public static boolean exists(Item item, int meta) { AspectList tmp = ThaumcraftApi.objectTags.get(Arrays.asList(item,meta)); if (tmp==null) { tmp = ThaumcraftApi.objectTags.get(Arrays.asList(item,OreDictionary.WILDCARD_VALUE)); if (meta==OreDictionary.WILDCARD_VALUE && tmp==null) { int index=0; do { tmp = ThaumcraftApi.objectTags.get(Arrays.asList(item,index)); index++; } while (index<16 && tmp==null); } if (tmp==null) return false; } return true; }
Example 5
Source File: ItemHelper.java From customstuff4 with GNU General Public License v3.0 | 5 votes |
public static boolean isSameStackForFuel(ItemStack fuel, ItemStack stack) { boolean itemEqual = stack.getMetadata() == OreDictionary.WILDCARD_VALUE ? fuel.isItemEqualIgnoreDurability(stack) : fuel.isItemEqual(stack); boolean nbtEqual = !stack.hasTagCompound() || ItemStack.areItemStackTagsEqual(stack, fuel); return itemEqual && nbtEqual; }
Example 6
Source File: ShapelessArcaneRecipe.java From AdvancedMod with GNU General Public License v3.0 | 5 votes |
private boolean checkItemEquals(ItemStack target, ItemStack input) { if (input == null && target != null || input != null && target == null) { return false; } return (target.getItem() == input.getItem() && (!target.hasTagCompound() || ThaumcraftApiHelper.areItemStackTagsEqualForCrafting(input,target)) && (target.getItemDamage() == OreDictionary.WILDCARD_VALUE|| target.getItemDamage() == input.getItemDamage())); }
Example 7
Source File: RecipeHandlerBioReactor.java From NEI-Integration with MIT License | 5 votes |
@Override public void loadAllRecipes() { for (Item i : plantables.keySet()) { ItemStack plantable = new ItemStack(i, 1, OreDictionary.WILDCARD_VALUE); if (plantable != null && plantables.get(i).canBePlanted(plantable, true)) { this.arecipes.add(new CachedBioReactorRecipe(plantable)); } } }
Example 8
Source File: ShapelessArcaneRecipe.java From ForbiddenMagic with Do What The F*ck You Want To Public License | 5 votes |
private boolean checkItemEquals(ItemStack target, ItemStack input) { if (input == null && target != null || input != null && target == null) { return false; } return (target.getItem() == input.getItem() && (!target.hasTagCompound() || ThaumcraftApiHelper.areItemStackTagsEqualForCrafting(input,target)) && (target.getItemDamage() == OreDictionary.WILDCARD_VALUE|| target.getItemDamage() == input.getItemDamage())); }
Example 9
Source File: DriverBlock.java From Framez with GNU General Public License v3.0 | 5 votes |
protected boolean worksWith(final Block referenceBlock, final int referenceMetadata) { for (ItemStack stack : blocks) { if (stack != null && stack.getItem() instanceof ItemBlock) { final ItemBlock item = (ItemBlock) stack.getItem(); final Block supportedBlock = item.field_150939_a; final int supportedMetadata = item.getMetadata(stack.getItemDamage()); if (referenceBlock == supportedBlock && (referenceMetadata == supportedMetadata || stack.getItemDamage() == OreDictionary.WILDCARD_VALUE)) { return true; } } } return false; }
Example 10
Source File: InventoryUtils.java From enderutilities with GNU Lesser General Public License v3.0 | 5 votes |
/** * Checks if there is a matching ItemStack in the provided array of stacks */ public static boolean matchingStackFoundOnList(NonNullList<ItemStack> list, @Nonnull ItemStack stackTemplate, boolean ignoreMeta, boolean ignoreNbt) { Item item = stackTemplate.getItem(); int meta = stackTemplate.getMetadata(); final int size = list.size(); for (int i = 0; i < size; i++) { ItemStack stackTmp = list.get(i); if (stackTmp.isEmpty() || stackTmp.getItem() != item) { continue; } if (ignoreMeta == false && (meta != OreDictionary.WILDCARD_VALUE && stackTmp.getMetadata() != meta)) { continue; } if (ignoreNbt == false && ItemStack.areItemStackTagsEqual(stackTemplate, stackTmp) == false) { continue; } return true; } return false; }
Example 11
Source File: InfusionRecipe.java From GardenCollection with MIT License | 5 votes |
/** * Used to check if a recipe matches current crafting inventory * @param player */ public boolean matches(ArrayList<ItemStack> input, ItemStack central, World world, EntityPlayer player) { if (getRecipeInput()==null) return false; if (research.length()>0 && !ThaumcraftApiHelper.isResearchComplete(player.getCommandSenderName(), research)) { return false; } ItemStack i2 = central.copy(); if (getRecipeInput().getItemDamage()==OreDictionary.WILDCARD_VALUE) { i2.setItemDamage(OreDictionary.WILDCARD_VALUE); } if (!areItemStacksEqual(i2, getRecipeInput(), true)) return false; ArrayList<ItemStack> ii = new ArrayList<ItemStack>(); for (ItemStack is:input) { ii.add(is.copy()); } for (ItemStack comp:getComponents()) { boolean b=false; for (int a=0;a<ii.size();a++) { i2 = ii.get(a).copy(); if (comp.getItemDamage()==OreDictionary.WILDCARD_VALUE) { i2.setItemDamage(OreDictionary.WILDCARD_VALUE); } if (areItemStacksEqual(i2, comp,true)) { ii.remove(a); b=true; break; } } if (!b) return false; } return ii.size()==0?true:false; }
Example 12
Source File: UniqueMetaIdentifier.java From GardenCollection with MIT License | 5 votes |
public UniqueMetaIdentifier (String compoundName, char separator) { String[] parts1 = compoundName.split("[ ]*" + separator + "[ ]*"); String[] parts2 = parts1[0].split(":"); this.modId = parts2[0]; if (parts2.length >= 2) this.name = parts2[1]; else this.name = ""; if (parts1.length >= 2) this.meta = Integer.parseInt(parts1[1]); else this.meta = OreDictionary.WILDCARD_VALUE; }
Example 13
Source File: WikiRegistry.java From IGW-mod with GNU General Public License v2.0 | 5 votes |
public static List<ItemStack> getItemAndBlockPageEntries(){ // List<ItemStack> entries = new ArrayList<ItemStack>(); NonNullList<ItemStack> entries = NonNullList.create(); for(Map.Entry<String, ItemStack> entry : itemAndBlockPageEntries) { if(entry.getValue().getItemDamage() == OreDictionary.WILDCARD_VALUE) { entry.getValue().getItem().getSubItems(CreativeTabs.SEARCH, entries); } else { entries.add(entry.getValue()); } } return entries; }
Example 14
Source File: ShapedArcaneRecipe.java From ForbiddenMagic with Do What The F*ck You Want To Public License | 5 votes |
private boolean checkItemEquals(ItemStack target, ItemStack input) { if (input == null && target != null || input != null && target == null) { return false; } return (target.getItem() == input.getItem() && (!target.hasTagCompound() || ThaumcraftApiHelper.areItemStackTagsEqualForCrafting(input,target)) && (target.getItemDamage() == OreDictionary.WILDCARD_VALUE|| target.getItemDamage() == input.getItemDamage())); }
Example 15
Source File: InfusionEnchantmentRecipe.java From PneumaticCraft with GNU General Public License v3.0 | 4 votes |
/** * Used to check if a recipe matches current crafting inventory * @param player */ public boolean matches(ArrayList<ItemStack> input, ItemStack central, World world, EntityPlayer player) { if (research.length()>0 && !ThaumcraftApiHelper.isResearchComplete(player.getCommandSenderName(), research)) { return false; } if (!enchantment.canApply(central) || !central.getItem().isItemTool(central)) { return false; } Map map1 = EnchantmentHelper.getEnchantments(central); Iterator iterator = map1.keySet().iterator(); while (iterator.hasNext()) { int j1 = ((Integer)iterator.next()).intValue(); Enchantment ench = Enchantment.enchantmentsList[j1]; if (j1 == enchantment.effectId && EnchantmentHelper.getEnchantmentLevel(j1, central)>=ench.getMaxLevel()) return false; if (enchantment.effectId != ench.effectId && (!enchantment.canApplyTogether(ench) || !ench.canApplyTogether(enchantment))) { return false; } } ItemStack i2 = null; ArrayList<ItemStack> ii = new ArrayList<ItemStack>(); for (ItemStack is:input) { ii.add(is.copy()); } for (ItemStack comp:components) { boolean b=false; for (int a=0;a<ii.size();a++) { i2 = ii.get(a).copy(); if (comp.getItemDamage()==OreDictionary.WILDCARD_VALUE) { i2.setItemDamage(OreDictionary.WILDCARD_VALUE); } if (areItemStacksEqual(i2, comp,true)) { ii.remove(a); b=true; break; } } if (!b) return false; } // System.out.println(ii.size()); return ii.size()==0?true:false; }
Example 16
Source File: RecipeAmadronTablet.java From PneumaticCraft with GNU General Public License v3.0 | 4 votes |
@Override public boolean matches(InventoryCrafting inventory, World world){ ShapedOreRecipe recipe = new ShapedOreRecipe(new ItemStack(Itemss.amadronTablet, 1, Itemss.amadronTablet.getMaxDamage()), "ppp", "pgp", "pcp", 'p', new ItemStack(Itemss.plastic, 1, ItemPlasticPlants.BURST_PLANT_DAMAGE), 'g', Itemss.GPSTool, 'c', new ItemStack(Itemss.airCanister, 1, OreDictionary.WILDCARD_VALUE)); return recipe.matches(inventory, world); }
Example 17
Source File: AlchemyRecipe.java From PneumaticCraft with GNU General Public License v3.0 | 4 votes |
public boolean doesRecipeMatch(ItemStack[] items, int slottedBloodOrbLevel) { if (slottedBloodOrbLevel < bloodOrbLevel) { return false; } ItemStack[] recipe = new ItemStack[5]; if (items.length < 5) { return false; } if (this.recipe.length != 5) { ItemStack[] newRecipe = new ItemStack[5]; for (int i = 0; i < 5; i++) { if (i + 1 > this.recipe.length) { newRecipe[i] = null; } else { newRecipe[i] = this.recipe[i]; } } recipe = newRecipe; } else { recipe = this.recipe; } boolean[] checkList = new boolean[5]; for (int i = 0; i < 5; i++) { checkList[i] = false; } for (int i = 0; i < 5; i++) { ItemStack recipeItemStack = recipe[i]; if (recipeItemStack == null) { continue; } boolean test = false; for (int j = 0; j < 5; j++) { if (checkList[j]) { continue; } ItemStack checkedItemStack = items[j]; if (checkedItemStack == null) { continue; } boolean quickTest = false; if (recipeItemStack.getItem() instanceof ItemBlock) { if (checkedItemStack.getItem() instanceof ItemBlock) { quickTest = true; } } else if (!(checkedItemStack.getItem() instanceof ItemBlock)) { quickTest = true; } if (!quickTest) { continue; } if ((checkedItemStack.getItemDamage() == recipeItemStack.getItemDamage() || OreDictionary.WILDCARD_VALUE == recipeItemStack.getItemDamage()) && checkedItemStack.getItem()==recipeItemStack.getItem()) { test = true; checkList[j] = true; break; } } if (!test) { return false; } } return true; }
Example 18
Source File: StackHelper.java From EmergingTechnology with MIT License | 4 votes |
public static boolean compareItemStacks(ItemStack stack1, ItemStack stack2) { return stack2.getItem() == stack1.getItem() && (stack2.getMetadata() == OreDictionary.WILDCARD_VALUE || stack2.getMetadata() == stack1.getMetadata()); }
Example 19
Source File: PlantRegistry.java From GardenCollection with MIT License | 4 votes |
public void registerPlantRenderer (String modId, String block, IPlantRenderer renderer) { UniqueMetaIdentifier id = new UniqueMetaIdentifier(modId, block, OreDictionary.WILDCARD_VALUE); renderRegistry.register(id, renderer); }
Example 20
Source File: NEIServerUtils.java From NotEnoughItems with MIT License | 2 votes |
/** * {@link ItemStack}s with damage -1 are wildcards allowing all damages. Eg all colours of wool are allowed to create Beds. * * @param stack1 The {@link ItemStack} being compared. * @param stack2 The {@link ItemStack} to compare to. * @return whether the two items are the same from the perspective of a crafting inventory. */ public static boolean areStacksSameTypeCrafting(ItemStack stack1, ItemStack stack2) { return stack1 != null && stack2 != null && stack1.getItem() == stack2.getItem() && (stack1.getItemDamage() == stack2.getItemDamage() || stack1.getItemDamage() == OreDictionary.WILDCARD_VALUE || stack2.getItemDamage() == OreDictionary.WILDCARD_VALUE || stack1.getItem().isDamageable()); }