Skip to content

Commit

Permalink
re-add item.nbt meta with a deprecation notice
Browse files Browse the repository at this point in the history
  • Loading branch information
mcmonkey4eva committed Dec 6, 2020
1 parent a9f9d46 commit 5f254ac
Showing 1 changed file with 40 additions and 0 deletions.
Expand Up @@ -52,6 +52,15 @@ public ObjectTag getObjectAttribute(Attribute attribute) {
return null;
}

// <--[tag]
// @attribute <ItemTag.has_nbt[<key>]>
// @returns ElementTag(Boolean)
// @mechanism ItemTag.nbt
// @group properties
// @Deprecated Use has_flag[...] instead.
// @description
// Deprecated: use <@link tag FlaggableObject.has_flag> instead.
// -->
if (attribute.startsWith("has_nbt")) {
Deprecations.itemNbt.warn(attribute.context);
return new ElementTag(CustomNBT.hasCustomNBT(item.getItemStack(), attribute.getContext(1), CustomNBT.KEY_DENIZEN))
Expand All @@ -64,6 +73,15 @@ public ObjectTag getObjectAttribute(Attribute attribute) {
.getObjectAttribute(attribute.fulfill(1));
}

// <--[tag]
// @attribute <ItemTag.nbt[<key>]>
// @returns ElementTag
// @mechanism ItemTag.nbt
// @group properties
// @Deprecated Use flag[...] instead.
// @description
// Deprecated: use <@link tag FlaggableObject.flag> instead.
// -->
if (attribute.matches("nbt")) {
Deprecations.itemNbt.warn(attribute.context);
if (!attribute.hasContext(1)) {
Expand Down Expand Up @@ -114,6 +132,17 @@ public String getPropertyId() {
@Override
public void adjust(Mechanism mechanism) {

// <--[mechanism]
// @object ItemTag
// @name remove_nbt
// @input ListTag
// @Deprecated Use 'flag' instead.
// @description
// Deprecated: use <@link mechanism ItemTag.flag> instead.
// @tags
// <ItemTag.nbt>
// <ItemTag.has_nbt>
// -->
if (mechanism.matches("remove_nbt")) {
Deprecations.itemNbt.warn(mechanism.context);
if (item.getMaterial().getMaterial() == Material.AIR) {
Expand All @@ -134,6 +163,17 @@ public void adjust(Mechanism mechanism) {
item.setItemStack(itemStack);
}

// <--[mechanism]
// @object ItemTag
// @name nbt
// @input ListTag
// @Deprecated Use 'flag' instead.
// @description
// Deprecated: use <@link mechanism ItemTag.flag> instead.
// @tags
// <ItemTag.nbt>
// <ItemTag.has_nbt>
// -->
if (mechanism.matches("nbt")) {
Deprecations.itemNbt.warn(mechanism.context);
if (item.getMaterial().getMaterial() == Material.AIR) {
Expand Down

0 comments on commit 5f254ac

Please sign in to comment.