当前位置: 首页>>代码示例>>Java>>正文


Java Recipe.getResult方法代码示例

本文整理汇总了Java中org.bukkit.inventory.Recipe.getResult方法的典型用法代码示例。如果您正苦于以下问题:Java Recipe.getResult方法的具体用法?Java Recipe.getResult怎么用?Java Recipe.getResult使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在org.bukkit.inventory.Recipe的用法示例。


在下文中一共展示了Recipe.getResult方法的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: getRecipesFor

import org.bukkit.inventory.Recipe; //导入方法依赖的package包/类
@Override
public List<Recipe> getRecipesFor(ItemStack result) {
    Validate.notNull(result, "Result cannot be null");

    List<Recipe> results = new ArrayList<Recipe>();
    Iterator<Recipe> iter = recipeIterator();
    while (iter.hasNext()) {
        Recipe recipe = iter.next();
        ItemStack stack = recipe.getResult();
        if (stack.getType() != result.getType()) {
            continue;
        }
        if (result.getDurability() == -1 || result.getDurability() == stack.getDurability()) {
            results.add(recipe);
        }
    }
    return results;
}
 
开发者ID:UraniumMC,项目名称:Uranium,代码行数:19,代码来源:CraftServer.java

示例2: getRecipesFor

import org.bukkit.inventory.Recipe; //导入方法依赖的package包/类
@Override
public List<Recipe> getRecipesFor(ItemStack result) {
       Validate.notNull(result, "Result cannot be null");

       List<Recipe> results = new ArrayList<Recipe>();
       Iterator<Recipe> iter = recipeIterator();
       while (iter.hasNext()) {
           Recipe recipe = iter.next();
           ItemStack stack = recipe.getResult();
           if (stack.getType() != result.getType()) {
               continue;
           }
           if (result.getDurability() == -1 || result.getDurability() == stack.getDurability()) {
               results.add(recipe);
           }
       }
       return results;
}
 
开发者ID:DevotedMC,项目名称:ExilePearl,代码行数:19,代码来源:TestServer.java

示例3: jungleWoodPlanksCanCreateCraftingTableAndJungleWoodStairs

import org.bukkit.inventory.Recipe; //导入方法依赖的package包/类
@Test
public void jungleWoodPlanksCanCreateCraftingTableAndJungleWoodStairs() {
    Tree planks = new Tree(Material.WOOD);
    planks.setSpecies(TreeSpecies.JUNGLE);
    MaterialRecipes materialRecipes = recipeSnapshot.getMaterialRecipes(planks);
    boolean foundWorkBench = false;
    boolean foundJungleWoodPlanks = false;
    for (Recipe recipe : materialRecipes.getUsages()) {
        ItemStack result = recipe.getResult();
        if (Material.WORKBENCH.equals(result.getType())) {
            foundWorkBench = true;
        } else if (Material.JUNGLE_WOOD_STAIRS.equals(result.getType())) {
            foundJungleWoodPlanks = true;
        }
    }
    assertEqual(true, foundWorkBench);
    assertEqual(true, foundJungleWoodPlanks);
}
 
开发者ID:sciolizer,项目名称:craftinomicon,代码行数:19,代码来源:RecipeSnapshotTest.java

示例4: getRecipesFor

import org.bukkit.inventory.Recipe; //导入方法依赖的package包/类
public List<Recipe> getRecipesFor(ItemStack result) {
    Validate.notNull(result, "Result cannot be null");

    List<Recipe> results = new ArrayList<Recipe>();
    Iterator<Recipe> iter = recipeIterator();
    while (iter.hasNext()) {
        Recipe recipe = iter.next();
        ItemStack stack = recipe.getResult();
        if (stack.getType() != result.getType()) {
            continue;
        }
        if (result.getDurability() == -1 || result.getDurability() == stack.getDurability()) {
            results.add(recipe);
        }
    }
    return results;
}
 
开发者ID:AlmuraDev,项目名称:Almura-Server,代码行数:18,代码来源:CraftServer.java

示例5: onPrepareCraft

import org.bukkit.inventory.Recipe; //导入方法依赖的package包/类
@EventHandler
public void onPrepareCraft(PrepareItemCraftEvent e) {

	Recipe r = e.getInventory().getRecipe();
	if (r == null || e.getViewers().size() != 1) {
		return;
	}

	Player viewer = (Player) e.getViewers().get(0);

	if (r.getResult() != null) {
		DuctDetails ductDetails = DuctItemUtils.getDuctDetailsOfItem(r.getResult());
		if (ductDetails != null) {
			if (!viewer.hasPermission(ductDetails.getCraftPermission())) {
				e.getInventory().setResult(null);
				return;
			}
		} else if (DuctItemUtils.getWrenchItem().isSimilar(r.getResult())) {
			if (!viewer.hasPermission("transportpipes.craft.wrench")) {
				e.getInventory().setResult(null);
				return;
			}
		}

		if (ductDetails != null && ductDetails.getDuctType() == DuctType.PIPE) {
			boolean prevent = false;
			for (int i = 1; i < 10; i++) {
				ItemStack is = e.getInventory().getItem(i);
				if (is != null && is.getType() == Material.SKULL_ITEM && is.getDurability() == SkullType.PLAYER.ordinal()) {
					DuctDetails isDuctDetails = DuctItemUtils.getDuctDetailsOfItem(is);
					prevent |= isDuctDetails == null;
				}
			}
			if (prevent) {
				e.getInventory().setResult(null);
			}
		}
	}
}
 
开发者ID:RoboTricker,项目名称:Transport-Pipes,代码行数:40,代码来源:CraftUtils.java

示例6: getSmeltedOutput

import org.bukkit.inventory.Recipe; //导入方法依赖的package包/类
public static ItemStack getSmeltedOutput(Material type) {
	ItemStack result = null;
	Iterator<Recipe> iter = Bukkit.recipeIterator();
	while (iter.hasNext()) {
	   Recipe recipe = iter.next();
	   if (!(recipe instanceof FurnaceRecipe)) continue;
	   if (((FurnaceRecipe) recipe).getInput().getType() != type) continue;
	   result = recipe.getResult();
	   break;
	}
	
	return result;
}
 
开发者ID:TheBusyBiscuit,项目名称:CS-CoreLib,代码行数:14,代码来源:RecipeCalculator.java

示例7: openUpgradePage

import org.bukkit.inventory.Recipe; //导入方法依赖的package包/类
public void openUpgradePage(Inventory currentGUI) {
	
	if(automator.page < automator.pageList.size()) {
		ArrayList<Recipe> recipeList = automator.pageList.get(automator.page);
		
		for(int i=0; i<recipeList.size(); i++) {
			
			Recipe recipe = recipeList.get(i);
			automator.openRecipes = recipeList;
			
			ItemStack displayItem = recipe.getResult();
			ItemMeta meta = displayItem.getItemMeta();
			
			String itemName = displayItem.getType().toString();
			List<String> lore = new ArrayList<String>();
			if(meta.hasLore()) {
				lore = meta.getLore();
			}
			lore.add(ChatColor.RED + "" + ChatColor.MAGIC + "Contraband");
			
			meta.setDisplayName(ChatColor.RESET + "Choose This Recipe");
			meta.setLore(lore);
			displayItem.setItemMeta(meta);
			
			currentGUI.setItem(i, displayItem);
		
		}
	}
	
}
 
开发者ID:StarQuestMinecraft,项目名称:StarQuestCode,代码行数:31,代码来源:AutomatorGUI.java


注:本文中的org.bukkit.inventory.Recipe.getResult方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。