本文整理汇总了Java中net.minecraftforge.oredict.OreDictionary.WILDCARD_VALUE属性的典型用法代码示例。如果您正苦于以下问题:Java OreDictionary.WILDCARD_VALUE属性的具体用法?Java OreDictionary.WILDCARD_VALUE怎么用?Java OreDictionary.WILDCARD_VALUE使用的例子?那么, 这里精选的属性代码示例或许可以为您提供帮助。您也可以进一步了解该属性所在类net.minecraftforge.oredict.OreDictionary
的用法示例。
在下文中一共展示了OreDictionary.WILDCARD_VALUE属性的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: matches
@Override
public boolean matches(ItemStack subject) {
List<ItemStack> inputs = getOres();
boolean useOreStackMeta = (meta == null);
Item subjectItem = subject.getItem();
int subjectMeta = subject.getItemDamage();
for (ItemStack oreStack : inputs) {
Item oreItem = oreStack.getItem();
if (oreItem == null) continue; // ignore invalid
int metaRequired = useOreStackMeta ? oreStack.getItemDamage() : meta;
if (subjectItem == oreItem &&
(subjectMeta == metaRequired || metaRequired == OreDictionary.WILDCARD_VALUE)) {
return true;
}
}
return false;
}
示例2: HarshenStack
/**
* Used to create a list of stacks, from oreDictionary
* @param oreDictName A list of OreDictionary value you want to use
*/
public HarshenStack(String... oreDictNames) {
for(String oreDictName : oreDictNames)
{
NonNullList<ItemStack> stackList = OreDictionary.getOres(oreDictName);
if(stackList.isEmpty())
new IllegalArgumentException("Oredictionary vaule " + oreDictName + " doesnt exist").printStackTrace(System.out);
else
for(ItemStack stack : stackList)
if(stack.getMetadata() == OreDictionary.WILDCARD_VALUE)
{
NonNullList<ItemStack> innerStacklist = NonNullList.create();
stack.getItem().getSubItems(CreativeTabs.SEARCH, innerStacklist);
for(ItemStack wildStack : innerStacklist)
this.stackList.add(stack.copy());
}
else
this.stackList.add(stack);
}
}
示例3: stackEqualsNonNBT
public static boolean stackEqualsNonNBT(@Nonnull ItemStack stack, @Nonnull ItemStack other) {
if (stack.isEmpty() && other.isEmpty())
return true;
if (stack.isEmpty() || other.isEmpty())
return false;
Item sItem = stack.getItem();
Item oItem = other.getItem();
if (sItem.getHasSubtypes() || oItem.getHasSubtypes()) {
return sItem.equals(other.getItem()) &&
(stack.getItemDamage() == other.getItemDamage() ||
stack.getItemDamage() == OreDictionary.WILDCARD_VALUE ||
other.getItemDamage() == OreDictionary.WILDCARD_VALUE);
} else {
return sItem.equals(other.getItem());
}
}
示例4: parseItemPart
private Pair<String, Integer> parseItemPart(String input)
{
int meta = 0;
if (input.contains("@"))
{
String metaPart = input.substring(input.lastIndexOf('@') + 1);
input = input.substring(0, input.lastIndexOf('@'));
if (metaPart.equalsIgnoreCase(WILDCARD_STRING))
{
meta = OreDictionary.WILDCARD_VALUE;
} else
{
meta = Integer.parseInt(metaPart);
}
}
return Pair.of(input, meta);
}
示例5: getBoostFromBooster
public static float getBoostFromBooster(ItemStack stack)
{
if (stack == null)
{
return Float.NaN;
}
for (Map.Entry<ItemStack, Float> entry : boosterRegistry.entrySet())
{
ItemStack tested = entry.getKey();
if (tested.getMetadata() == OreDictionary.WILDCARD_VALUE)
{
if (tested.getItem() == stack.getItem())
{
return entry.getValue();
}
}
else
{
if (tested.getItem() == stack.getItem() && tested.getMetadata() == stack.getMetadata())
{
return entry.getValue();
}
}
}
return Float.NaN;
}
示例6: getDamage
public int getDamage()
{
if (isWildcard)
{
return OreDictionary.WILDCARD_VALUE;
}
return damage;
}
示例7: worksWith
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.getBlock();
final int supportedMetadata = item.getMetadata(stack.getItemDamage());
if (referenceBlock == supportedBlock && (referenceMetadata == supportedMetadata || stack.getItemDamage() == OreDictionary.WILDCARD_VALUE)) {
return true;
}
}
}
return false;
}
示例8: add
@ZenMethod
public static void add(IItemStack output, ILiquidStack liquid, @NotNull IItemStack stamp, @Optional IItemStack input) {
ItemStack stack = InputHelper.toStack(input);
ItemStack stampStack = InputHelper.toStack(stamp); //This is pointless but also the easiest way.
ItemStampingRecipe recipe = new ItemStampingRecipe(stack,InputHelper.toFluid(liquid), EnumStampType.getType(stampStack),InputHelper.toStack(output),stack.getMetadata() != OreDictionary.WILDCARD_VALUE,stack.hasTagCompound());
CraftTweakerAPI.apply(new Add(recipe));
}
示例9: getStacksWithWildCard
public static ArrayList<ItemStack> getStacksWithWildCard(ItemStack wildCardStack)
{
if(wildCardStack.getMetadata() != OreDictionary.WILDCARD_VALUE)
return toArray();
ArrayList<ItemStack> stackList = new ArrayList<>();
NonNullList<ItemStack> innerStacklist = NonNullList.create();
wildCardStack.getItem().getSubItems(CreativeTabs.SEARCH, innerStacklist);
for(ItemStack stack : innerStacklist)
stackList.add(stack.copy());
return stackList;
}
示例10: containsItem
/**
* Can the input stack be used as an input item. Returns true if the stackList ({@link HarshenStack#getStackList})
* contains the input item.
* @param stack the stack to test with
* @return true if the stack can be used, false if not
*/
public boolean containsItem(ItemStack stack)
{
for(ItemStack innerStack : getStackList())
if(((innerStack.getMetadata() == OreDictionary.WILDCARD_VALUE ? innerStack.getItem() == stack.getItem() : innerStack.isItemEqual(stack)) &&
(dependOnNBT ? ItemStack.areItemStackShareTagsEqual(innerStack, stack) : true)) || (innerStack.isEmpty() && stack.isEmpty()))
return true;
return false;
}
示例11: isSameStackForFuel
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;
}
示例12: isCorrectItem
private boolean isCorrectItem(ItemStack eventStack)
{
boolean itemEqual = eventStack.getMetadata() == OreDictionary.WILDCARD_VALUE
? stack.isItemEqualIgnoreDurability(eventStack)
: stack.isItemEqual(eventStack);
boolean nbtEqual = !eventStack.hasTagCompound() || ItemStack.areItemStackTagsEqual(eventStack, stack);
return itemEqual && nbtEqual;
}
示例13: matches
public static final boolean matches(ItemStack template, ItemStack item) {
boolean templatePresent = template!=null && !template.isEmpty();
boolean itemPresent = item!=null && !item.isEmpty();
if (!templatePresent && itemPresent) return false; // Empty != NonEmpty
if ( templatePresent && !itemPresent) return false; // NonEmpty != Empty
if (!templatePresent && !itemPresent) return true; // Empty == Empty
if (template.getItemDamage()==OreDictionary.WILDCARD_VALUE) {
return ItemStack.areItemsEqualIgnoreDurability(template, item) &&
ItemStack.areItemStackTagsEqual(template, item);
} else {
return ItemStack.areItemsEqual(template, item) &&
ItemStack.areItemStackTagsEqual(template, item);
}
}
示例14: matches
@Override
public boolean matches(ItemStack subject) {
return subject.getItem() == input.getItem() &&
(subject.getItemDamage() == input.getItemDamage() || input.getItemDamage() == OreDictionary.WILDCARD_VALUE);
}
示例15: add
@ZenMethod
public static void add(ILiquidStack output, IItemStack input) {
ItemStack stack = InputHelper.toStack(input);
ItemMeltingRecipe recipe = new ItemMeltingRecipe(stack,InputHelper.toFluid(output),stack.getMetadata() != OreDictionary.WILDCARD_VALUE,stack.hasTagCompound());
CraftTweakerAPI.apply(new Add(recipe));
}