本文整理匯總了Java中org.bukkit.inventory.ShapedRecipe.getResult方法的典型用法代碼示例。如果您正苦於以下問題:Java ShapedRecipe.getResult方法的具體用法?Java ShapedRecipe.getResult怎麽用?Java ShapedRecipe.getResult使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類org.bukkit.inventory.ShapedRecipe
的用法示例。
在下文中一共展示了ShapedRecipe.getResult方法的4個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。
示例1: fromBukkitRecipe
import org.bukkit.inventory.ShapedRecipe; //導入方法依賴的package包/類
public static CraftShapedRecipe fromBukkitRecipe(ShapedRecipe recipe) {
if (recipe instanceof CraftShapedRecipe) {
return (CraftShapedRecipe) recipe;
}
CraftShapedRecipe ret = new CraftShapedRecipe(recipe.getResult());
String[] shape = recipe.getShape();
ret.shape(shape);
Map<Character, ItemStack> ingredientMap = recipe.getIngredientMap();
for (char c : ingredientMap.keySet()) {
ItemStack stack = ingredientMap.get(c);
if (stack != null) {
ret.setIngredient(c, stack.getType(), stack.getDurability());
}
}
return ret;
}
示例2: fromBukkitRecipe
import org.bukkit.inventory.ShapedRecipe; //導入方法依賴的package包/類
public static CraftShapedRecipe fromBukkitRecipe(ShapedRecipe recipe) {
if (recipe instanceof CraftShapedRecipe) {
return (CraftShapedRecipe) recipe;
}
CraftShapedRecipe ret = new CraftShapedRecipe(recipe.getKey(), recipe.getResult());
String[] shape = recipe.getShape();
ret.shape(shape);
Map<Character, ItemStack> ingredientMap = recipe.getIngredientMap();
for (char c : ingredientMap.keySet()) {
ItemStack stack = ingredientMap.get(c);
if (stack != null) {
ret.setIngredient(c, stack.getType(), stack.getDurability());
}
}
return ret;
}
示例3: collect
import org.bukkit.inventory.ShapedRecipe; //導入方法依賴的package包/類
Transaction collect(ShapedRecipe recipe) {
List<ItemStack> collected = new ArrayList<ItemStack>(rows * columns);
String[] shape = recipe.getShape();
Map<Character, ItemStack> map = recipe.getIngredientMap();
for (String s : shape)
INGREDIENTS: for (int i = 0; i < s.length(); i++) {
ItemStack ingredient = map.get(s.charAt(i));
if (ingredient == null)
continue;
for (ItemStack item : collected) {
if (ItemUtils.itemEqualsTypeAndData(item, ingredient)) {
item.setAmount(item.getAmount() + ingredient.getAmount());
continue INGREDIENTS;
}
}
collected.add(ingredient);
}
return new Transaction(collected, recipe.getResult());
}
示例4: SerialisableShapedRecipe
import org.bukkit.inventory.ShapedRecipe; //導入方法依賴的package包/類
public SerialisableShapedRecipe(ShapedRecipe recipe) {
this.shape = recipe.getShape();
this.result = recipe.getResult();
this.ingredients = recipe.getIngredientMap();
}