Search in sources :

Example 1 with CraftPersistentDataContainer

use of org.bukkit.craftbukkit.v1_16_R3.persistence.CraftPersistentDataContainer in project Mohist by MohistMC.

the class DeprecatedContainerTagType method toPrimitive.

@Override
public PersistentDataContainer toPrimitive(Z complex, PersistentDataAdapterContext context) {
    CustomItemTagContainer deprecated = this.deprecated.toPrimitive(complex, new DeprecatedItemAdapterContext(context));
    Validate.isInstanceOf(DeprecatedCustomTagContainer.class, deprecated, "Could not wrap deprecated API due to foreign CustomItemTagContainer implementation %s", deprecated.getClass().getSimpleName());
    DeprecatedCustomTagContainer tagContainer = (DeprecatedCustomTagContainer) deprecated;
    PersistentDataContainer wrapped = tagContainer.getWrapped();
    Validate.isInstanceOf(CraftPersistentDataContainer.class, wrapped, "Could not wrap deprecated API due to wrong deprecation wrapper %s", deprecated.getClass().getSimpleName());
    CraftPersistentDataContainer craftTagContainer = (CraftPersistentDataContainer) wrapped;
    return new CraftPersistentDataContainer(craftTagContainer.getRaw(), craftTagContainer.getDataTagTypeRegistry());
}
Also used : CraftPersistentDataContainer(org.bukkit.craftbukkit.v1_18_R2.persistence.CraftPersistentDataContainer) CustomItemTagContainer(org.bukkit.inventory.meta.tags.CustomItemTagContainer) PersistentDataContainer(org.bukkit.persistence.PersistentDataContainer) CraftPersistentDataContainer(org.bukkit.craftbukkit.v1_18_R2.persistence.CraftPersistentDataContainer)

Example 2 with CraftPersistentDataContainer

use of org.bukkit.craftbukkit.v1_16_R3.persistence.CraftPersistentDataContainer in project Magma-1.16.x by magmafoundation.

the class DeprecatedContainerTagType method toPrimitive.

@Override
public PersistentDataContainer toPrimitive(Z complex, PersistentDataAdapterContext context) {
    CustomItemTagContainer deprecated = this.deprecated.toPrimitive(complex, new DeprecatedItemAdapterContext(context));
    Validate.isInstanceOf(DeprecatedCustomTagContainer.class, deprecated, "Could not wrap deprecated API due to foreign CustomItemTagContainer implementation %s", deprecated.getClass().getSimpleName());
    DeprecatedCustomTagContainer tagContainer = (DeprecatedCustomTagContainer) deprecated;
    PersistentDataContainer wrapped = tagContainer.getWrapped();
    Validate.isInstanceOf(CraftPersistentDataContainer.class, wrapped, "Could not wrap deprecated API due to wrong deprecation wrapper %s", deprecated.getClass().getSimpleName());
    CraftPersistentDataContainer craftTagContainer = (CraftPersistentDataContainer) wrapped;
    return new CraftPersistentDataContainer(craftTagContainer.getRaw(), craftTagContainer.getDataTagTypeRegistry());
}
Also used : CraftPersistentDataContainer(org.bukkit.craftbukkit.v1_16_R3.persistence.CraftPersistentDataContainer) CustomItemTagContainer(org.bukkit.inventory.meta.tags.CustomItemTagContainer) PersistentDataContainer(org.bukkit.persistence.PersistentDataContainer) CraftPersistentDataContainer(org.bukkit.craftbukkit.v1_16_R3.persistence.CraftPersistentDataContainer)

Example 3 with CraftPersistentDataContainer

use of org.bukkit.craftbukkit.v1_16_R3.persistence.CraftPersistentDataContainer in project Mohist by MohistMC.

the class CraftMetaItem method clone.

@Overridden
@Override
public CraftMetaItem clone() {
    try {
        CraftMetaItem clone = (CraftMetaItem) super.clone();
        if (this.lore != null) {
            clone.lore = new ArrayList<String>(this.lore);
        }
        clone.customModelData = this.customModelData;
        clone.blockData = this.blockData;
        if (this.enchantments != null) {
            clone.enchantments = new LinkedHashMap<Enchantment, Integer>(this.enchantments);
        }
        if (this.hasAttributeModifiers()) {
            clone.attributeModifiers = LinkedHashMultimap.create(this.attributeModifiers);
        }
        clone.persistentDataContainer = new CraftPersistentDataContainer(this.persistentDataContainer.getRaw(), DATA_TYPE_REGISTRY);
        clone.hideFlag = this.hideFlag;
        clone.unbreakable = this.unbreakable;
        clone.damage = this.damage;
        clone.version = this.version;
        return clone;
    } catch (CloneNotSupportedException e) {
        throw new Error(e);
    }
}
Also used : CraftPersistentDataContainer(org.bukkit.craftbukkit.v1_18_R2.persistence.CraftPersistentDataContainer) Enchantment(org.bukkit.enchantments.Enchantment) Overridden(org.bukkit.craftbukkit.v1_18_R2.Overridden)

Example 4 with CraftPersistentDataContainer

use of org.bukkit.craftbukkit.v1_16_R3.persistence.CraftPersistentDataContainer in project Magma-1.16.x by magmafoundation.

the class CraftMetaItem method clone.

@Overridden
@Override
public CraftMetaItem clone() {
    try {
        CraftMetaItem clone = (CraftMetaItem) super.clone();
        if (this.lore != null) {
            clone.lore = new ArrayList<String>(this.lore);
        }
        clone.customModelData = this.customModelData;
        clone.blockData = this.blockData;
        if (this.enchantments != null) {
            clone.enchantments = new LinkedHashMap<Enchantment, Integer>(this.enchantments);
        }
        if (this.hasAttributeModifiers()) {
            clone.attributeModifiers = LinkedHashMultimap.create(this.attributeModifiers);
        }
        clone.persistentDataContainer = new CraftPersistentDataContainer(this.persistentDataContainer.getRaw(), DATA_TYPE_REGISTRY);
        clone.hideFlag = this.hideFlag;
        clone.unbreakable = this.unbreakable;
        clone.damage = this.damage;
        clone.version = this.version;
        return clone;
    } catch (CloneNotSupportedException e) {
        throw new Error(e);
    }
}
Also used : CraftPersistentDataContainer(org.bukkit.craftbukkit.v1_16_R3.persistence.CraftPersistentDataContainer) Enchantment(org.bukkit.enchantments.Enchantment) Overridden(org.bukkit.craftbukkit.v1_16_R3.Overridden)

Example 5 with CraftPersistentDataContainer

use of org.bukkit.craftbukkit.v1_16_R3.persistence.CraftPersistentDataContainer in project LoliServer by Loli-Server.

the class CraftMetaItem method clone.

@Overridden
@Override
public CraftMetaItem clone() {
    try {
        CraftMetaItem clone = (CraftMetaItem) super.clone();
        if (this.lore != null) {
            clone.lore = new ArrayList<String>(this.lore);
        }
        clone.customModelData = this.customModelData;
        clone.blockData = this.blockData;
        if (this.enchantments != null) {
            clone.enchantments = new LinkedHashMap<Enchantment, Integer>(this.enchantments);
        }
        if (this.hasAttributeModifiers()) {
            clone.attributeModifiers = LinkedHashMultimap.create(this.attributeModifiers);
        }
        clone.persistentDataContainer = new CraftPersistentDataContainer(this.persistentDataContainer.getRaw(), DATA_TYPE_REGISTRY);
        clone.hideFlag = this.hideFlag;
        clone.unbreakable = this.unbreakable;
        clone.damage = this.damage;
        clone.version = this.version;
        return clone;
    } catch (CloneNotSupportedException e) {
        throw new Error(e);
    }
}
Also used : CraftPersistentDataContainer(org.bukkit.craftbukkit.v1_16_R3.persistence.CraftPersistentDataContainer) Enchantment(org.bukkit.enchantments.Enchantment) Overridden(org.bukkit.craftbukkit.v1_16_R3.Overridden)

Aggregations

CraftPersistentDataContainer (org.bukkit.craftbukkit.v1_16_R3.persistence.CraftPersistentDataContainer)4 Enchantment (org.bukkit.enchantments.Enchantment)3 CustomItemTagContainer (org.bukkit.inventory.meta.tags.CustomItemTagContainer)3 PersistentDataContainer (org.bukkit.persistence.PersistentDataContainer)3 Overridden (org.bukkit.craftbukkit.v1_16_R3.Overridden)2 CraftPersistentDataContainer (org.bukkit.craftbukkit.v1_18_R2.persistence.CraftPersistentDataContainer)2 Overridden (org.bukkit.craftbukkit.v1_18_R2.Overridden)1