Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- private static ItemStack generatePotion(PotionType effect, int i) {
- ItemStack potion = new ItemStack(Material.POTION);
- PotionMeta pm = (PotionMeta) potion.getItemMeta();
- pm.setBasePotionData(new PotionData(effect, false, i == 2));
- potion.setItemMeta(pm);
- return potion;
- }
- /**
- *
- * @param frameType - тип рамки. {@link Material}.ITEM_FRAME или
- * {@link Material}.GLOW_ITEM_FRAME
- */
- @SuppressWarnings("unused")
- private void addInvisibleItemFrameRecipe(Material frameType) {
- ItemStack potion = generatePotion(PotionType.INVISIBILITY, 0);
- @SuppressWarnings("deprecation")
- MaterialData potionData = potion.getData();
- ItemStack itemFrame = new ItemStack(frameType);
- ItemMeta frameMeta = itemFrame.getItemMeta();
- frameMeta.setDisplayName(ChatColor.GOLD + "Невидимая рамка");
- List<String> lore = new ArrayList<>();
- lore.add(ChatColor.AQUA + "Mskatau няшка");
- frameMeta.setLore(lore);
- NamespacedKey IS_INVISIBLE_KEY = new NamespacedKey(this, "invisible");
- frameMeta.getPersistentDataContainer().set(IS_INVISIBLE_KEY, PersistentDataType.BYTE, (byte) 1);
- itemFrame.setItemMeta(frameMeta);
- itemFrame.setAmount(8);
- NamespacedKey frameKey = new NamespacedKey(this,
- frameType.equals(Material.ITEM_FRAME) ? "invisibleframe" : "invisibleglowframe");
- ShapedRecipe frameRecipe = new ShapedRecipe(frameKey, itemFrame);
- frameRecipe.shape("FFF", "FPF", "FFF");
- frameRecipe.setIngredient('F', frameType);
- frameRecipe.setIngredient('P', potionData);
- Bukkit.addRecipe(frameRecipe);
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement