Skip to content
This repository has been archived by the owner on Apr 12, 2022. It is now read-only.

Commit

Permalink
add a tag way to remove all flags entirely
Browse files Browse the repository at this point in the history
  • Loading branch information
mcmonkey4eva committed May 30, 2018
1 parent 6a46f93 commit 9da5294
Showing 1 changed file with 8 additions and 5 deletions.
Expand Up @@ -345,11 +345,15 @@ public ItemScript getSourceScript() {
// @Updated 2017/02/13
// @Group General Information
// @ReturnType ItemTag
// @Returns a copy of the item, with the specified flags removed.
// @Returns a copy of the item, with the specified flags removed. Give no modifier to remove the flag mapping entirely.
// -->
handlers.put("without_flags", (dat, obj) -> {
ItemStack e = ((ItemTag) obj).internal.copy();
if (dat.hasNextModifier()) {
e.remove(FlagHelper.FLAGMAP);
return new ItemTag(e);
}
MapTag flags;
ItemStack e = ((ItemTag) obj).internal;
Optional<FlagMap> fm = e.get(FlagHelper.FLAGMAP);
if (fm.isPresent()) {
flags = new MapTag(fm.get().flags.getInternal());
Expand All @@ -361,9 +365,8 @@ public ItemScript getSourceScript() {
for (AbstractTagObject k : toRemove.getInternal()) {
flags.getInternal().remove(k.toString());
}
ItemStack its = ((ItemTag) obj).internal.copy();
its.offer(new FlagMapDataImpl(new FlagMap(flags)));
return new ItemTag(its);
e.offer(new FlagMapDataImpl(new FlagMap(flags)));
return new ItemTag(e);
});
}

Expand Down

0 comments on commit 9da5294

Please sign in to comment.