From ace3b499ae3041797438aea8c602d2069632097f Mon Sep 17 00:00:00 2001 From: Justin Aquadro Date: Wed, 21 Oct 2020 00:33:24 -0400 Subject: [PATCH] Re-enable WAILA support --- .../integration/JustEnoughItems.java | 25 ++++++++----------- .../storagedrawers/integration/Waila.java | 25 +++++++++++-------- 2 files changed, 24 insertions(+), 26 deletions(-) diff --git a/src/main/java/com/jaquadro/minecraft/storagedrawers/integration/JustEnoughItems.java b/src/main/java/com/jaquadro/minecraft/storagedrawers/integration/JustEnoughItems.java index a31911f9a..a8c772c9c 100644 --- a/src/main/java/com/jaquadro/minecraft/storagedrawers/integration/JustEnoughItems.java +++ b/src/main/java/com/jaquadro/minecraft/storagedrawers/integration/JustEnoughItems.java @@ -6,20 +6,25 @@ import com.jaquadro.minecraft.storagedrawers.integration.jei.TemplateRecipeWrapper; import mezz.jei.api.*; import mezz.jei.api.ingredients.IModIngredientRegistration; +import mezz.jei.api.registration.IModIngredientRegistration; +import mezz.jei.api.registration.IRecipeRegistration; +import mezz.jei.api.registration.ISubtypeRegistration; +import mezz.jei.api.runtime.IJeiRuntime; import net.minecraft.block.Block; import net.minecraft.item.Item; import net.minecraft.item.ItemStack; +import net.minecraft.util.ResourceLocation; import net.minecraftforge.oredict.OreDictionary; import java.util.HashSet; import java.util.Set; -@JEIPlugin +@JeiPlugin public class JustEnoughItems extends IntegrationModule implements IModPlugin { private static final String MOD_ID = "JEI"; private static Set pendingHide = new HashSet(); - private static IItemBlacklist blacklist; + //private static IItemBlacklist blacklist; @Override public String getModID () { @@ -37,17 +42,12 @@ public void postInit () { } @Override - public void registerItemSubtypes (ISubtypeRegistry subtypeRegistry) { - - } - - @Override - public void registerIngredients (IModIngredientRegistration registry) { - + public ResourceLocation getPluginUid () { + return null; } @Override - public void register (IModRegistry registry) { + public void registerRecipes (IRecipeRegistration registration) { TemplateRecipeWrapper templateWrapper = new TemplateRecipeWrapper(new TemplateRecipe(), registry.getJeiHelpers()); TemplateRecipeHandler templateHandler = new TemplateRecipeHandler(templateWrapper); @@ -60,11 +60,6 @@ public void register (IModRegistry registry) { pendingHide.clear(); } - @Override - public void onRuntimeAvailable (IJeiRuntime jeiRuntime) { - - } - private static void hideItem (ItemStack stack) { blacklist.addItemToBlacklist(stack); } diff --git a/src/main/java/com/jaquadro/minecraft/storagedrawers/integration/Waila.java b/src/main/java/com/jaquadro/minecraft/storagedrawers/integration/Waila.java index dc94e42b8..9fb9f2982 100644 --- a/src/main/java/com/jaquadro/minecraft/storagedrawers/integration/Waila.java +++ b/src/main/java/com/jaquadro/minecraft/storagedrawers/integration/Waila.java @@ -1,5 +1,5 @@ package com.jaquadro.minecraft.storagedrawers.integration; -/* + import com.jaquadro.minecraft.storagedrawers.StorageDrawers; import com.jaquadro.minecraft.storagedrawers.api.storage.EmptyDrawerAttributes; import com.jaquadro.minecraft.storagedrawers.api.storage.IDrawer; @@ -14,6 +14,7 @@ import net.minecraft.client.resources.I18n; import net.minecraft.item.ItemStack; import net.minecraft.util.ResourceLocation; +import net.minecraft.util.text.IFormattableTextComponent; import net.minecraft.util.text.ITextComponent; import net.minecraft.util.text.StringTextComponent; import net.minecraft.util.text.TranslationTextComponent; @@ -63,23 +64,26 @@ public void appendBody (List currenttip, IDataAccessor accessor, ItemStack stack = drawer.getStoredItemPrototype(); if (!stack.isEmpty()) { - ITextComponent stackName = stack.getDisplayName(); + IFormattableTextComponent stackName = new StringTextComponent("").append(stack.getDisplayName()); - if (drawer.getStoredItemCount() == Integer.MAX_VALUE) - name = stackName.appendText("[\u221E]"); - else if (drawer instanceof IFractionalDrawer && ((IFractionalDrawer) drawer).getConversionRate() > 1) - name = stackName.appendText(((i == 0) ? " [" : " [+") + ((IFractionalDrawer) drawer).getStoredItemRemainder() + "]"); + if (drawer.getStoredItemCount() == Integer.MAX_VALUE) { + name = stackName.appendString("[\u221E]"); + } + else if (drawer instanceof IFractionalDrawer && ((IFractionalDrawer) drawer).getConversionRate() > 1) { + String text = ((i == 0) ? " [" : " [+") + ((IFractionalDrawer) drawer).getStoredItemRemainder() + "]"; + name = stackName.appendString(text); + } else if (CommonConfig.INTEGRATION.wailaStackRemainder.get()) { int stacks = drawer.getStoredItemCount() / drawer.getStoredItemStackSize(); int remainder = drawer.getStoredItemCount() - (stacks * drawer.getStoredItemStackSize()); if (stacks > 0 && remainder > 0) - name = stackName.appendText(" [" + stacks + "x" + drawer.getStoredItemStackSize() + " + " + remainder + "]"); + name = stackName.appendString(" [" + stacks + "x" + drawer.getStoredItemStackSize() + " + " + remainder + "]"); else if (stacks > 0) - name = stackName.appendText(" [" + stacks + "x" + drawer.getStoredItemStackSize() + "]"); + name = stackName.appendString(" [" + stacks + "x" + drawer.getStoredItemStackSize() + "]"); else - name = stackName.appendText(" [" + remainder + "]"); + name = stackName.appendString(" [" + remainder + "]"); } else - name = stackName.appendText(" [" + drawer.getStoredItemCount() + "]"); + name = stackName.appendString(" [" + drawer.getStoredItemCount() + "]"); } currenttip.add(new TranslationTextComponent("tooltip.storagedrawers.waila.drawer", i + 1, name)); } @@ -111,4 +115,3 @@ else if (stacks > 0) } } } -*/ \ No newline at end of file