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


Java ShapedRecipe类代码示例

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


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

示例1: RecipeManager

import org.bukkit.inventory.ShapedRecipe; //导入依赖的package包/类
public RecipeManager(SCG plugin ){
    this.plugin = plugin;
    ItemStack ender = new ItemStack(Material.ENDER_STONE);
    ShapedRecipe enderRecipe = new ShapedRecipe(ender);
    enderRecipe.shape("*S*","SPS","*S*");
    enderRecipe.setIngredient('*', Material.REDSTONE);
    enderRecipe.setIngredient('S', Material.STONE);
    enderRecipe.setIngredient('P', Material.PISTON_BASE);
    Bukkit.addRecipe(enderRecipe);

    ItemStack enderChest = new ItemStack(Material.ENDER_CHEST);
    ShapedRecipe enderChestRecipe = new ShapedRecipe(enderChest);
    enderChestRecipe.shape("***","*P*","***");
    enderChestRecipe.setIngredient('*', Material.OBSIDIAN);
    enderChestRecipe.setIngredient('P', Material.ENDER_PEARL);
    Bukkit.addRecipe(enderChestRecipe);

  //  ItemStack obsidian = new ItemStack(Material.OBSIDIAN);
  //  ShapedRecipe obsidianRecipe = new ShapedRecipe(obsidian);
   // obsidianRecipe.shape("***","***","***");
   // obsidianRecipe.setIngredient('*', Material.COBBLESTONE);
   // Bukkit.addRecipe(obsidianRecipe);
}
 
开发者ID:grzegorz2047,项目名称:SurvivalCG,代码行数:24,代码来源:RecipeManager.java

示例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.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;
}
 
开发者ID:UraniumMC,项目名称:Uranium,代码行数:17,代码来源:CraftShapedRecipe.java

示例3: onCraft

import org.bukkit.inventory.ShapedRecipe; //导入依赖的package包/类
@EventHandler
public void onCraft(CraftItemEvent e)
{
	Player p = (Player) e.getWhoClicked();
	if(e.getRecipe() instanceof ShapedRecipe)
	{
		ShapedRecipe sr = (ShapedRecipe) e.getRecipe();
		if(Bukkit.getBukkitVersion().contains("1.11"))
		{
			for(BagBase  bb : Util.getBags())
			{
				if(((ShapedRecipe)bb.getRecipe()).getShape().equals(sr.getShape()))
				{
					if(!hasPermission(new Permission("bag.craft." + bb.getName(), PermissionDefault.TRUE), p))
					e.setCancelled(true);					
				}
			}
		}
		else
		if(sr.getKey().getNamespace().startsWith("bag_"))
		{
			if(!hasPermission(new Permission("bag.craft." + sr.getKey().getKey(), PermissionDefault.TRUE), p))
			e.setCancelled(true);
		}
	}
}
 
开发者ID:benfah,项目名称:Bags2,代码行数:27,代码来源:CraftListener.java

示例4: 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;
}
 
开发者ID:MagicDroidX,项目名称:Brynhildr,代码行数:17,代码来源:CraftShapedRecipe.java

示例5: registerShapedRecipe

import org.bukkit.inventory.ShapedRecipe; //导入依赖的package包/类
/**
 * Shapes a recipe from an {@link EnhancedItem} {@link Recipe} and registers it
 * 
 * @param recipe The recipe to shape and register
 */
public static void registerShapedRecipe(Recipe recipe)
{
    String top = recipe.getTop();
    String mid = recipe.getMid();
    String bot = recipe.getBot();

    ItemStack itemStack = EnhancedItemUtil.createItem(recipe.getOutput(), null);

    ShapedRecipe shapedRecipe = new ShapedRecipe(itemStack);
    shapedRecipe.shape(top, mid, bot);
    shapedRecipe = recipe.shapeRecipe(shapedRecipe);
    
    EnhancedItems.getInstance().getServer().addRecipe(shapedRecipe);
    EnhancedItems.getInstance().addRecipe(recipe);
}
 
开发者ID:ItzDennisz,项目名称:Enhanced-Items,代码行数:21,代码来源:RecipeUtil.java

示例6: registerRecipes

import org.bukkit.inventory.ShapedRecipe; //导入依赖的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));
}
 
开发者ID:MCCarbon,项目名称:Carbon-2,代码行数:17,代码来源:Injector.java

示例7: updateGoldenHead

import org.bukkit.inventory.ShapedRecipe; //导入依赖的package包/类
public void updateGoldenHead() {
	if (gA.mC.cLa) {
		List<ShapedRecipe> a = new ArrayList<>();
		if (gA.mC.cLb) {
			if (!isRecipeEx(gG.get(0).getResult())) {
				gA.getServer().addRecipe(gG.get(0));
			}
		} else {
			a.add(gG.get(0));
		}
		if (gA.mC.cLc) {
			if (!isRecipeEx(gG.get(1).getResult())) {
				gA.getServer().addRecipe(gG.get(1));
			}
		} else {
			a.add(gG.get(1));
		}
		if (a.size() != 0) {
			removeGoldenHead(a);
		}
	} else {
		removeGoldenHead(gG);
	}
}
 
开发者ID:Thomaz2Fast,项目名称:Ultra-Hardcore-1.8,代码行数:25,代码来源:GameManager.java

示例8: getCraftingRecipes

import org.bukkit.inventory.ShapedRecipe; //导入依赖的package包/类
@Override
public Iterable<Recipe> getCraftingRecipes()
{
    ArrayList<Recipe> recipes = new ArrayList<>();
    
    ShapedRecipe baseRecipe = CraftingRecipes.shaped(makeItem(1), Material.STICK, Material.IRON_INGOT);
    
    recipes.add(CraftingRecipes.shaped(baseRecipe, "BBA", "   ", "   "));
    recipes.add(CraftingRecipes.shaped(baseRecipe, "   ", "BBA", "   "));
    recipes.add(CraftingRecipes.shaped(baseRecipe, "   ", "   ", "BBA"));
    recipes.add(CraftingRecipes.shaped(baseRecipe, "ABB", "   ", "   "));
    recipes.add(CraftingRecipes.shaped(baseRecipe, "   ", "ABB", "   "));
    recipes.add(CraftingRecipes.shaped(baseRecipe, "   ", "   ", "ABB"));
    
    return recipes;
}
 
开发者ID:zDevelopers,项目名称:BelovedBlocks,代码行数:17,代码来源:Saw.java

示例9: removeRecipes

import org.bukkit.inventory.ShapedRecipe; //导入依赖的package包/类
public static void removeRecipes(FileConfiguration cfg, HashMap<Integer, ConfigRemovedRecipes> removedRecipies){
	
	List<Map<?, ?>> configMaterials = cfg.getMapList("removed_recipes");
	for (Map<?, ?> b : configMaterials) {
		ConfigRemovedRecipes item = new ConfigRemovedRecipes();
		item.type_id = (Integer)b.get("type_id");
		item.data = (Integer)b.get("data");
	
		removedRecipies.put(item.type_id, item);
		
		Iterator<Recipe> it = Bukkit.getServer().recipeIterator();
		while (it.hasNext()) {
			Recipe recipe = it.next();
			
			if (recipe instanceof ShapedRecipe) {
				ShapedRecipe shapedRecipe = (ShapedRecipe)recipe;
				if (ItemManager.getId(shapedRecipe.getResult()) == item.type_id &&
						shapedRecipe.getResult().getDurability() == (short)item.data) {
					it.remove();
					break;
				}
			}
		}
	}
}
 
开发者ID:netizen539,项目名称:civcraft,代码行数:26,代码来源:ConfigRemovedRecipes.java

示例10: 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());
}
 
开发者ID:StarQuestMinecraft,项目名称:StarQuestCode,代码行数:20,代码来源:RecipeVerifier.java

示例11: addRecipes

import org.bukkit.inventory.ShapedRecipe; //导入依赖的package包/类
@SuppressWarnings("deprecation")
static void addRecipes() {
    /**Redstone Apple Recipe**/
    ShapedRecipe redstoneApple = new ShapedRecipe(redstoneApple());
    redstoneApple.shape("XXX",
            "XAX",
            "XXX");
    redstoneApple.setIngredient('X', Material.REDSTONE);
    redstoneApple.setIngredient('A', Material.APPLE);
    Bukkit.getServer().addRecipe(redstoneApple);

    /**Redstone Activator Recipe**/
    ShapedRecipe Activator = new ShapedRecipe(redstoneActivator());
    Activator.shape("XXX",
            "XXX",
            "XXX");
    Activator.setIngredient('X', Material.APPLE, (short) 1000);
    Bukkit.getServer().addRecipe(Activator);
}
 
开发者ID:waicool20,项目名称:CPU,代码行数:20,代码来源:CraftingAndRecipes.java

示例12: loadRecipes

import org.bukkit.inventory.ShapedRecipe; //导入依赖的package包/类
public void loadRecipes() {
	ItemStack stack = new ItemStack(Material.STONE, 1);
	ItemMeta meta = stack.getItemMeta();
	meta.setDisplayName("crate");
	stack.setItemMeta(meta);
	ShapedRecipe recipe1 = new ShapedRecipe(stack);
	recipe1.shape(new String[] {
			"AAA",
			"ABA",
			" A "
	});
	recipe1.setIngredient('A', Material.IRON_INGOT);
	recipe1.setIngredient('B', Material.GOLD_INGOT);
	
	ShapedRecipe recipe2 = new ShapedRecipe(stack);
	recipe2.shape(new String[] {
			"AAA",
			"ACA",
			" A "
	});
	recipe2.setIngredient('A', Material.IRON_INGOT);
	recipe2.setIngredient('C', Material.DIAMOND);
	
	Bukkit.addRecipe(recipe1);
	Bukkit.addRecipe(recipe2);
}
 
开发者ID:xize,项目名称:manco2,代码行数:27,代码来源:ManCo.java

示例13: enableCallback

import org.bukkit.inventory.ShapedRecipe; //导入依赖的package包/类
/**
 * Add our recipes
 */
@Override
protected void enableCallback()
{
    //Make a recipe that will return a golden carrot when the right shape is made
    ShapedRecipe newGoldenCarrot = new ShapedRecipe(new ItemStack(Material.GOLDEN_CARROT, 1));
    //8 gold ingots surrounding an apple
    newGoldenCarrot.shape("AAA", "ABA", "AAA");
    newGoldenCarrot.setIngredient('A', Material.GOLD_INGOT);
    newGoldenCarrot.setIngredient('B', Material.CARROT_ITEM);
    Bukkit.addRecipe(newGoldenCarrot);

    //Make the recipe for glistering melons minus a set shape (glistering melon is speckled melon in code
    ShapelessRecipe newGlisteringMelon = new ShapelessRecipe(new ItemStack(Material.SPECKLED_MELON, 1));
    //1 gold ingot with a melon
    newGlisteringMelon.addIngredient(Material.GOLD_BLOCK);
    newGlisteringMelon.addIngredient(Material.MELON);
    Bukkit.addRecipe(newGlisteringMelon);
}
 
开发者ID:Eluinhost,项目名称:ultrahardcore,代码行数:22,代码来源:RecipeFeature.java

示例14: getRecipe

import org.bukkit.inventory.ShapedRecipe; //导入依赖的package包/类
@Override
public Recipe getRecipe() {
    ShapedRecipe recipe = new ShapedRecipe(toItemStack());
    ToughMachineFrame mf = new ToughMachineFrame();
    IntegratedCircuit ic = new IntegratedCircuit();
    registerCustomIngredients(mf, ic);
    recipe.shape("OCO", "DFP", "RGR");
    recipe.setIngredient('O', Material.OBSIDIAN);
    recipe.setIngredient('C', ic.getMaterialData());
    recipe.setIngredient('D', Material.DISPENSER);
    recipe.setIngredient('F', mf.getMaterialData());
    recipe.setIngredient('P', Material.DIAMOND_PICKAXE);
    recipe.setIngredient('R', Material.REDSTONE);
    recipe.setIngredient('G', Material.GOLD_INGOT);
    return recipe;
}
 
开发者ID:desht,项目名称:sensibletoolbox,代码行数:17,代码来源:AutoBuilder.java

示例15: injectRecipes

import org.bukkit.inventory.ShapedRecipe; //导入依赖的package包/类
@SuppressWarnings("deprecation")
private static void injectRecipes()
{
	ShapedRecipe slimeBlock = new ShapedRecipe(new ItemStack(
			Material.getMaterial("slime"))).shape(
			new String[] { "###", "###", "###" }).setIngredient('#',
			Material.SLIME_BALL);
	Bukkit.getServer().addRecipe(slimeBlock);
	ShapelessRecipe deslimeBlock = new ShapelessRecipe(new ItemStack(
			Material.SLIME_BALL, 9));
	deslimeBlock.addIngredient(Material.getMaterial("slime"));
	Bukkit.getServer().addRecipe(deslimeBlock);

	ShapedRecipe redSandStone = new ShapedRecipe(new ItemStack(Material.getMaterial("red_sandstone")))
			.shape(new String[] { "   ", "## ", "## " }).setIngredient('#',
					Material.SAND, 1);
	Bukkit.getServer().addRecipe(redSandStone);
	
}
 
开发者ID:Vislo,项目名称:VisloBlock,代码行数:20,代码来源:InjectorManager.java


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