本文整理汇总了Java中org.bukkit.inventory.ShapedRecipe.getIngredientMap方法的典型用法代码示例。如果您正苦于以下问题:Java ShapedRecipe.getIngredientMap方法的具体用法?Java ShapedRecipe.getIngredientMap怎么用?Java ShapedRecipe.getIngredientMap使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.bukkit.inventory.ShapedRecipe
的用法示例。
在下文中一共展示了ShapedRecipe.getIngredientMap方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的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: initRecipes
import org.bukkit.inventory.ShapedRecipe; //导入方法依赖的package包/类
public static void initRecipes()
{
for(BagBase bb : Util.getBags())
{
String prefix = "recipes." + bb.getName();
ShapedRecipe sr = bb.getStandardRecipe();
Map<Character, ItemStack> map = sr.getIngredientMap();
Material[] matArray = new Material[9];
setIf(prefix + ".1", map.get(sr.getShape()[0].charAt(0)).getType().toString());
setIf(prefix + ".2", map.get(sr.getShape()[0].charAt(1)).getType().toString());
setIf(prefix + ".3", map.get(sr.getShape()[0].charAt(2)).getType().toString());
setIf(prefix + ".4", map.get(sr.getShape()[1].charAt(0)).getType().toString());
setIf(prefix + ".5", map.get(sr.getShape()[1].charAt(1)).getType().toString());
setIf(prefix + ".6", map.get(sr.getShape()[1].charAt(2)).getType().toString());
setIf(prefix + ".7", map.get(sr.getShape()[2].charAt(0)).getType().toString());
setIf(prefix + ".8", map.get(sr.getShape()[2].charAt(1)).getType().toString());
setIf(prefix + ".9", map.get(sr.getShape()[2].charAt(2)).getType().toString());
}
try {
Bags2.recipes.save(Bags2.recipesFile);
} catch (IOException e)
{
e.printStackTrace();
}
}
示例5: verify
import org.bukkit.inventory.ShapedRecipe; //导入方法依赖的package包/类
boolean verify(ShapedRecipe recipe) {
String[] shape = recipe.getShape();
if (shape.length != rows)
return false;
if (shape[0].length() != columns)
return false;
Map<Character, ItemStack> map = recipe.getIngredientMap();
return verifyShape(map, shape, false) || verifyShape(map, shape, true);
}
示例6: SerialisableShapedRecipe
import org.bukkit.inventory.ShapedRecipe; //导入方法依赖的package包/类
public SerialisableShapedRecipe(ShapedRecipe recipe) {
this.shape = recipe.getShape();
this.result = recipe.getResult();
this.ingredients = recipe.getIngredientMap();
}