Search in sources :

Example 1 with LanternEnchantmentType

use of org.lanternpowered.server.item.enchantment.LanternEnchantmentType in project LanternServer by LanternPowered.

the class ItemStackStore method serializeEnchantments.

private void serializeEnchantments(DataView dataView, DataQuery query, List<Enchantment> enchantments) {
    if (enchantments.isEmpty()) {
        return;
    }
    final List<DataView> dataViews = new ArrayList<>();
    for (Enchantment enchantment : enchantments) {
        final DataView enchantmentView = DataContainer.createNew(DataView.SafetyMode.NO_DATA_CLONED);
        enchantmentView.set(ENCHANTMENT_ID, (short) ((LanternEnchantmentType) enchantment.getType()).getInternalId());
        enchantmentView.set(ENCHANTMENT_LEVEL, (short) enchantment.getLevel());
        dataViews.add(enchantmentView);
    }
    dataView.set(query, dataViews);
}
Also used : DataView(org.spongepowered.api.data.DataView) LanternEnchantmentType(org.lanternpowered.server.item.enchantment.LanternEnchantmentType) ArrayList(java.util.ArrayList) Enchantment(org.spongepowered.api.item.enchantment.Enchantment)

Example 2 with LanternEnchantmentType

use of org.lanternpowered.server.item.enchantment.LanternEnchantmentType in project LanternServer by LanternPowered.

the class EnchantmentTypeRegistryModule method registerDefaults.

@Override
public void registerDefaults() {
    register(new LanternEnchantmentType("minecraft", "protection", "enchantment.protect.all", 0));
    register(new LanternEnchantmentType("minecraft", "fire_protection", "enchantment.protect.fire", 1));
    register(new LanternEnchantmentType("minecraft", "feather_falling", "enchantment.protect.fall", 2));
    register(new LanternEnchantmentType("minecraft", "blast_protection", "enchantment.protect.explosion", 3));
    register(new LanternEnchantmentType("minecraft", "projectile_protection", "enchantment.protect.projectile", 4));
    register(new LanternEnchantmentType("minecraft", "respiration", "enchantment.oxygen", 5));
    register(new LanternEnchantmentType("minecraft", "aqua_affinity", "enchantment.waterWorker", 6));
    register(new LanternEnchantmentType("minecraft", "thorns", "enchantment.thorns", 7));
    register(new LanternEnchantmentType("minecraft", "depth_strider", "enchantment.waterWalker", 8));
    register(new LanternEnchantmentType("minecraft", "frost_walker", "enchantment.frostWalker", 9));
    register(new LanternEnchantmentType("minecraft", "sharpness", "enchantment.damage.all", 16));
    register(new LanternEnchantmentType("minecraft", "smite", "enchantment.damage.undead", 17));
    register(new LanternEnchantmentType("minecraft", "bane_of_arthropods", "enchantment.damage.arthropods", 18));
    register(new LanternEnchantmentType("minecraft", "knockback", "enchantment.knockback", 19));
    register(new LanternEnchantmentType("minecraft", "fire_aspect", "enchantment.fire", 20));
    register(new LanternEnchantmentType("minecraft", "looting", "enchantment.lootBonus", 21));
    register(new LanternEnchantmentType("minecraft", "sweeping", "enchantment.sweeping", 22));
    register(new LanternEnchantmentType("minecraft", "efficiency", "enchantment.digging", 32));
    register(new LanternEnchantmentType("minecraft", "silk_touch", "enchantment.untouching", 33));
    register(new LanternEnchantmentType("minecraft", "unbreaking", "enchantment.durability", 34));
    register(new LanternEnchantmentType("minecraft", "fortune", "enchantment.lootBonusDigger", 35));
    register(new LanternEnchantmentType("minecraft", "power", "enchantment.arrowDamage", 48));
    register(new LanternEnchantmentType("minecraft", "punch", "enchantment.arrowKnockback", 49));
    register(new LanternEnchantmentType("minecraft", "flame", "enchantment.arrowFire", 50));
    register(new LanternEnchantmentType("minecraft", "infinity", "enchantment.arrowInfinite", 51));
    register(new LanternEnchantmentType("minecraft", "luck_of_the_sea", "enchantment.lootBonusFishing", 61));
    register(new LanternEnchantmentType("minecraft", "lure", "enchantment.fishingSpeed", 62));
    register(new LanternEnchantmentType("minecraft", "mending", "enchantment.mending", 70));
    register(new LanternEnchantmentType("minecraft", "vanishing_curse", "enchantment.vanishing_curse", 71));
}
Also used : LanternEnchantmentType(org.lanternpowered.server.item.enchantment.LanternEnchantmentType)

Aggregations

LanternEnchantmentType (org.lanternpowered.server.item.enchantment.LanternEnchantmentType)2 ArrayList (java.util.ArrayList)1 DataView (org.spongepowered.api.data.DataView)1 Enchantment (org.spongepowered.api.item.enchantment.Enchantment)1