Search in sources :

Example 1 with ImmutableSpongeEnchantmentData

use of org.spongepowered.common.data.manipulator.immutable.item.ImmutableSpongeEnchantmentData in project SpongeCommon by SpongePowered.

the class ImmutableItemEnchantmentDataBuilder method buildContent.

@Override
protected Optional<ImmutableEnchantmentData> buildContent(DataView container) throws InvalidDataException {
    checkDataExists(container, Keys.ITEM_ENCHANTMENTS.getQuery());
    final List<Enchantment> enchantments = container.getSerializableList(Keys.ITEM_ENCHANTMENTS.getQuery(), Enchantment.class).get();
    return Optional.of(new ImmutableSpongeEnchantmentData(enchantments));
}
Also used : ImmutableSpongeEnchantmentData(org.spongepowered.common.data.manipulator.immutable.item.ImmutableSpongeEnchantmentData) Enchantment(org.spongepowered.api.item.enchantment.Enchantment)

Aggregations

Enchantment (org.spongepowered.api.item.enchantment.Enchantment)1 ImmutableSpongeEnchantmentData (org.spongepowered.common.data.manipulator.immutable.item.ImmutableSpongeEnchantmentData)1