diff --git a/src/main/java/ca/landonjw/gooeylibs2/api/button/EnumFlag.java b/src/main/java/ca/landonjw/gooeylibs2/api/button/EnumFlag.java deleted file mode 100644 index 3cbf8e9..0000000 --- a/src/main/java/ca/landonjw/gooeylibs2/api/button/EnumFlag.java +++ /dev/null @@ -1,27 +0,0 @@ -package ca.landonjw.gooeylibs2.api.button; - -public enum EnumFlag { - /** - ENCHANTS only hides tool enchants, as book ones are classified as stored enchantments. - EXTRAS hides multiple things, according to the minecraft wiki (https://minecraft.fandom.com/wiki/Tutorials/Command_NBT_tags) - */ - PIXELMON(0), - ENCHANTS(1), - ATTRIBUTE_MODIFIERS(2), - UNBREAKABLE(4), - CAN_DESTROY(8), - CAN_PLACE_ON(16), - EXTRAS(32), - LEATHER_DYED(64), - ALL(127); - - private final int value; - - EnumFlag(int value) { - this.value = value; - } - - public int getValue() { - return this.value; - } -} diff --git a/src/main/java/ca/landonjw/gooeylibs2/api/button/FlagType.java b/src/main/java/ca/landonjw/gooeylibs2/api/button/FlagType.java new file mode 100644 index 0000000..d201396 --- /dev/null +++ b/src/main/java/ca/landonjw/gooeylibs2/api/button/FlagType.java @@ -0,0 +1,31 @@ +package ca.landonjw.gooeylibs2.api.button; + +public enum FlagType +{ + /** + * ENCHANTS only hides tool enchants, as book ones are classified as stored enchantments. + * EXTRAS hides multiple things, according to the minecraft wiki (https://minecraft.fandom.com/wiki/Tutorials/Command_NBT_tags) + */ + Reforged(0), + Generations(0), + Enchantments(1), + Attribute_Modifiers(2), + Unbreakable(4), + Can_Destroy(8), + Can_Place_On(16), + Extras(32), + Dyed_Leather(64), + All(127); + + private final int value; + + FlagType(int value) + { + this.value = value; + } + + public int getValue() + { + return this.value; + } +} diff --git a/src/main/java/ca/landonjw/gooeylibs2/api/button/GooeyButton.java b/src/main/java/ca/landonjw/gooeylibs2/api/button/GooeyButton.java index 60cb4ed..920d155 100644 --- a/src/main/java/ca/landonjw/gooeylibs2/api/button/GooeyButton.java +++ b/src/main/java/ca/landonjw/gooeylibs2/api/button/GooeyButton.java @@ -49,7 +49,7 @@ public static class Builder { protected String title; protected Collection lore = Lists.newArrayList(); protected Consumer onClick; - protected List hideFlags = new ArrayList<>(); + protected List hideFlags = new ArrayList<>(); public Builder display(@Nonnull ItemStack display) { this.display = display.copy(); @@ -66,7 +66,8 @@ public Builder lore(@Nullable Collection lore) { return this; } - public Builder hideFlags(EnumFlag... flags) { + public Builder hideFlags(FlagType... flags) + { this.hideFlags = Arrays.asList(flags); return this; } @@ -103,12 +104,19 @@ protected ItemStack buildDisplay() { } display.getOrCreateSubCompound("display").setTag("Lore", nbtLore); } - if (!this.hideFlags.isEmpty() && display.hasTagCompound()) { - if (this.hideFlags.contains(EnumFlag.PIXELMON) || this.hideFlags.contains(EnumFlag.ALL)) { + if (!this.hideFlags.isEmpty() && display.hasTagCompound()) + { + if (this.hideFlags.contains(FlagType.Reforged) || this.hideFlags.contains(FlagType.All)) + { display.getTagCompound().setString("tooltip", ""); } + if (this.hideFlags.contains(FlagType.Generations) || this.hideFlags.contains(FlagType.All)) + { + display.getTagCompound().setBoolean("HideTooltip", true); + } int value = 0; - for (EnumFlag flag : this.hideFlags) { + for (FlagType flag : this.hideFlags) + { value += flag.getValue(); } display.getTagCompound().setInteger("HideFlags", value); diff --git a/src/main/java/ca/landonjw/gooeylibs2/api/button/linked/LinkedPageButton.java b/src/main/java/ca/landonjw/gooeylibs2/api/button/linked/LinkedPageButton.java index f7443fc..cb468b7 100644 --- a/src/main/java/ca/landonjw/gooeylibs2/api/button/linked/LinkedPageButton.java +++ b/src/main/java/ca/landonjw/gooeylibs2/api/button/linked/LinkedPageButton.java @@ -2,7 +2,7 @@ import ca.landonjw.gooeylibs2.api.UIManager; import ca.landonjw.gooeylibs2.api.button.ButtonAction; -import ca.landonjw.gooeylibs2.api.button.EnumFlag; +import ca.landonjw.gooeylibs2.api.button.FlagType; import ca.landonjw.gooeylibs2.api.button.GooeyButton; import ca.landonjw.gooeylibs2.api.page.LinkedPage; import ca.landonjw.gooeylibs2.api.page.Page; @@ -67,7 +67,8 @@ public Builder lore(@Nullable Collection lore) { } @Override - public Builder hideFlags(EnumFlag... flags) { + public Builder hideFlags(FlagType... flags) + { super.hideFlags(flags); return this; } diff --git a/src/main/java/ca/landonjw/gooeylibs2/api/button/moveable/MovableButton.java b/src/main/java/ca/landonjw/gooeylibs2/api/button/moveable/MovableButton.java index bfe7f98..a11ae29 100644 --- a/src/main/java/ca/landonjw/gooeylibs2/api/button/moveable/MovableButton.java +++ b/src/main/java/ca/landonjw/gooeylibs2/api/button/moveable/MovableButton.java @@ -1,7 +1,7 @@ package ca.landonjw.gooeylibs2.api.button.moveable; import ca.landonjw.gooeylibs2.api.button.ButtonAction; -import ca.landonjw.gooeylibs2.api.button.EnumFlag; +import ca.landonjw.gooeylibs2.api.button.FlagType; import ca.landonjw.gooeylibs2.api.button.GooeyButton; import net.minecraft.item.ItemStack; @@ -60,7 +60,8 @@ public Builder lore(@Nullable Collection lore) { return this; } - public Builder hideFlags(EnumFlag... flags) { + public Builder hideFlags(FlagType... flags) + { super.hideFlags(flags); return this; }