From 4862da11bef87a3166089f1fcb51b211e5514dba Mon Sep 17 00:00:00 2001 From: Vincent Lee Date: Fri, 17 Jul 2020 10:18:07 -0500 Subject: [PATCH] Replace IBurstViewerBauble with a tag --- .../data/botania/tags/items/burst_viewers.json | 6 ++++++ .../botania/api/item/IBurstViewerBauble.java | 18 ------------------ .../item/equipment/bauble/ItemMonocle.java | 8 ++++---- .../vazkii/botania/common/lib/ModTags.java | 2 ++ .../vazkii/botania/data/ItemTagProvider.java | 2 ++ 5 files changed, 14 insertions(+), 22 deletions(-) create mode 100644 src/generated/resources/data/botania/tags/items/burst_viewers.json delete mode 100644 src/main/java/vazkii/botania/api/item/IBurstViewerBauble.java diff --git a/src/generated/resources/data/botania/tags/items/burst_viewers.json b/src/generated/resources/data/botania/tags/items/burst_viewers.json new file mode 100644 index 000000000..bac06780d --- /dev/null +++ b/src/generated/resources/data/botania/tags/items/burst_viewers.json @@ -0,0 +1,6 @@ +{ + "replace": false, + "values": [ + "botania:monocle" + ] +} \ No newline at end of file diff --git a/src/main/java/vazkii/botania/api/item/IBurstViewerBauble.java b/src/main/java/vazkii/botania/api/item/IBurstViewerBauble.java deleted file mode 100644 index 0228a4cfc..000000000 --- a/src/main/java/vazkii/botania/api/item/IBurstViewerBauble.java +++ /dev/null @@ -1,18 +0,0 @@ -/* - * This class is distributed as part of the Botania Mod. - * Get the Source Code in github: - * https://github.com/Vazkii/Botania - * - * Botania is Open Source and distributed under the - * Botania License: http://botaniamod.net/license.php - */ -package vazkii.botania.api.item; - -/** - * Base Interface for the Manaseer Monocle and items of the sort. - * Having an accessory of this type equipped - * will draw bursts without depth testing and allow the player to see magical flower radiuses. - */ -public interface IBurstViewerBauble { - -} diff --git a/src/main/java/vazkii/botania/common/item/equipment/bauble/ItemMonocle.java b/src/main/java/vazkii/botania/common/item/equipment/bauble/ItemMonocle.java index ca43f1fcd..2992ad40d 100644 --- a/src/main/java/vazkii/botania/common/item/equipment/bauble/ItemMonocle.java +++ b/src/main/java/vazkii/botania/common/item/equipment/bauble/ItemMonocle.java @@ -34,12 +34,12 @@ import net.minecraft.util.text.TextFormatting; import net.minecraftforge.api.distmarker.Dist; import net.minecraftforge.api.distmarker.OnlyIn; -import vazkii.botania.api.item.IBurstViewerBauble; import vazkii.botania.api.item.ICosmeticAttachable; import vazkii.botania.api.item.ICosmeticBauble; import vazkii.botania.common.core.handler.EquipmentHandler; +import vazkii.botania.common.lib.ModTags; -public class ItemMonocle extends ItemBauble implements IBurstViewerBauble, ICosmeticBauble { +public class ItemMonocle extends ItemBauble implements ICosmeticBauble { public ItemMonocle(Properties props) { super(props); @@ -96,13 +96,13 @@ public class ItemMonocle extends ItemBauble implements IBurstViewerBauble, ICosm return !EquipmentHandler.findOrEmpty(stack -> { if (!stack.isEmpty()) { Item item = stack.getItem(); - if (item instanceof IBurstViewerBauble) { + if (item.isIn(ModTags.Items.BURST_VIEWERS)) { return true; } if (item instanceof ICosmeticAttachable) { ICosmeticAttachable attach = (ICosmeticAttachable) item; ItemStack cosmetic = attach.getCosmeticItem(stack); - return !cosmetic.isEmpty() && cosmetic.getItem() instanceof IBurstViewerBauble; + return !cosmetic.isEmpty() && cosmetic.getItem().isIn(ModTags.Items.BURST_VIEWERS); } } return false; diff --git a/src/main/java/vazkii/botania/common/lib/ModTags.java b/src/main/java/vazkii/botania/common/lib/ModTags.java index 9450d633b..2b5e4ea23 100644 --- a/src/main/java/vazkii/botania/common/lib/ModTags.java +++ b/src/main/java/vazkii/botania/common/lib/ModTags.java @@ -100,6 +100,8 @@ public class ModTags { public static final ITag.INamedTag RUNES_WINTER = tag("runes/winter"); public static final ITag.INamedTag RUNES_WRATH = tag("runes/wrath"); + public static final ITag.INamedTag BURST_VIEWERS = tag("burst_viewers"); + public static ITag.INamedTag getFlowerTag(DyeColor color) { switch (color) { default: diff --git a/src/main/java/vazkii/botania/data/ItemTagProvider.java b/src/main/java/vazkii/botania/data/ItemTagProvider.java index c58058d94..2fca8806f 100644 --- a/src/main/java/vazkii/botania/data/ItemTagProvider.java +++ b/src/main/java/vazkii/botania/data/ItemTagProvider.java @@ -54,6 +54,8 @@ public class ItemTagProvider extends ItemTagsProvider { this.func_240522_a_(ItemTags.TALL_FLOWERS).func_240531_a_(ModTags.Items.DOUBLE_MYSTICAL_FLOWERS); this.func_240522_a_(ItemTags.SMALL_FLOWERS).func_240531_a_(ModTags.Items.MYSTICAL_FLOWERS); this.func_240522_a_(ItemTags.FLOWERS).func_240531_a_(ModTags.Items.SPECIAL_FLOWERS); + + this.func_240522_a_(ModTags.Items.BURST_VIEWERS).func_240532_a_(ModItems.monocle); } @Nonnull