本文整理汇总了Java中org.bukkit.inventory.FurnaceRecipe类的典型用法代码示例。如果您正苦于以下问题:Java FurnaceRecipe类的具体用法?Java FurnaceRecipe怎么用?Java FurnaceRecipe使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
FurnaceRecipe类属于org.bukkit.inventory包,在下文中一共展示了FurnaceRecipe类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: registerRecipes
import org.bukkit.inventory.FurnaceRecipe; //导入依赖的package包/类
public void registerRecipes() {
Bukkit.resetRecipes();
addRecipe(new ShapedRecipe(new ItemStack(MaterialList.BEETROOT_SOUP)).shape(new String[] {"rrr", "rrr", " b "}).setIngredient('r', MaterialList.BEETROOT).setIngredient('b', org.bukkit.Material.BOWL));
addRecipe(new ShapedRecipe(new ItemStack(MaterialList.END_BRICKS)).shape(new String[] {"ee", "ee"}).setIngredient('e', org.bukkit.Material.ENDER_STONE));
//Purpur block recipes
addRecipe(new FurnaceRecipe(new ItemStack(MaterialList.CHORUS_FRUIT_POPPED), MaterialList.CHORUS_FRUIT));
addRecipe(new ShapedRecipe(new ItemStack(MaterialList.PURPUR_BLOCK, 4)).shape(new String[] {"pp", "pp"}).setIngredient('p', MaterialList.CHORUS_FRUIT_POPPED));
addRecipe(new ShapedRecipe(new ItemStack(MaterialList.PURPUR_STAIRS, 4)).shape(new String[] {"p ", "pp ", "ppp"}).setIngredient('p', MaterialList.PURPUR_BLOCK));
addRecipe(new ShapedRecipe(new ItemStack(MaterialList.PURPUR_STAIRS, 4)).shape(new String[] {" p", " pp", "ppp"}).setIngredient('p', MaterialList.PURPUR_BLOCK));
addRecipe(new ShapedRecipe(new ItemStack(MaterialList.PURPUR_SLAB, 6)).shape(new String[] {"ppp"}).setIngredient('p', MaterialList.PURPUR_BLOCK));
addRecipe(new ShapedRecipe(new ItemStack(MaterialList.PURPUR_PILLAR)).shape(new String[] {"s", "s"}).setIngredient('s', MaterialList.PURPUR_SLAB));
//Arrows
addRecipe(new ShapedRecipe(new ItemStack(MaterialList.SPECTRAL_ARROW, 2)).shape(new String[] {" d ", "dad", " d "}).setIngredient('d', org.bukkit.Material.GLOWSTONE_DUST).setIngredient('a', org.bukkit.Material.ARROW));
}
示例2: setupRecipes
import org.bukkit.inventory.FurnaceRecipe; //导入依赖的package包/类
public static void setupRecipes() {
for (String key : SensibleToolbox.getItemRegistry().getItemIds()) {
// add custom workbench recipes
BaseSTBItem item = SensibleToolbox.getItemRegistry().getItemById(key);
Recipe r = item.getRecipe();
if (r != null) {
Bukkit.addRecipe(r);
}
for (Recipe r2 : item.getExtraRecipes()) {
Bukkit.addRecipe(r2);
}
// add custom furnace recipes
ItemStack stack = item.getSmeltingResult();
if (stack != null) {
Bukkit.addRecipe(new FurnaceRecipe(stack, item.getMaterialData()));
recordReverseSmelt(stack, item.toItemStack());
}
// add custom processing recipes for any machine items
if (item instanceof BaseSTBMachine) {
((BaseSTBMachine) item).addCustomRecipes(CustomRecipeManager.getManager());
}
}
}
示例3: addCustomRecipes
import org.bukkit.inventory.FurnaceRecipe; //导入依赖的package包/类
@Override
public void addCustomRecipes(CustomRecipeManager crm) {
// add a corresponding smelter recipe for every known vanilla furnace recipe
Iterator<Recipe> iter = Bukkit.recipeIterator();
while (iter.hasNext()) {
Recipe r = iter.next();
if (r instanceof FurnaceRecipe) {
FurnaceRecipe fr = (FurnaceRecipe) r;
if (RecipeUtil.isVanillaSmelt(fr.getInput().getType())) {
crm.addCustomRecipe(new SimpleCustomRecipe(this, fr.getInput(), fr.getResult(), getProcessingTime(fr.getInput())));
}
}
}
// add a processing recipe for any STB item which reports itself as smeltable
for (String key : SensibleToolbox.getItemRegistry().getItemIds()) {
BaseSTBItem item = SensibleToolbox.getItemRegistry().getItemById(key);
if (item.getSmeltingResult() != null) {
ItemStack stack = item.toItemStack();
crm.addCustomRecipe(new SimpleCustomRecipe(this, stack, item.getSmeltingResult(), getProcessingTime(stack)));
}
}
}
示例4: parseSmeltingRecipe
import org.bukkit.inventory.FurnaceRecipe; //导入依赖的package包/类
public Recipe parseSmeltingRecipe(MapModuleContext context, Element elRecipe) throws InvalidXMLException {
MaterialPattern ingredient = XMLUtils.parseMaterialPattern(XMLUtils.getRequiredUniqueChild(elRecipe, "ingredient", "i"));
ItemStack result = parseRecipeResult(context, elRecipe);
if(ingredient.dataMatters()) {
return new FurnaceRecipe(result, ingredient.getMaterialData());
} else {
return new FurnaceRecipe(result, ingredient.getMaterial());
}
}
示例5: getSmeltedOutput
import org.bukkit.inventory.FurnaceRecipe; //导入依赖的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;
}
示例6: accept
import org.bukkit.inventory.FurnaceRecipe; //导入依赖的package包/类
public static <T> T accept(Recipe recipe, RecipeVisitor<T> visitor) {
if (recipe instanceof ShapedRecipe) {
ShapedRecipe shapedRecipe = (ShapedRecipe) recipe;
return visitor.visit(shapedRecipe);
} else if (recipe instanceof ShapelessRecipe) {
ShapelessRecipe shapelessRecipe = (ShapelessRecipe) recipe;
return visitor.visit(shapelessRecipe);
} else if (recipe instanceof FurnaceRecipe) {
FurnaceRecipe furnaceRecipe = (FurnaceRecipe) recipe;
return visitor.visit(furnaceRecipe);
}
return visitor.visitOther(recipe);
}
示例7: registerDefaultRecipes
import org.bukkit.inventory.FurnaceRecipe; //导入依赖的package包/类
@Override
public void registerDefaultRecipes() {
Iterator<Recipe> iterator = Bukkit.recipeIterator();
while (iterator.hasNext()) {
Recipe r = iterator.next();
if (r instanceof FurnaceRecipe) {
registerRecipe(4, new ItemStack[] {((FurnaceRecipe) r).getInput()}, new ItemStack[] {r.getResult()});
}
}
}
示例8: addAllRecipes
import org.bukkit.inventory.FurnaceRecipe; //导入依赖的package包/类
static void addAllRecipes (FileConfiguration config) {
if (config.getBoolean("allowFleshSmelt")) {
Bukkit.addRecipe(new FurnaceRecipe(new ItemStack(Material.LEATHER),Material.ROTTEN_FLESH));
}
if (config.getBoolean("allowJerky")){
ShapelessRecipe jerky = new ShapelessRecipe(new ItemStack(Material.RAW_BEEF));
jerky.addIngredient(2, Material.ROTTEN_FLESH);
jerky.addIngredient(Material.SUGAR);
Bukkit.addRecipe(jerky);
}
}
示例9: removeAllRecipes
import org.bukkit.inventory.FurnaceRecipe; //导入依赖的package包/类
static void removeAllRecipes() {
Recipe recipe;
// Check iterator for any of our recipes, if so, remove them
Iterator<Recipe> iter = Bukkit.recipeIterator();
while (iter.hasNext()) {
recipe = iter.next();
// Check if this Recipe is one of the ones we are responsible for
// First, Furnace Recipes
try {
if (recipe instanceof FurnaceRecipe) {
if ((Material.LEATHER == recipe.getResult().getType()) &&
(Material.ROTTEN_FLESH == ((FurnaceRecipe) recipe).getInput().getType())){
iter.remove();
}
}
// Check for our Shapeless Recipes
if (recipe instanceof ShapelessRecipe) {
if (Material.RAW_BEEF == recipe.getResult().getType()) {
List<ItemStack> ingredients = ((ShapelessRecipe) recipe).getIngredientList();
if (3 == ingredients.size() &&
ingredients.contains(new ItemStack(Material.ROTTEN_FLESH)) &&
ingredients.contains(new ItemStack(Material.SUGAR))) {
iter.remove();
}
}
}
}
catch (NullPointerException e) {
System.out.print("[ERROR]: Failed to process Recipe iterator");
e.printStackTrace();
// Don't rethrow, attempt recovery
}
}
}
示例10: getBurnableMaterials
import org.bukkit.inventory.FurnaceRecipe; //导入依赖的package包/类
private static Set<Material> getBurnableMaterials() {
Set<Material> burnables = new HashSet<Material>(24);
for (Iterator<Recipe> it = MachinaCore.plugin.getServer().recipeIterator(); it.hasNext();) {
Recipe recipe = it.next();
if (recipe instanceof FurnaceRecipe) {
burnables.add(((FurnaceRecipe) recipe).getInput().getType());
}
}
return burnables;
}
示例11: isSmelted
import org.bukkit.inventory.FurnaceRecipe; //导入依赖的package包/类
public static boolean isSmelted(ItemStack item) {
if (item == null) {
return false;
}
for (Recipe recipe : mcMMO.p.getServer().getRecipesFor(item)) {
if (recipe instanceof FurnaceRecipe) {
return MaterialUtils.isOre(((FurnaceRecipe) recipe).getInput().getData());
}
}
return false;
}
示例12: findVanillaFurnaceMaterials
import org.bukkit.inventory.FurnaceRecipe; //导入依赖的package包/类
public static void findVanillaFurnaceMaterials() {
Iterator<Recipe> iter = Bukkit.recipeIterator();
while (iter.hasNext()) {
Recipe r = iter.next();
if (r instanceof FurnaceRecipe) {
Material mat = ((FurnaceRecipe) r).getInput().getType();
vanillaSmelts.add(mat);
recordReverseSmelt(r.getResult(), ((FurnaceRecipe) r).getInput());
}
}
}
示例13: fromBukkitRecipe
import org.bukkit.inventory.FurnaceRecipe; //导入依赖的package包/类
public static CraftFurnaceRecipe fromBukkitRecipe(FurnaceRecipe recipe) {
if (recipe instanceof CraftFurnaceRecipe) {
return (CraftFurnaceRecipe) recipe;
}
return new CraftFurnaceRecipe(recipe.getResult(), recipe.getInput());
}
示例14: enable
import org.bukkit.inventory.FurnaceRecipe; //导入依赖的package包/类
public void enable() {
log("FleshToLeather:");
plugin.getServer().addRecipe(new FurnaceRecipe(new ItemStack(Material.LEATHER), Material.ROTTEN_FLESH));
log("Enabled");
}
示例15: FurnaceRecipe
import org.bukkit.inventory.FurnaceRecipe; //导入依赖的package包/类
public FurnaceRecipe(ItemStack result, Material source) {
}