diff options
author | miozune <miozune@gmail.com> | 2023-01-03 01:33:09 +0900 |
---|---|---|
committer | GitHub <noreply@github.com> | 2023-01-02 17:33:09 +0100 |
commit | 08e3d8cc083e46da43ce03541576729457726ccd (patch) | |
tree | 7652c9c8de337075734b1d3bbd65422c3cb11c64 /src/main/java/gtPlusPlus/nei | |
parent | c45afc21d24c5774b9f24313562517185d792234 (diff) | |
download | GT5-Unofficial-08e3d8cc083e46da43ce03541576729457726ccd.tar.gz GT5-Unofficial-08e3d8cc083e46da43ce03541576729457726ccd.tar.bz2 GT5-Unofficial-08e3d8cc083e46da43ce03541576729457726ccd.zip |
Move NEI handlers to new recipemap methods (#470)
Diffstat (limited to 'src/main/java/gtPlusPlus/nei')
7 files changed, 1 insertions, 258 deletions
diff --git a/src/main/java/gtPlusPlus/nei/GTPP_NEI_DefaultHandler.java b/src/main/java/gtPlusPlus/nei/GTPP_NEI_DefaultHandler.java deleted file mode 100644 index 65af02dfe1..0000000000 --- a/src/main/java/gtPlusPlus/nei/GTPP_NEI_DefaultHandler.java +++ /dev/null @@ -1,64 +0,0 @@ -package gtPlusPlus.nei; - -import codechicken.nei.PositionedStack; -import codechicken.nei.recipe.*; -import cpw.mods.fml.common.event.FMLInterModComms; -import gregtech.api.enums.GT_Values; -import gregtech.api.util.*; -import gregtech.api.util.GT_Recipe.GT_Recipe_Map; -import gregtech.nei.GT_NEI_DefaultHandler; -import gtPlusPlus.core.util.minecraft.ItemUtils; -import java.util.*; -import net.minecraft.item.ItemStack; - -/** - * Handles milling/catalyst tooltip - */ -public class GTPP_NEI_DefaultHandler extends GT_NEI_DefaultHandler { - - public GTPP_NEI_DefaultHandler(final GT_Recipe_Map tMap) { - super(tMap); - if (!NEI_GT_Config.sIsAdded) { - FMLInterModComms.sendRuntimeMessage( - GT_Values.GT, - "NEIPlugins", - "register-crafting-handler", - "gregtechplusplus@" + this.getRecipeName() + "@" + this.getOverlayIdentifier()); - GuiCraftingRecipe.craftinghandlers.add(this); - GuiUsageRecipe.usagehandlers.add(this); - } - } - - @Override - public TemplateRecipeHandler newInstance() { - return new GTPP_NEI_DefaultHandler(this.mRecipeMap); - } - - @Override - public List<String> handleItemTooltip( - GuiRecipe<?> gui, ItemStack aStack, List<String> currenttip, int aRecipeIndex) { - super.handleItemTooltip(gui, aStack, currenttip, aRecipeIndex); - CachedRecipe tObject = this.arecipes.get(aRecipeIndex); - if (tObject instanceof CachedDefaultRecipe) { - CachedDefaultRecipe tRecipe = (CachedDefaultRecipe) tObject; - for (PositionedStack tStack : tRecipe.mOutputs) { - // no-op - } - for (PositionedStack tStack : tRecipe.mInputs) { - if (aStack == tStack.item) { - if (ItemUtils.isMillingBall(aStack)) { - currenttip.remove(GT_Utility.trans("151", "Does not get consumed in the process")); - currenttip.add("Does not always get consumed in the process"); - } - if (ItemUtils.isCatalyst(aStack)) { - currenttip.remove(GT_Utility.trans("151", "Does not get consumed in the process")); - currenttip.add("Does not always get consumed in the process"); - currenttip.add("Higher tier pipe casings allow this item to last longer"); - } - } - } - } - - return currenttip; - } -} diff --git a/src/main/java/gtPlusPlus/nei/GT_NEI_FluidReactor.java b/src/main/java/gtPlusPlus/nei/GT_NEI_FluidReactor.java deleted file mode 100644 index 0a04e0abf7..0000000000 --- a/src/main/java/gtPlusPlus/nei/GT_NEI_FluidReactor.java +++ /dev/null @@ -1,41 +0,0 @@ -package gtPlusPlus.nei; - -import codechicken.nei.recipe.TemplateRecipeHandler; -import gregtech.api.util.GTPP_Recipe.GTPP_Recipe_Map; - -public class GT_NEI_FluidReactor extends GTPP_NEI_DefaultHandler { - - public GT_NEI_FluidReactor() { - super(GTPP_Recipe_Map.sChemicalPlantRecipes); - } - - @Override - public TemplateRecipeHandler newInstance() { - return new GT_NEI_FluidReactor(); - } - - @Override - protected String getSpecialInfo(int specialValue) { - String aTierMaterial = " - "; - if (specialValue <= 0) { - aTierMaterial += "Bronze"; - } else if (specialValue == 1) { - aTierMaterial += "Steel"; - } else if (specialValue == 2) { - aTierMaterial += "Aluminium"; - } else if (specialValue == 3) { - aTierMaterial += "Stainless Steel"; - } else if (specialValue == 4) { - aTierMaterial += "Titanium"; - } else if (specialValue == 5) { - aTierMaterial += "Tungsten Steel"; - } else if (specialValue == 6) { - aTierMaterial += "Laurenium"; - } else if (specialValue == 7) { - aTierMaterial += "Botmium"; - } - return this.mRecipeMap.mNEISpecialValuePre - + (specialValue * this.mRecipeMap.mNEISpecialValueMultiplier) - + aTierMaterial; - } -} diff --git a/src/main/java/gtPlusPlus/nei/GT_NEI_LFTR.java b/src/main/java/gtPlusPlus/nei/GT_NEI_LFTR.java deleted file mode 100644 index 0d1ef2bcf7..0000000000 --- a/src/main/java/gtPlusPlus/nei/GT_NEI_LFTR.java +++ /dev/null @@ -1,43 +0,0 @@ -package gtPlusPlus.nei; - -import codechicken.nei.recipe.TemplateRecipeHandler; -import gregtech.api.util.GTPP_Recipe.GTPP_Recipe_Map; -import gtPlusPlus.core.util.math.MathUtils; - -public class GT_NEI_LFTR extends GTPP_NEI_DefaultHandler { - - public GT_NEI_LFTR() { - super(GTPP_Recipe_Map.sLiquidFluorineThoriumReactorRecipes); - } - - @Override - public TemplateRecipeHandler newInstance() { - return new GT_NEI_LFTR(); - } - - @Override - public void drawExtras(final int aRecipeIndex) { - final long tEUt = ((CachedDefaultRecipe) this.arecipes.get(aRecipeIndex)).mRecipe.mSpecialValue; - final int tDuration = ((CachedDefaultRecipe) this.arecipes.get(aRecipeIndex)).mRecipe.mDuration; - int y = getDescriptionYOffset(); - drawText( - 10, - y, - "Time: " + (tDuration < 20 ? "< 1" : MathUtils.formatNumbers(0.05d * tDuration)) + " secs", - -16777216); - y += 10; - drawText( - 10, - y, - this.mRecipeMap.mNEISpecialValuePre - + MathUtils.formatNumbers( - (((CachedDefaultRecipe) this.arecipes.get(aRecipeIndex)).mRecipe.mSpecialValue - * this.mRecipeMap.mNEISpecialValueMultiplier)) - + this.mRecipeMap.mNEISpecialValuePost, - -16777216); - y += 10; - drawText(10, y, "Dynamo: " + MathUtils.formatNumbers((long) (tDuration * tEUt)) + " EU", -16777216); - y += 10; - drawText(10, y, "Total: " + MathUtils.formatNumbers((long) (tDuration * tEUt * 4)) + " EU", -16777216); - } -} diff --git a/src/main/java/gtPlusPlus/nei/GT_NEI_MultiSolarTower.java b/src/main/java/gtPlusPlus/nei/GT_NEI_MultiSolarTower.java deleted file mode 100644 index 375c47ef5d..0000000000 --- a/src/main/java/gtPlusPlus/nei/GT_NEI_MultiSolarTower.java +++ /dev/null @@ -1,36 +0,0 @@ -package gtPlusPlus.nei; - -import codechicken.nei.recipe.TemplateRecipeHandler; -import gregtech.api.util.GT_Recipe.GT_Recipe_Map; -import gtPlusPlus.core.util.math.MathUtils; - -public class GT_NEI_MultiSolarTower extends GTPP_NEI_DefaultHandler { - - public GT_NEI_MultiSolarTower(GT_Recipe_Map aMap) { - super(aMap); - } - - @Override - public TemplateRecipeHandler newInstance() { - return new GT_NEI_MultiSolarTower(mRecipeMap); - } - - @Override - public void drawExtras(final int aRecipeIndex) { - final int tDuration = ((CachedDefaultRecipe) this.arecipes.get(aRecipeIndex)).mRecipe.mDuration; - int y = getDescriptionYOffset(); - if (tDuration > 0) { - drawText( - 10, - y, - "Time: " + (tDuration < 20 ? "< 1" : MathUtils.formatNumbers(0.05d * tDuration)) + " secs", - -16777216); - y += 10; - } - drawText(5, y, "Solar Heater rings boost tier", -16777216); - y += 10; - drawText(5, y, "R1:T1, R2:T2, R3:T4, R4:T8, R5:T16", -16777216); - y += 10; - drawText(5, y, "Input Amount = 1000 x T", -16777216); - } -} diff --git a/src/main/java/gtPlusPlus/nei/GT_NEI_MultiTreeGrowthSimulator.java b/src/main/java/gtPlusPlus/nei/GT_NEI_MultiTreeGrowthSimulator.java deleted file mode 100644 index a98b791e34..0000000000 --- a/src/main/java/gtPlusPlus/nei/GT_NEI_MultiTreeGrowthSimulator.java +++ /dev/null @@ -1,57 +0,0 @@ -package gtPlusPlus.nei; - -import codechicken.nei.PositionedStack; -import codechicken.nei.recipe.GuiRecipe; -import codechicken.nei.recipe.TemplateRecipeHandler; -import gregtech.api.util.GTPP_Recipe.GTPP_Recipe_Map; -import gtPlusPlus.core.item.ModItems; -import java.util.List; -import net.minecraft.item.ItemStack; - -public class GT_NEI_MultiTreeGrowthSimulator extends GTPP_NEI_DefaultHandler { - - public GT_NEI_MultiTreeGrowthSimulator() { - super(GTPP_Recipe_Map.sTreeSimFakeRecipes); - } - - @Override - public TemplateRecipeHandler newInstance() { - return new GT_NEI_MultiTreeGrowthSimulator(); - } - - @Override - public void drawExtras(final int aRecipeIndex) { - if (ModItems.fluidFertBasic != null) { - int y = getDescriptionYOffset(); - drawText(5, y, "Chance of Sapling output if", -16777216); - y += 10; - drawText(5, y, "" + ModItems.fluidFertBasic.getLocalizedName() + " is provided.", -16777216); - y += 10; - drawText(5, y, "This is optional.", -16777216); - } - } - - @Override - public List<String> handleItemTooltip( - final GuiRecipe<?> gui, final ItemStack aStack, final List<String> currenttip, final int aRecipeIndex) { - final TemplateRecipeHandler.CachedRecipe tObject = this.arecipes.get(aRecipeIndex); - if (tObject instanceof CachedDefaultRecipe) { - final CachedDefaultRecipe tRecipe = (CachedDefaultRecipe) tObject; - for (final PositionedStack tStack : tRecipe.mOutputs) { - if (aStack == tStack.item) { - if ((!(tStack instanceof FixedPositionedStack)) - || (((FixedPositionedStack) tStack).mChance <= 0) - || (((FixedPositionedStack) tStack).mChance == 10000)) { - break; - } - if (ModItems.fluidFertBasic != null) { - currenttip.add( - "Chance output if " + ModItems.fluidFertBasic.getLocalizedName() + " is provided."); - } - break; - } - } - } - return currenttip; - } -} diff --git a/src/main/java/gtPlusPlus/nei/NEI_GT_Config.java b/src/main/java/gtPlusPlus/nei/NEI_GT_Config.java index 0a38a9b276..92d19b3630 100644 --- a/src/main/java/gtPlusPlus/nei/NEI_GT_Config.java +++ b/src/main/java/gtPlusPlus/nei/NEI_GT_Config.java @@ -2,7 +2,6 @@ package gtPlusPlus.nei; import codechicken.nei.api.API; import codechicken.nei.api.IConfigureNEI; -import gregtech.api.util.GTPP_Recipe.GTPP_Recipe_Map; import gtPlusPlus.api.objects.Logger; import gtPlusPlus.core.util.Utils; import gtPlusPlus.xmod.gregtech.api.enums.GregtechItemList; @@ -15,20 +14,6 @@ public class NEI_GT_Config implements IConfigureNEI { public synchronized void loadConfig() { sIsAdded = false; - Logger.INFO("NEI Registration: Registering NEI handler for " + GTPP_Recipe_Map.sChemicalPlantRecipes.mNEIName); - new GT_NEI_FluidReactor(); - Logger.INFO("NEI Registration: Registering NEI handler for " - + GTPP_Recipe_Map.sLiquidFluorineThoriumReactorRecipes.mNEIName); - new GT_NEI_LFTR(); - Logger.INFO("NEI Registration: Registering NEI handler for " + GTPP_Recipe_Map.sTreeSimFakeRecipes.mNEIName); - new GT_NEI_MultiTreeGrowthSimulator(); - Logger.INFO("NEI Registration: Registering NEI handler for " + GTPP_Recipe_Map.sAdvFreezerRecipes_GT.mNEIName); - Logger.INFO("NEI Registration: Registering NEI handler for " + GTPP_Recipe_Map.sOreMillRecipes.mNEIName); - new GTPP_NEI_DefaultHandler(GTPP_Recipe_Map.sOreMillRecipes); - Logger.INFO("NEI Registration: Registering NEI handler for " + GTPP_Recipe_Map.sOreMillRecipes.mNEIName); - new GTPP_NEI_DefaultHandler(GTPP_Recipe_Map.sOreMillRecipes); - Logger.INFO("NEI Registration: Registering NEI handler for " + GTPP_Recipe_Map.sSolarTowerRecipes.mNEIName); - new GT_NEI_MultiSolarTower(GTPP_Recipe_Map.sSolarTowerRecipes); Logger.INFO("NEI Registration: Registering NEI handler for " + DecayableRecipeHandler.mNEIName); API.registerRecipeHandler(new DecayableRecipeHandler()); API.registerUsageHandler(new DecayableRecipeHandler()); diff --git a/src/main/java/gtPlusPlus/nei/NEI_IMC_Sender.java b/src/main/java/gtPlusPlus/nei/NEI_IMC_Sender.java index 51bf7cd187..63b39cb0ee 100644 --- a/src/main/java/gtPlusPlus/nei/NEI_IMC_Sender.java +++ b/src/main/java/gtPlusPlus/nei/NEI_IMC_Sender.java @@ -30,6 +30,7 @@ public class NEI_IMC_Sender { sendHandler("gtpp.recipe.lftr.sparging", "gregtech:gt.blockmachines:31035", 1); sendHandler("gtpp.recipe.oremill", "gregtech:gt.blockmachines:31027", 1); sendHandler("gtpp.recipe.flotationcell", "gregtech:gt.blockmachines:31028", 1); + sendHandler("gtpp.recipe.fluidchemicaleactor", "gregtech:gt.blockmachines:998"); sendCatalyst("GTPP_Decayables", "miscutils:blockDecayablesChest"); @@ -86,8 +87,6 @@ public class NEI_IMC_Sender { sendCatalyst("gt.recipe.complexfusionreactor", "gregtech:gt.blockmachines:965", -1); - // overwrite yShift - sendHandler("gtPlusPlus.nei.GT_NEI_FluidReactor", "gregtech:gt.blockmachines:998"); sendHandler("gtpp.recipe.multidehydrator", "gregtech:gt.blockmachines:995"); sendCatalyst("gtpp.recipe.multidehydrator", "gregtech:gt.blockmachines:995"); sendRemoveCatalyst("gtpp.recipe.chemicaldehydrator", "gregtech:gt.blockmachines:995"); |