本文整理汇总了Java中net.minecraftforge.oredict.OreDictionary.getOres方法的典型用法代码示例。如果您正苦于以下问题:Java OreDictionary.getOres方法的具体用法?Java OreDictionary.getOres怎么用?Java OreDictionary.getOres使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类net.minecraftforge.oredict.OreDictionary
的用法示例。
在下文中一共展示了OreDictionary.getOres方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: HarshenStack
import net.minecraftforge.oredict.OreDictionary; //导入方法依赖的package包/类
/**
* 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);
}
}
示例2: CachedPatternRecipe
import net.minecraftforge.oredict.OreDictionary; //导入方法依赖的package包/类
public CachedPatternRecipe(EnumBannerPattern pattern, String[] grid, List<Object> inputs) {
this.pattern = pattern;
for (int y = 0; y < 3; y++)
for (int x = 0; x < 3; x++) {
char c = grid[y].charAt(x);
if (c != ' ') {
Object input = inputs.get(inputs.indexOf(c) + 1);
if (input instanceof String)
input = OreDictionary.getOres((String) input);
PositionedStack stack = new PositionedStack(input, 25 + x * 18, 6 + y * 18);
stack.setMaxSize(1);
ingredients.add(stack);
}
}
}
示例3: isSameRecipeInput
import net.minecraftforge.oredict.OreDictionary; //导入方法依赖的package包/类
@SuppressWarnings("unchecked")
public static boolean isSameRecipeInput(Ingredient target, Object input)
{
if (input instanceof String)
{
NonNullList<ItemStack> ores = OreDictionary.getOres(input.toString());
return ores.stream().allMatch(target::apply);
} else if (input instanceof ItemStack)
{
return target.apply((ItemStack) input);
} else if (input instanceof NonNullList)
{
NonNullList<ItemStack> items = (NonNullList<ItemStack>) input;
return items.stream().anyMatch(target::apply);
} else
{
throw new IllegalArgumentException("Invalid input: " + input);
}
}
示例4: getRecipeInput
import net.minecraftforge.oredict.OreDictionary; //导入方法依赖的package包/类
/**
* Gets recipe input without the chars for the shape.
*/
Object[] getRecipeInput()
{
Object[] result = new Object[getRecipeWidth() * getRecipeHeight()];
for (int row = 0; row < shape.length; row++)
{
for (int col = 0; col < shape[0].length(); col++)
{
RecipeInput input = items.get(shape[row].charAt(col));
int index = col + row * shape[0].length();
if (input != null)
{
result[index] = input.isOreClass() ? OreDictionary.getOres(input.getOreClass().getOreName()) : input.getStack().getItemStack();
} else
{
result[index] = ItemStack.EMPTY;
}
}
}
return result;
}
示例5: test_isSameRecipeInput
import net.minecraftforge.oredict.OreDictionary; //导入方法依赖的package包/类
@Test
public void test_isSameRecipeInput()
{
assertTrue(ItemHelper.isSameRecipeInput(new OreIngredient("stickWood"), "stickWood"));
assertFalse(ItemHelper.isSameRecipeInput(new OreIngredient("stickWood"), "oreIron"));
assertTrue(ItemHelper.isSameRecipeInput(Ingredient.fromItem(Items.APPLE), new ItemStack(Items.APPLE)));
assertFalse(ItemHelper.isSameRecipeInput(Ingredient.fromItem(Items.APPLE), new ItemStack(Items.DIAMOND_SWORD)));
NonNullList<ItemStack> stickWoodList = OreDictionary.getOres("stickWood");
ItemStack[] stickWood = stickWoodList.toArray(new ItemStack[0]);
assertTrue(ItemHelper.isSameRecipeInput(Ingredient.fromStacks(stickWood), stickWoodList));
assertFalse(ItemHelper.isSameRecipeInput(Ingredient.fromStacks(stickWood), OreDictionary.getOres("ingotIron")));
assertTrue(ItemHelper.isSameRecipeInput(Ingredient.fromStacks(stickWood), new ItemStack(Items.STICK)));
assertTrue(ItemHelper.isSameRecipeInput(Ingredient.fromItem(Items.STICK), stickWoodList));
assertFalse(ItemHelper.isSameRecipeInput(Ingredient.fromStacks(stickWood), new ItemStack(Items.DIAMOND_PICKAXE)));
}
示例6: getStackDescription
import net.minecraftforge.oredict.OreDictionary; //导入方法依赖的package包/类
/**
* Returns a string representation of the item which can also be used in scripts
*/
@SuppressWarnings("rawtypes")
public static String getStackDescription(Object object) {
if(object instanceof IIngredient) {
return getStackDescription((IIngredient) object);
} else if(object instanceof ItemStack) {
return toIItemStack((ItemStack) object).toString();
} else if(object instanceof FluidStack) {
return getStackDescription((FluidStack) object);
} else if(object instanceof Block) {
return toIItemStack(new ItemStack((Block) object, 1, 0)).toString();
} else if(object instanceof String) {
// Check if string specifies an oredict entry
List<ItemStack> ores = OreDictionary.getOres((String) object);
if(!ores.isEmpty()) {
return "<ore:" + (String) object + ">";
} else {
return "\"" + (String) object + "\"";
}
} else if(object instanceof List) {
return getListDescription((List) object);
} else if(object instanceof Object[]) {
return getListDescription(Arrays.asList((Object[]) object));
} else if(object != null) {
return "\"" + object.toString() + "\"";
} else if(object instanceof Ingredient && !((Ingredient) object).apply(ItemStack.EMPTY) && ((Ingredient) object).getMatchingStacks().length > 0) {
return getStackDescription(((Ingredient) object).getMatchingStacks()[0]);
} else {
return "null";
}
}
示例7: isSameOreDictStack
import net.minecraftforge.oredict.OreDictionary; //导入方法依赖的package包/类
public static boolean isSameOreDictStack(ItemStack stack1, ItemStack stack2) {
int[] oredictIds = OreDictionary.getOreIDs(stack1);
for (int oredictId : oredictIds) {
List<ItemStack> oreDictStacks = OreDictionary.getOres(OreDictionary.getOreName(oredictId));
for (ItemStack oreDictStack : oreDictStacks) {
if (OreDictionary.itemMatches(oreDictStack, stack2, false)) {
return true;
}
}
}
return false;
}
示例8: generateCrushedRecipes
import net.minecraftforge.oredict.OreDictionary; //导入方法依赖的package包/类
public static void generateCrushedRecipes() {
crushedRecipes.put(new ItemStack(Blocks.STONE), new ItemStack(Blocks.COBBLESTONE));
crushedRecipes.put(new ItemStack(Blocks.COBBLESTONE), new ItemStack(Blocks.GRAVEL));
crushedRecipes.put(new ItemStack(Blocks.GRAVEL), new ItemStack(Blocks.SAND));
ItemStack latest = new ItemStack(Blocks.SAND);
if (Loader.isModLoaded("exnihilocreatio")) {
Block dust = Block.REGISTRY.getObject(new ResourceLocation("exnihilocreatio:block_dust"));
crushedRecipes.put(new ItemStack(Blocks.SAND), latest = new ItemStack(dust));
}
NonNullList<ItemStack> items = OreDictionary.getOres("itemSilicon");
if (items.size() > 0) crushedRecipes.put(latest, items.get(0));
}
示例9: registerSmelterConfigOreRecipe
import net.minecraftforge.oredict.OreDictionary; //导入方法依赖的package包/类
public static void registerSmelterConfigOreRecipe(String input, String output, float experience, int boosters, int bonus)
{
for (ItemStack stack : OreDictionary.getOres(input, false))
{
List<ItemStack> valid = OreDictionary.getOres(output, false);
if (!valid.isEmpty())
{
SmelterConfig.addRecipe(stack, valid.get(0), experience, boosters, bonus);
}
}
}
示例10: getItemStacks
import net.minecraftforge.oredict.OreDictionary; //导入方法依赖的package包/类
public List<ItemStack> getItemStacks()
{
if (isOreDictionary)
{
return OreDictionary.getOres(itemName, false);
}
Item item = RegistryUtil.getItemFromRegistry(itemName);
if (item == null) return Collections.emptyList();
List<ItemStack> single = new ArrayList<>();
single.add(new ItemStack(item, 1, getDamage()));
return single;
}
示例11: matches
import net.minecraftforge.oredict.OreDictionary; //导入方法依赖的package包/类
public static final boolean matches(String 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 (!OreDictionary.doesOreNameExist(template)) return false;
NonNullList<ItemStack> ores = OreDictionary.getOres(template);
return OreDictionary.containsMatch(false, ores, item);
}
示例12: keyTyped
import net.minecraftforge.oredict.OreDictionary; //导入方法依赖的package包/类
@Override
protected void keyTyped(char typedChar, int keyCode) throws IOException {
if(keyCode == Keyboard.KEY_TAB)
{ this.textInput.setMaxStringLength(60);
ArrayList<String> stringList = new ArrayList<>();
if(dictonaryList.isEmpty())
{
stringList.addAll(CommandBase.getListOfStringsMatchingLastWord(HarshenUtils.listOf(this.textInput.getText()), Block.REGISTRY.getKeys()));
for(String s : HarshenUtils.getAllOreDictionaryList())
for(ItemStack stack : OreDictionary.getOres(s))
if(Block.getBlockFromItem(stack.getItem()) != Blocks.AIR)
stringList.add(s);
dictonaryList = CommandBase.getListOfStringsMatchingLastWord(HarshenUtils.listOf(this.textInput.getText()), stringList);
}
if(!dictonaryList.isEmpty())
this.textInput.setText(dictonaryList.get(timeOver++%dictonaryList.size()));
}
else
{
timeOver = 0;
dictonaryList.clear();
}
if(keyCode == Keyboard.KEY_RETURN)
closeGui();
this.textInput.textboxKeyTyped(typedChar, keyCode);
super.keyTyped(typedChar, keyCode);
}
示例13: OreDictStack
import net.minecraftforge.oredict.OreDictionary; //导入方法依赖的package包/类
public OreDictStack(String oreDictEntry){
this.oreDictEntry = oreDictEntry;
this.entries = OreDictionary.getOres(oreDictEntry);
if(!this.entries.isEmpty()){
this.primaryStack = this.entries.get(0);
}
}
示例14: matches
import net.minecraftforge.oredict.OreDictionary; //导入方法依赖的package包/类
private boolean matches(String oreDict) {
List<ItemStack> stacks = OreDictionary.getOres(oreDict);
for(ItemStack stack : stacks) {
if(OreDictionary.itemMatches(stack, input, false)) {
return true;
}
}
return false;
}
示例15: OreRecipeElement
import net.minecraftforge.oredict.OreDictionary; //导入方法依赖的package包/类
public OreRecipeElement(String dictionaryEntry, final int size)
{
cachedValidItems = Lists.newArrayList();
for(ItemStack stack : OreDictionary.getOres(dictionaryEntry, false))
{
ItemStack newStack = stack.copy();
newStack.setCount(size);
cachedValidItems.add(newStack);
}
oreDictionaryEntry = dictionaryEntry;
stackSize = size;
}