Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import org.bukkit.Material;
- import org.bukkit.inventory.ItemStack;
- import org.bukkit.inventory.ShapelessRecipe;
- import org.ourcraft.daskrr.smp.inventory.items.handler.ItemModifier.MArmor;
- import org.ourcraft.daskrr.smp.inventory.items.handler.ItemModifier.MWeapon;
- public class CustomShapelessRecipe extends CustomRecipe
- {
- public CustomShapelessRecipe(ItemStack result)
- {
- super (result);
- this.recipe = new ShapelessRecipe(key(), result);
- }
- public CustomShapelessRecipe(ShapelessRecipe recipe)
- {
- super (recipe.getResult());
- this.recipe = recipe;
- for (ItemStack is : recipe.getIngredientList())
- {
- if (is == null)
- continue;
- ItemStack ingredientFinal = new ItemStack(is);
- if (!is.hasItemMeta())
- if (MWeapon.contains(is.getType().toString()))
- ingredientFinal = MWeapon.convertDefaultItem(new ItemStack(is));
- else if (MArmor.contains(is.getType().toString()))
- ingredientFinal = MArmor.convertDefaultItem(new ItemStack(is));
- this.ingredients.add(ingredientFinal);
- }
- }
- public void addIngredient(Material ingredient)
- {
- ItemStack ingredientFinal;
- if (MWeapon.contains(ingredient.toString()))
- ingredientFinal = MWeapon.convertDefaultItem(new ItemStack(ingredient));
- else if (MArmor.contains(ingredient.toString()))
- ingredientFinal = MArmor.convertDefaultItem(new ItemStack(ingredient));
- else
- ingredientFinal = new ItemStack(ingredient);
- this.ingredients.add(new ItemStack(ingredientFinal));
- ((ShapelessRecipe) recipe).addIngredient(ingredient);
- }
- public void addIngredient(ItemStack it)
- {
- this.ingredients.add(it);
- ((ShapelessRecipe) recipe).addIngredient(it.getType());
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement