本文整理汇总了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;
}
示例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;
}
示例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);
}
示例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;
}
示例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);
}
}
}
}
示例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;
}
示例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);
}
}
}