Fix bauble detection Closes #3

This commit is contained in:
Sollace 2019-02-21 11:30:11 +02:00
parent 9546c2b515
commit 09d167765d
2 changed files with 7 additions and 7 deletions

View file

@ -1,6 +1,6 @@
package com.minelittlepony.unicopia.extern; package com.minelittlepony.unicopia.extern;
import java.util.function.Supplier; import com.minelittlepony.unicopia.item.ItemAlicornAmulet;
import baubles.api.BaubleType; import baubles.api.BaubleType;
import baubles.api.BaublesApi; import baubles.api.BaublesApi;
@ -26,8 +26,11 @@ public class Baubles {
return modIsActive; return modIsActive;
} }
public static <T> T ifActiveElseGet(Supplier<T> yes, Supplier<T> no) { public static ItemAlicornAmulet alicornAmulet(String domain, String name) {
return (isModActive() ? yes : no).get(); if (isModActive()) {
return new BaubleAlicornAmulet(domain, name);
}
return new ItemAlicornAmulet(domain, name);
} }
public static int isBaubleEquipped(EntityPlayer player, Item bauble) { public static int isBaubleEquipped(EntityPlayer player, Item bauble) {

View file

@ -53,7 +53,6 @@ import com.minelittlepony.unicopia.edibles.FlowerToxicityDeterminent;
import com.minelittlepony.unicopia.edibles.ItemEdible; import com.minelittlepony.unicopia.edibles.ItemEdible;
import com.minelittlepony.unicopia.edibles.Toxicity; import com.minelittlepony.unicopia.edibles.Toxicity;
import com.minelittlepony.unicopia.edibles.UItemFoodDelegate; import com.minelittlepony.unicopia.edibles.UItemFoodDelegate;
import com.minelittlepony.unicopia.extern.BaubleAlicornAmulet;
import com.minelittlepony.unicopia.extern.Baubles; import com.minelittlepony.unicopia.extern.Baubles;
import com.minelittlepony.unicopia.forgebullshit.BuildInTexturesBakery; import com.minelittlepony.unicopia.forgebullshit.BuildInTexturesBakery;
import com.minelittlepony.unicopia.forgebullshit.ItemModels; 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 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 ItemOfHolding bag_of_holding = new ItemOfHolding(Unicopia.MODID, "bag_of_holding");
public static final ItemAlicornAmulet alicorn_amulet = Baubles.ifActiveElseGet( public static final ItemAlicornAmulet alicorn_amulet = Baubles.alicornAmulet(Unicopia.MODID, "alicorn_amulet");
() -> new BaubleAlicornAmulet(Unicopia.MODID, "alicorn_amulet"),
() -> new ItemAlicornAmulet(Unicopia.MODID, "alicorn_amulet"));
public static final ItemSpellbook spellbook = new ItemSpellbook(Unicopia.MODID, "spellbook"); 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); public static final Item staff_meadow_brook = new ItemStaff(Unicopia.MODID, "staff_meadow_brook").setMaxDamage(2);