From cd2ba914a6b5b980ff56347455fcf43a9e3eea3b Mon Sep 17 00:00:00 2001 From: miozune Date: Sat, 26 Nov 2022 01:56:28 +0900 Subject: Rewrite GUIs with ModularUI (#440) * Update GT * NEI migration & cleanup Deprecate GTPP_Recipe_Map_Internal#sMappingsEx and delegate to GT_Recipe_Map#sMappings instead Remove recipe modification check * Boiler * Programmed Circuit & Super Bus * Lower the number of fluid slots for multi mixer NEI * Solar Generator * Crop Manager * Bronze Workbench & Advanced Workbench * Turbine Housing & Rotor Assembly * Iron Plated Blast Furnace * Player Safe * Advanced Muffler Hatch * spotlessApply * Auto Workbench * Breaker, Control Core, RTG Hatch, Steam Bus, some cleanup * Fix crash when removing Breaker * Data Orb Repository * Charging/Discharging Bus * Pollution Scrubber * Storage Crate, Shelf, TieredChest They're just broken in the first place, don't blame me * cleanup * Steam Condenser It's broken in the first place, never blame me! * Catalyst Housing, Ball Housing * Fluid Tank, generators, custom hatches, cleanup * Computer Cube MKII Many things are broken in the first place, I swear * Inventory Manager * Migrate multiblock dehydrator recipemap to ModularUI * Overflow cover * Redstone Circuit Block * Multiblock * cleanup * Update GT --- .../gtPlusPlus/nei/GTPP_NEI_DefaultHandler.java | 3 + src/main/java/gtPlusPlus/nei/GT_NEI_LFTR.java | 14 +++-- .../java/gtPlusPlus/nei/GT_NEI_MultiNoCell.java | 33 ----------- .../gtPlusPlus/nei/GT_NEI_MultiSolarTower.java | 14 +++-- .../nei/GT_NEI_MultiTreeGrowthSimulator.java | 11 ++-- src/main/java/gtPlusPlus/nei/NEI_GT_Config.java | 64 ++-------------------- src/main/java/gtPlusPlus/nei/NEI_IMC_Sender.java | 17 +++++- 7 files changed, 47 insertions(+), 109 deletions(-) delete mode 100644 src/main/java/gtPlusPlus/nei/GT_NEI_MultiNoCell.java (limited to 'src/main/java/gtPlusPlus/nei') diff --git a/src/main/java/gtPlusPlus/nei/GTPP_NEI_DefaultHandler.java b/src/main/java/gtPlusPlus/nei/GTPP_NEI_DefaultHandler.java index f080a0bf44..65af02dfe1 100644 --- a/src/main/java/gtPlusPlus/nei/GTPP_NEI_DefaultHandler.java +++ b/src/main/java/gtPlusPlus/nei/GTPP_NEI_DefaultHandler.java @@ -11,6 +11,9 @@ 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) { diff --git a/src/main/java/gtPlusPlus/nei/GT_NEI_LFTR.java b/src/main/java/gtPlusPlus/nei/GT_NEI_LFTR.java index f0555906eb..0d1ef2bcf7 100644 --- a/src/main/java/gtPlusPlus/nei/GT_NEI_LFTR.java +++ b/src/main/java/gtPlusPlus/nei/GT_NEI_LFTR.java @@ -4,7 +4,7 @@ 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 GT_NEI_MultiNoCell { +public class GT_NEI_LFTR extends GTPP_NEI_DefaultHandler { public GT_NEI_LFTR() { super(GTPP_Recipe_Map.sLiquidFluorineThoriumReactorRecipes); @@ -19,21 +19,25 @@ public class GT_NEI_LFTR extends GT_NEI_MultiNoCell { 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, - 83, + y, "Time: " + (tDuration < 20 ? "< 1" : MathUtils.formatNumbers(0.05d * tDuration)) + " secs", -16777216); + y += 10; drawText( 10, - 93, + y, this.mRecipeMap.mNEISpecialValuePre + MathUtils.formatNumbers( (((CachedDefaultRecipe) this.arecipes.get(aRecipeIndex)).mRecipe.mSpecialValue * this.mRecipeMap.mNEISpecialValueMultiplier)) + this.mRecipeMap.mNEISpecialValuePost, -16777216); - drawText(10, 103, "Dynamo: " + MathUtils.formatNumbers((long) (tDuration * tEUt)) + " EU", -16777216); - drawText(10, 113, "Total: " + MathUtils.formatNumbers((long) (tDuration * tEUt * 4)) + " EU", -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_MultiNoCell.java b/src/main/java/gtPlusPlus/nei/GT_NEI_MultiNoCell.java deleted file mode 100644 index 074371c8f3..0000000000 --- a/src/main/java/gtPlusPlus/nei/GT_NEI_MultiNoCell.java +++ /dev/null @@ -1,33 +0,0 @@ -package gtPlusPlus.nei; - -import codechicken.lib.gui.GuiDraw; -import codechicken.nei.recipe.TemplateRecipeHandler; -import gregtech.api.util.GT_Recipe.GT_Recipe_Map; -import org.lwjgl.opengl.GL11; - -/** - * Used for larger GUI ("basicmachines/FissionFuel") - */ -public class GT_NEI_MultiNoCell extends GTPP_NEI_DefaultHandler { - - public GT_NEI_MultiNoCell(GT_Recipe_Map aMap) { - super(aMap); - } - - @Override - public TemplateRecipeHandler newInstance() { - return new GT_NEI_MultiNoCell(mRecipeMap); - } - - @Override - public void drawBackground(final int recipe) { - GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F); - GuiDraw.changeTexture(this.getGuiTexture()); - GuiDraw.drawTexturedModalRect(-4, -8, 1, 3, 174, 89); - } - - @Override - protected int getDescriptionYOffset() { - return 85; - } -} diff --git a/src/main/java/gtPlusPlus/nei/GT_NEI_MultiSolarTower.java b/src/main/java/gtPlusPlus/nei/GT_NEI_MultiSolarTower.java index 9dadd870d1..375c47ef5d 100644 --- a/src/main/java/gtPlusPlus/nei/GT_NEI_MultiSolarTower.java +++ b/src/main/java/gtPlusPlus/nei/GT_NEI_MultiSolarTower.java @@ -4,7 +4,7 @@ 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 GT_NEI_MultiNoCell { +public class GT_NEI_MultiSolarTower extends GTPP_NEI_DefaultHandler { public GT_NEI_MultiSolarTower(GT_Recipe_Map aMap) { super(aMap); @@ -18,15 +18,19 @@ public class GT_NEI_MultiSolarTower extends GT_NEI_MultiNoCell { @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, - 90, + y, "Time: " + (tDuration < 20 ? "< 1" : MathUtils.formatNumbers(0.05d * tDuration)) + " secs", -16777216); + y += 10; } - drawText(5, 100, "Solar Heater rings boost tier", -16777216); - drawText(5, 110, "R1:T1, R2:T2, R3:T4, R4:T8, R5:T16", -16777216); - drawText(5, 120, "Input Amount = 1000 x T", -16777216); + 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 index 5617237044..a98b791e34 100644 --- a/src/main/java/gtPlusPlus/nei/GT_NEI_MultiTreeGrowthSimulator.java +++ b/src/main/java/gtPlusPlus/nei/GT_NEI_MultiTreeGrowthSimulator.java @@ -8,7 +8,7 @@ import gtPlusPlus.core.item.ModItems; import java.util.List; import net.minecraft.item.ItemStack; -public class GT_NEI_MultiTreeGrowthSimulator extends GT_NEI_MultiNoCell { +public class GT_NEI_MultiTreeGrowthSimulator extends GTPP_NEI_DefaultHandler { public GT_NEI_MultiTreeGrowthSimulator() { super(GTPP_Recipe_Map.sTreeSimFakeRecipes); @@ -22,9 +22,12 @@ public class GT_NEI_MultiTreeGrowthSimulator extends GT_NEI_MultiNoCell { @Override public void drawExtras(final int aRecipeIndex) { if (ModItems.fluidFertBasic != null) { - drawText(5, 90, "Chance of Sapling output if", -16777216); - drawText(5, 100, "" + ModItems.fluidFertBasic.getLocalizedName() + " is provided.", -16777216); - drawText(5, 110, "This is optional.", -16777216); + 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); } } diff --git a/src/main/java/gtPlusPlus/nei/NEI_GT_Config.java b/src/main/java/gtPlusPlus/nei/NEI_GT_Config.java index a5d93ea687..18fcb90016 100644 --- a/src/main/java/gtPlusPlus/nei/NEI_GT_Config.java +++ b/src/main/java/gtPlusPlus/nei/NEI_GT_Config.java @@ -3,10 +3,7 @@ package gtPlusPlus.nei; import codechicken.nei.api.API; import codechicken.nei.api.IConfigureNEI; import gregtech.api.util.GTPP_Recipe.GTPP_Recipe_Map; -import gregtech.api.util.GTPP_Recipe.GTPP_Recipe_Map_Internal; -import gregtech.api.util.GT_Recipe.GT_Recipe_Map; import gtPlusPlus.api.objects.Logger; -import gtPlusPlus.api.objects.data.AutoMap; import gtPlusPlus.core.util.Utils; import gtPlusPlus.xmod.gregtech.api.enums.GregtechItemList; @@ -14,74 +11,21 @@ public class NEI_GT_Config implements IConfigureNEI { public static boolean sIsAdded = true; - private static final AutoMap mUniqueRecipeMapHandling = new AutoMap(); - @Override public synchronized void loadConfig() { sIsAdded = false; - mUniqueRecipeMapHandling.add(GTPP_Recipe_Map.sFissionFuelProcessing.mUnlocalizedName); - mUniqueRecipeMapHandling.add(GTPP_Recipe_Map.sLiquidFluorineThoriumReactorRecipes.mUnlocalizedName); - mUniqueRecipeMapHandling.add(GTPP_Recipe_Map.sChemicalPlantRecipes.mUnlocalizedName); - mUniqueRecipeMapHandling.add(GTPP_Recipe_Map.sVacuumFurnaceRecipes.mUnlocalizedName); - - mUniqueRecipeMapHandling.add(GTPP_Recipe_Map.sAdvFreezerRecipes_GT.mUnlocalizedName); - mUniqueRecipeMapHandling.add(GTPP_Recipe_Map.sMultiblockCentrifugeRecipes_GT.mUnlocalizedName); - mUniqueRecipeMapHandling.add(GTPP_Recipe_Map.sMultiblockElectrolyzerRecipes_GT.mUnlocalizedName); - mUniqueRecipeMapHandling.add(GTPP_Recipe_Map.sMultiblockMixerRecipes_GT.mUnlocalizedName); - mUniqueRecipeMapHandling.add(GTPP_Recipe_Map.sAlloyBlastSmelterRecipes.mUnlocalizedName); - mUniqueRecipeMapHandling.add(GTPP_Recipe_Map.sThermalFuels.mUnlocalizedName); - mUniqueRecipeMapHandling.add(GTPP_Recipe_Map.sSolarTowerRecipes.mUnlocalizedName); - mUniqueRecipeMapHandling.add(GTPP_Recipe_Map.sTreeSimFakeRecipes.mUnlocalizedName); - mUniqueRecipeMapHandling.add(GTPP_Recipe_Map.sMultiblockChemicalDehydratorRecipes.mUnlocalizedName); - - // Standard GT Recipe Maps - Logger.INFO("NEI Registration: " + GTPP_Recipe_Map_Internal.sMappingsEx.size() + " sMappingEx"); - for (final GT_Recipe_Map tMap : GTPP_Recipe_Map_Internal.sMappingsEx) { - if (tMap.mNEIAllowed) { - if (!mUniqueRecipeMapHandling.contains(tMap.mUnlocalizedName)) { - Logger.INFO("NEI Registration: Registering NEI handler for " + tMap.mNEIName); - new GTPP_NEI_DefaultHandler(tMap); - } else { - Logger.INFO("NEI Registration: Not allowed to register NEI handler for " + tMap.mNEIName); - } - } else { - Logger.INFO("NEI Registration: Skipping registration of NEI handler for " + tMap.mNEIName); - } - } - 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.sFissionFuelProcessing.mNEIName); - new GT_NEI_MultiNoCell(GTPP_Recipe_Map.sFissionFuelProcessing); - Logger.INFO("NEI Registration: Registering NEI handler for " + GTPP_Recipe_Map.sVacuumFurnaceRecipes.mNEIName); - new GT_NEI_MultiNoCell(GTPP_Recipe_Map.sVacuumFurnaceRecipes); - Logger.INFO("NEI Registration: Registering NEI handler for " + GTPP_Recipe_Map.sThermalFuels.mNEIName); - new GT_NEI_MultiNoCell(GTPP_Recipe_Map.sThermalFuels); - 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 " + GTPP_Recipe_Map.sTreeSimFakeRecipes.mNEIName); new GT_NEI_MultiTreeGrowthSimulator(); - Logger.INFO("NEI Registration: Registering NEI handler for " + GTPP_Recipe_Map.sAdvFreezerRecipes_GT.mNEIName); - new GT_NEI_MultiNoCell(GTPP_Recipe_Map.sAdvFreezerRecipes_GT); - Logger.INFO("NEI Registration: Registering NEI handler for " - + GTPP_Recipe_Map.sMultiblockCentrifugeRecipes_GT.mNEIName); - new GT_NEI_MultiNoCell(GTPP_Recipe_Map.sMultiblockCentrifugeRecipes_GT); - Logger.INFO("NEI Registration: Registering NEI handler for " - + GTPP_Recipe_Map.sMultiblockElectrolyzerRecipes_GT.mNEIName); - new GT_NEI_MultiNoCell(GTPP_Recipe_Map.sMultiblockElectrolyzerRecipes_GT); - Logger.INFO( - "NEI Registration: Registering NEI handler for " + GTPP_Recipe_Map.sMultiblockMixerRecipes_GT.mNEIName); - new GT_NEI_MultiNoCell(GTPP_Recipe_Map.sMultiblockMixerRecipes_GT); - Logger.INFO("NEI Registration: Registering NEI handler for " - + GTPP_Recipe_Map.sMultiblockChemicalDehydratorRecipes.mNEIName); - new GT_NEI_MultiNoCell(GTPP_Recipe_Map.sMultiblockChemicalDehydratorRecipes); - Logger.INFO( - "NEI Registration: Registering NEI handler for " + GTPP_Recipe_Map.sAlloyBlastSmelterRecipes.mNEIName); - new GT_NEI_MultiNoCell(GTPP_Recipe_Map.sAlloyBlastSmelterRecipes); + 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()); diff --git a/src/main/java/gtPlusPlus/nei/NEI_IMC_Sender.java b/src/main/java/gtPlusPlus/nei/NEI_IMC_Sender.java index cbf08e890b..0d25986db7 100644 --- a/src/main/java/gtPlusPlus/nei/NEI_IMC_Sender.java +++ b/src/main/java/gtPlusPlus/nei/NEI_IMC_Sender.java @@ -8,6 +8,7 @@ public class NEI_IMC_Sender { public static void IMCSender() { // NEI jar is using some outdated handler names sendHandler("gtpp.recipe.alloyblastsmelter", "gregtech:gt.blockmachines:810"); + sendCatalyst("gtpp.recipe.alloyblastsmelter", "gregtech:gt.blockmachines:31150"); sendHandler("gtpp.recipe.rocketenginefuel", "gregtech:gt.blockmachines:793"); sendHandler("gtpp.recipe.cyclotron", "gregtech:gt.blockmachines:828"); sendHandler("gtpp.recipe.chemicaldehydrator", "gregtech:gt.blockmachines:911"); @@ -18,8 +19,6 @@ public class NEI_IMC_Sender { sendHandler("gtpp.recipe.fishpond", "gregtech:gt.blockmachines:829", 1); sendHandler("gtpp.recipe.multimixer", "gregtech:gt.blockmachines:811"); sendHandler("gtpp.recipe.advanced.mixer", "gregtech:gt.blockmachines:811"); - sendHandler("gtpp.recipe.multidehydrator", "gregtech:gt.blockmachines:995"); - sendCatalyst("gtpp.recipe.multidehydrator", "gregtech:gt.blockmachines:995"); sendHandler("gtpp.recipe.cryogenicfreezer", "gregtech:gt.blockmachines:910"); sendHandler("gtpp.recipe.matterfab2", "gregtech:gt.blockmachines:799"); sendHandler("gtpp.recipe.multicentrifuge", "gregtech:gt.blockmachines:790", 1); @@ -83,6 +82,13 @@ 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"); } private static void sendHandler(String aRecipeName, String aBlock) { @@ -114,4 +120,11 @@ public class NEI_IMC_Sender { private static void sendCatalyst(String aName, String aStack) { sendCatalyst(aName, aStack, 0); } + + private static void sendRemoveCatalyst(String aName, String aStack) { + NBTTagCompound aNBT = new NBTTagCompound(); + aNBT.setString("handlerID", aName); + aNBT.setString("itemName", aStack); + FMLInterModComms.sendMessage("NotEnoughItems", "removeCatalystInfo", aNBT); + } } -- cgit