use of com.magmaguy.elitemobs.items.EliteItemLore in project EliteMobs by MagmaGuy.
the class UnbindEnchantment method unbindItem.
public static ItemStack unbindItem(ItemStack itemStack) {
ItemStack newItemStack = itemStack.clone();
ItemMeta itemMeta = newItemStack.getItemMeta();
itemMeta.getPersistentDataContainer().remove(SoulbindEnchantment.SOULBIND_KEY);
itemMeta.getPersistentDataContainer().remove(SoulbindEnchantment.PRESTIGE_KEY);
newItemStack.setItemMeta(itemMeta);
new EliteItemLore(newItemStack, false);
return newItemStack;
}
use of com.magmaguy.elitemobs.items.EliteItemLore in project EliteMobs by MagmaGuy.
the class SimLootCommand method run.
public static void run(Player player, int level) {
try {
ItemStack itemStack = LootTables.generateLoot(level, player.getLocation(), player);
if (itemStack == null)
player.sendMessage(ChatColorConverter.convert(ItemSettingsConfig.getSimlootMessageFailure()));
else {
EliteItemLore eliteItemLore = new EliteItemLore(itemStack, false);
player.sendMessage(ChatColorConverter.convert(ItemSettingsConfig.getSimlootMessageSuccess().replace("$itemName", eliteItemLore.getItemStack().getItemMeta().getDisplayName())));
}
} catch (Exception ex) {
player.sendMessage(ChatColorConverter.convert(ItemSettingsConfig.getSimlootMessageFailure()));
}
}
use of com.magmaguy.elitemobs.items.EliteItemLore in project EliteMobs by MagmaGuy.
the class CustomShopMenu method shopContents.
/**
* Fills with the items to be sold in the shop
*
* @param shopInventory Inventory to be filled
*/
private static void shopContents(Inventory shopInventory, Player player) {
// Anything after 8 is populated
Random random = new Random();
for (int i : CustomShopMenuConfig.storeSlots) {
int itemEntryIndex = random.nextInt(CustomItem.getCustomItemStackShopList().size());
ItemStack itemStack = CustomItem.getCustomItemStackShopList().get(itemEntryIndex).clone();
SoulbindEnchantment.addEnchantment(itemStack, player);
new EliteItemLore(itemStack, true);
shopInventory.setItem(i, itemStack);
}
}
use of com.magmaguy.elitemobs.items.EliteItemLore in project EliteMobs by MagmaGuy.
the class ItemConstructor method commonFeatures.
private static ItemStack commonFeatures(ItemStack itemStack, EliteEntity eliteEntity, Player player, HashMap<Enchantment, Integer> enchantments, HashMap<String, Integer> customEnchantments, boolean showItemWorth) {
ItemMeta itemMeta = itemStack.getItemMeta();
// hide default lore
itemMeta.addItemFlags(ItemFlag.HIDE_ENCHANTS);
/*
Register elite item
*/
ItemTagger.registerEliteItem(itemMeta);
/*
Register item source for lore redraw
*/
ItemTagger.registerItemSource(eliteEntity, itemMeta);
// Tag the item
ItemTagger.registerEnchantments(itemMeta, enchantments);
ItemTagger.registerCustomEnchantments(itemMeta, customEnchantments);
itemStack.setItemMeta(itemMeta);
/*
Add soulbind if applicable
*/
SoulbindEnchantment.addEnchantment(itemStack, player);
/*
Update lore
*/
new EliteItemLore(itemStack, showItemWorth);
return itemStack;
}
Aggregations