本文整理汇总了Java中org.bukkit.inventory.ShapelessRecipe.addIngredient方法的典型用法代码示例。如果您正苦于以下问题:Java ShapelessRecipe.addIngredient方法的具体用法?Java ShapelessRecipe.addIngredient怎么用?Java ShapelessRecipe.addIngredient使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.bukkit.inventory.ShapelessRecipe
的用法示例。
在下文中一共展示了ShapelessRecipe.addIngredient方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: parseShapelessRecipe
import org.bukkit.inventory.ShapelessRecipe; //导入方法依赖的package包/类
public Recipe parseShapelessRecipe(MapModuleContext context, Element elRecipe) throws InvalidXMLException {
ShapelessRecipe recipe = new ShapelessRecipe(parseRecipeResult(context, elRecipe));
for(Element elIngredient : XMLUtils.getChildren(elRecipe, "ingredient", "i")) {
MaterialPattern item = XMLUtils.parseMaterialPattern(elIngredient);
int count = XMLUtils.parseNumber(elIngredient.getAttribute("amount"), Integer.class, 1);
if(item.dataMatters()) {
recipe.addIngredient(count, item.getMaterialData());
} else {
recipe.addIngredient(count, item.getMaterial());
}
}
if(recipe.getIngredientList().isEmpty()) {
throw new InvalidXMLException("Crafting recipe must have at least one ingredient", elRecipe);
}
return recipe;
}
示例2: UpgradeItem
import org.bukkit.inventory.ShapelessRecipe; //导入方法依赖的package包/类
public UpgradeItem(SQTechDrill plugin)
{
this.main = plugin;
upgradeItem = new ItemStack(Material.WRITTEN_BOOK);
BookMeta bookMeta = (BookMeta) upgradeItem.getItemMeta();
//bookMeta.setDisplayName(ChatColor.BLUE + "" + ChatColor.ITALIC + "Drill Upgrade");
bookMeta.setAuthor(ChatColor.AQUA + "Drill");
bookMeta.setPages("Test pgae 1\n s","asgsgge 2");
bookMeta.setGeneration(BookMeta.Generation.ORIGINAL);
bookMeta.setTitle(ChatColor.BLUE + "" + ChatColor.ITALIC + "Drill Upgrade");
upgradeItem.setItemMeta(bookMeta);
ShapelessRecipe recipe = new ShapelessRecipe(upgradeItem);
//TODO temp recipe
recipe.addIngredient(Material.DIRT); //Adds the specified ingredient.
main.getServer().addRecipe(recipe);
}
示例3: onEnable
import org.bukkit.inventory.ShapelessRecipe; //导入方法依赖的package包/类
@Override
public void onEnable() {
ConfigurationSerialization.registerClass(CustomItemStackImpl.class);
ConfigurationSerialization.registerClass(CustomMaterialImpl.class);
recipeManager = new RecipeManager(this);
recipeManager.setupRecipes();
saveResource("music/canon.mid", false);
jingleNoteManager = new JingleNoteManager();
registerListeners(new EntityShootBowListener(this), new PlayerQuitListener(this));
Map<Character, ItemStack> harpIngredients = new HashMap<>();
harpIngredients.put('s', new ItemStack(Material.STRING));
harpIngredients.put('S', new ItemStack(Material.STICK));
CustomMaterial harp = new CustomMaterialImpl("Harp", Material.BOW, new String[] {"ssS", "ssS", "ssS"}, harpIngredients);
addMaterial(harp);
Map<Character, ItemStack> bandageIngredients = new HashMap<>();
bandageIngredients.put('w', new ItemStack(Material.WOOL, 1));
CustomMaterial bandage = new CustomMaterialImpl("Bandage", Material.PAPER, new String[] {"www"}, bandageIngredients);
addMaterial(bandage);
ShapelessRecipe bandageRecipe = new ShapelessRecipe(new CustomItemStackImpl(bandage, 3).toMinecraftItemStack());
bandageRecipe.addIngredient(Material.LEATHER_CHESTPLATE);
getServer().addRecipe(bandageRecipe);
}
示例4: injectRecipes
import org.bukkit.inventory.ShapelessRecipe; //导入方法依赖的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);
}
示例5: getRecipe
import org.bukkit.inventory.ShapelessRecipe; //导入方法依赖的package包/类
@Override
public Recipe getRecipe() {
ShapelessRecipe recipe = new ShapelessRecipe(toItemStack(1));
InfernalDust dust1 = new InfernalDust();
GoldDust dust2 = new GoldDust();
registerCustomIngredients(dust1, dust2);
recipe.addIngredient(dust1.getMaterialData());
recipe.addIngredient(dust2.getMaterialData());
return recipe;
}
示例6: addAllRecipes
import org.bukkit.inventory.ShapelessRecipe; //导入方法依赖的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);
}
}
示例7: getRecipe
import org.bukkit.inventory.ShapelessRecipe; //导入方法依赖的package包/类
@Override
public Recipe getRecipe() {
ShapelessRecipe recipe = new ShapelessRecipe(toItemStack(2));
UnlinkedSCURelay usr = new UnlinkedSCURelay();
registerCustomIngredients(usr);
recipe.addIngredient(usr.getMaterialData());
recipe.addIngredient(usr.getMaterialData());
return recipe;
}
示例8: getRecipe
import org.bukkit.inventory.ShapelessRecipe; //导入方法依赖的package包/类
@Override
public Recipe getRecipe() {
BlankModule bm = new BlankModule();
registerCustomIngredients(bm);
ShapelessRecipe recipe = new ShapelessRecipe(toItemStack());
recipe.addIngredient(bm.getMaterialData());
recipe.addIngredient(Material.PISTON_STICKY_BASE);
recipe.addIngredient(Material.ARROW);
return recipe;
}
示例9: getRecipe
import org.bukkit.inventory.ShapelessRecipe; //导入方法依赖的package包/类
@Override
public Recipe getRecipe() {
Dye greenDye = new Dye();
greenDye.setColor(DyeColor.GREEN);
ShapelessRecipe recipe = new ShapelessRecipe(toItemStack(2));
recipe.addIngredient(Material.STONE_PLATE);
recipe.addIngredient(greenDye);
return recipe;
}
示例10: getRecipe
import org.bukkit.inventory.ShapelessRecipe; //导入方法依赖的package包/类
@Override
public Recipe getRecipe() {
BlankModule bm = new BlankModule();
registerCustomIngredients(bm);
ShapelessRecipe recipe = new ShapelessRecipe(toItemStack());
recipe.addIngredient(bm.getMaterialData());
recipe.addIngredient(Material.PISTON_STICKY_BASE);
return recipe;
}
示例11: getRecipe
import org.bukkit.inventory.ShapelessRecipe; //导入方法依赖的package包/类
@Override
public Recipe getRecipe() {
registerCustomIngredients(new BlankModule());
ShapelessRecipe recipe = new ShapelessRecipe(toItemStack());
recipe.addIngredient(Material.PAPER);
recipe.addIngredient(Material.SPIDER_EYE);
recipe.addIngredient(Material.ARROW);
return recipe;
}
示例12: getRecipe
import org.bukkit.inventory.ShapelessRecipe; //导入方法依赖的package包/类
@Override
public Recipe getRecipe() {
ShapelessRecipe recipe = new ShapelessRecipe(toItemStack());
RecipeBook book = new RecipeBook();
registerCustomIngredients(book);
recipe.addIngredient(Material.DIAMOND);
recipe.addIngredient(book.getMaterialData());
return recipe;
}
示例13: getRecipe
import org.bukkit.inventory.ShapelessRecipe; //导入方法依赖的package包/类
@Override
public Recipe getRecipe() {
SenderModule sm = new SenderModule();
SubspaceTransponder st = new SubspaceTransponder();
registerCustomIngredients(sm, st);
ShapelessRecipe recipe = new ShapelessRecipe(toItemStack());
recipe.addIngredient(sm.getMaterialData());
recipe.addIngredient(st.getMaterialData());
return recipe;
}
示例14: getRecipe
import org.bukkit.inventory.ShapelessRecipe; //导入方法依赖的package包/类
@Override
public Recipe getRecipe() {
BlankModule bm = new BlankModule();
registerCustomIngredients(bm);
ShapelessRecipe recipe = new ShapelessRecipe(toItemStack());
recipe.addIngredient(bm.getMaterialData());
recipe.addIngredient(Material.DROPPER);
return recipe;
}
示例15: getRecipe
import org.bukkit.inventory.ShapelessRecipe; //导入方法依赖的package包/类
@Override
public Recipe getRecipe() {
ShapelessRecipe recipe = new ShapelessRecipe(toItemStack(1));
InfernalDust dust1 = new InfernalDust();
IronDust dust2 = new IronDust();
registerCustomIngredients(dust1, dust2);
recipe.addIngredient(dust1.getMaterialData());
recipe.addIngredient(dust2.getMaterialData());
return recipe;
}