use of org.bukkit.craftbukkit.v1_18_R2.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());
}
use of org.bukkit.craftbukkit.v1_18_R2.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());
}
use of org.bukkit.craftbukkit.v1_18_R2.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);
}
}
use of org.bukkit.craftbukkit.v1_18_R2.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);
}
}
use of org.bukkit.craftbukkit.v1_18_R2.persistence.CraftPersistentDataContainer in project LoliServer by Loli-Server.
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());
}
Aggregations