From 09d167765dc5883a4e0d49824a9cab8ee640a2b5 Mon Sep 17 00:00:00 2001 From: Sollace Date: Thu, 21 Feb 2019 11:30:11 +0200 Subject: [PATCH] Fix bauble detection Closes #3 --- .../java/com/minelittlepony/unicopia/extern/Baubles.java | 9 ++++++--- .../java/com/minelittlepony/unicopia/init/UItems.java | 5 +---- 2 files changed, 7 insertions(+), 7 deletions(-) diff --git a/src/main/java/com/minelittlepony/unicopia/extern/Baubles.java b/src/main/java/com/minelittlepony/unicopia/extern/Baubles.java index 2767dc0e..f5c9d413 100644 --- a/src/main/java/com/minelittlepony/unicopia/extern/Baubles.java +++ b/src/main/java/com/minelittlepony/unicopia/extern/Baubles.java @@ -1,6 +1,6 @@ package com.minelittlepony.unicopia.extern; -import java.util.function.Supplier; +import com.minelittlepony.unicopia.item.ItemAlicornAmulet; import baubles.api.BaubleType; import baubles.api.BaublesApi; @@ -26,8 +26,11 @@ public class Baubles { return modIsActive; } - public static T ifActiveElseGet(Supplier yes, Supplier no) { - return (isModActive() ? yes : no).get(); + public static ItemAlicornAmulet alicornAmulet(String domain, String name) { + if (isModActive()) { + return new BaubleAlicornAmulet(domain, name); + } + return new ItemAlicornAmulet(domain, name); } public static int isBaubleEquipped(EntityPlayer player, Item bauble) { diff --git a/src/main/java/com/minelittlepony/unicopia/init/UItems.java b/src/main/java/com/minelittlepony/unicopia/init/UItems.java index 7b0e719c..28803f34 100644 --- a/src/main/java/com/minelittlepony/unicopia/init/UItems.java +++ b/src/main/java/com/minelittlepony/unicopia/init/UItems.java @@ -53,7 +53,6 @@ import com.minelittlepony.unicopia.edibles.FlowerToxicityDeterminent; import com.minelittlepony.unicopia.edibles.ItemEdible; import com.minelittlepony.unicopia.edibles.Toxicity; import com.minelittlepony.unicopia.edibles.UItemFoodDelegate; -import com.minelittlepony.unicopia.extern.BaubleAlicornAmulet; import com.minelittlepony.unicopia.extern.Baubles; import com.minelittlepony.unicopia.forgebullshit.BuildInTexturesBakery; import com.minelittlepony.unicopia.forgebullshit.ItemModels; @@ -112,9 +111,7 @@ public class UItems { public static final ItemSpell curse = new ItemCurse(Unicopia.MODID, "corrupted_gem"); public static final ItemOfHolding bag_of_holding = new ItemOfHolding(Unicopia.MODID, "bag_of_holding"); - public static final ItemAlicornAmulet alicorn_amulet = Baubles.ifActiveElseGet( - () -> new BaubleAlicornAmulet(Unicopia.MODID, "alicorn_amulet"), - () -> new ItemAlicornAmulet(Unicopia.MODID, "alicorn_amulet")); + public static final ItemAlicornAmulet alicorn_amulet = Baubles.alicornAmulet(Unicopia.MODID, "alicorn_amulet"); public static final ItemSpellbook spellbook = new ItemSpellbook(Unicopia.MODID, "spellbook"); public static final Item staff_meadow_brook = new ItemStaff(Unicopia.MODID, "staff_meadow_brook").setMaxDamage(2);