diff options
author | miozune <miozune@gmail.com> | 2022-11-26 01:56:28 +0900 |
---|---|---|
committer | GitHub <noreply@github.com> | 2022-11-25 17:56:28 +0100 |
commit | cd2ba914a6b5b980ff56347455fcf43a9e3eea3b (patch) | |
tree | 9dfba22762592ee292edd9a6c2eb6e4c3d9c6e96 /src/main/java | |
parent | 921527ce3cc5f92b067f180295fa55dae718461f (diff) | |
download | GT5-Unofficial-cd2ba914a6b5b980ff56347455fcf43a9e3eea3b.tar.gz GT5-Unofficial-cd2ba914a6b5b980ff56347455fcf43a9e3eea3b.tar.bz2 GT5-Unofficial-cd2ba914a6b5b980ff56347455fcf43a9e3eea3b.zip |
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
Diffstat (limited to 'src/main/java')
212 files changed, 3447 insertions, 10304 deletions
diff --git a/src/main/java/gregtech/api/util/FishPondFakeRecipe.java b/src/main/java/gregtech/api/util/FishPondFakeRecipe.java index 14cd00d134..3c11c5f801 100644 --- a/src/main/java/gregtech/api/util/FishPondFakeRecipe.java +++ b/src/main/java/gregtech/api/util/FishPondFakeRecipe.java @@ -70,11 +70,8 @@ public class FishPondFakeRecipe { new FluidStack[] {null}, 100, // 1 Tick 0, // No Eu produced - circuit // Magic Number - ); - if (x != null) { - Logger.INFO("Fishing [" + circuit + "]: " + ItemUtils.getArrayStackNames(outputItems)); - GTPP_Recipe.GTPP_Recipe_Map.sFishPondRecipes.addRecipe(x); - } + 0); + Logger.INFO("Fishing [" + circuit + "]: " + ItemUtils.getArrayStackNames(outputItems)); + GTPP_Recipe.GTPP_Recipe_Map.sFishPondRecipes.addRecipe(x, false, false, false); } } diff --git a/src/main/java/gregtech/api/util/GTPP_Recipe.java b/src/main/java/gregtech/api/util/GTPP_Recipe.java index 553a774147..766145c952 100644 --- a/src/main/java/gregtech/api/util/GTPP_Recipe.java +++ b/src/main/java/gregtech/api/util/GTPP_Recipe.java @@ -2,15 +2,13 @@ package gregtech.api.util; import static gregtech.api.enums.GT_Values.*; -import codechicken.nei.PositionedStack; -import gregtech.api.interfaces.tileentity.*; -import gregtech.nei.GT_NEI_DefaultHandler.FixedPositionedStack; +import com.gtnewhorizons.modularui.api.math.Pos2d; +import com.gtnewhorizons.modularui.common.widget.ProgressBar; +import gregtech.api.gui.modularui.GT_UITextures; import gtPlusPlus.api.interfaces.IComparableRecipe; import gtPlusPlus.api.objects.Logger; -import gtPlusPlus.api.objects.data.AutoMap; -import gtPlusPlus.api.objects.data.Pair; import gtPlusPlus.core.lib.CORE; -import gtPlusPlus.core.util.minecraft.RecipeUtils; +import gtPlusPlus.xmod.gregtech.api.gui.GTPP_UITextures; import java.util.*; import net.minecraft.item.ItemStack; import net.minecraftforge.fluids.*; @@ -22,9 +20,6 @@ import net.minecraftforge.fluids.*; */ public class GTPP_Recipe extends GT_Recipe implements IComparableRecipe { - private final String mRecipeHash; - private final AutoMap<Integer> mHashMap = new AutoMap<Integer>(); - public GTPP_Recipe( final boolean aOptimize, final ItemStack[] aInputs, @@ -49,84 +44,12 @@ public class GTPP_Recipe extends GT_Recipe implements IComparableRecipe { aSpecialValue); // Logger.SPECIFIC_WARNING(this.getClass().getName()+" | [GregtechRecipe]", "Created new recipe instance for // "+ItemUtils.getArrayStackNames(aInputs), 167); - this.mRecipeHash = getRecipeHash(this); - this.mHashMap.addAll(convertStringDataToInts(getEncodedRecipeData(this))); } public GTPP_Recipe(final ItemStack aInput1, final ItemStack aOutput1, final int aFuelValue, final int aType) { this(aInput1, aOutput1, null, null, null, aFuelValue, aType); } - private static AutoMap<Integer> convertStringDataToInts(AutoMap<String> aData) { - AutoMap<Integer> aMap = new AutoMap<Integer>(); - for (String string : aData) { - aMap.add(string.hashCode()); - } - return aMap; - } - - private static AutoMap<String> getEncodedRecipeData(GTPP_Recipe aRecipe) { - AutoMap<String> aData = new AutoMap<String>(); - aData.add(aRecipe.mRecipeHash); - aData.add("" + aRecipe.mCanBeBuffered); - aData.add("" + aRecipe.mHidden); - aData.add("" + aRecipe.mEnabled); - aData.add("" + aRecipe.mDuration); - aData.add("" + aRecipe.mEUt); - aData.add("" + aRecipe.mFakeRecipe); - aData.add("" + aRecipe.mSpecialItems); - aData.add(aRecipe.mChances.toString()); - aData.add(aRecipe.mInputs.toString()); - aData.add(aRecipe.mOutputs.toString()); - aData.add(aRecipe.mFluidInputs.toString()); - aData.add(aRecipe.mFluidOutputs.toString()); - return aData; - } - - public static String getRecipeHash(GT_Recipe aRecipe) { - String aEncoderString = aRecipe.toString(); - return aEncoderString; - } - - private final void checkModified() { - if (hasBeenModified()) { - String[] aInfo = RecipeUtils.getRecipeInfo(this); - for (String s : aInfo) { - Logger.INFO(s); - } - CORE.crash( - "Someone has edited an internal GT++ recipe, which is no longer allowed. Please complain to whoever has done this, not Alkalus."); - } - } - - private final boolean hasBeenModified() { - String aEncoderString = this.toString(); - boolean aBasicHashCheck = this.mRecipeHash.equals(aEncoderString); - if (!aBasicHashCheck) { - Logger.INFO("This Recipe Hash: " + aEncoderString); - Logger.INFO("Expected Hash Code: " + this.mRecipeHash); - return true; - } - AutoMap<Integer> aData = new AutoMap<Integer>(); - aData.addAll(convertStringDataToInts(getEncodedRecipeData(this))); - long aHashTotal = 0; - long aExpectedHashTotal = 0; - for (int a : aData) { - aHashTotal += a; - } - for (int a : this.mHashMap) { - aExpectedHashTotal += a; - } - if (aHashTotal != aExpectedHashTotal) { - Logger.INFO("This Recipe Hash: " + aEncoderString); - Logger.INFO("Expected Hash Code: " + this.mRecipeHash); - Logger.INFO("This Recipe Hash: " + aHashTotal); - Logger.INFO("Expected Hash Code: " + aExpectedHashTotal); - return true; - } - return false; - } - // aSpecialValue = EU per Liter! If there is no Liquid for this Object, then it gets multiplied with 1000! public GTPP_Recipe( final ItemStack aInput1, @@ -180,38 +103,14 @@ public class GTPP_Recipe extends GT_Recipe implements IComparableRecipe { } } - public static void reInit() { - GT_Log.out.println("GT_Mod: Re-Unificating Recipes."); - for (final GTPP_Recipe_Map_Internal tMapEntry : GTPP_Recipe_Map_Internal.sMappingsEx) { - // tMapEntry.reInit(); - if (tMapEntry != null && tMapEntry.mRecipeList != null && !tMapEntry.mRecipeList.isEmpty()) { - for (GT_Recipe aRecipe : tMapEntry.mRecipeList) { - checkRecipeOwnership(aRecipe); - } - } - } - } - - private static final boolean checkRecipeOwnership(GT_Recipe aRecipe) { - if (aRecipe != null && aRecipe instanceof GTPP_Recipe) { - GTPP_Recipe nRecipe = (GTPP_Recipe) aRecipe; - GTPP_Recipe_Map_Internal.mHashedRecipes.put(nRecipe.hashCode(), nRecipe); - return true; - } - return false; - } - - public static final void checkRecipeModifications() { - for (GTPP_Recipe aRecipe : GTPP_Recipe_Map_Internal.mHashedRecipes.values()) { - Logger.INFO("Checking recipe: " + aRecipe.hashCode()); - aRecipe.checkModified(); - } - } - + /** + * Even though this is deprecated, it's still used to keep binary compatibility. + * (GoodGenerator and GTNHLanthanides reference to `sSimpleWasherRecipes` and `sChemicalDehydratorRecipes`) + */ public static class GTPP_Recipe_Map_Internal extends GT_Recipe_Map { + @Deprecated public static final Collection<GTPP_Recipe_Map_Internal> sMappingsEx = new ArrayList<>(); - private static final HashMap<Integer, GTPP_Recipe> mHashedRecipes = new HashMap<Integer, GTPP_Recipe>(); public GTPP_Recipe_Map_Internal( Collection<GT_Recipe> aRecipeList, @@ -245,153 +144,155 @@ public class GTPP_Recipe extends GT_Recipe implements IComparableRecipe { aNEISpecialValuePost, aShowVoltageAmperageInNEI, aNEIAllowed); - GT_Recipe_Map.sMappings.remove(this); - GTPP_Recipe_Map_Internal.sMappingsEx.add(this); } } public static class GTPP_Recipe_Map { - // public static final GT_Recipe_Map sChemicalBathRecipes = new GT_Recipe_Map(new HashSet<GT_Recipe>(200), - // "gtpp.recipe.chemicalbath", "Chemical Bath", null, RES_PATH_GUI + "basicmachines/ChemicalBath", 1, 3, 1, 1, - // 1, E, 1, E, true, true); - public static final GTPP_Recipe_Map_Internal sCokeOvenRecipes = new GTPP_Recipe_Map_Internal( - new HashSet<GT_Recipe>(200), - "gtpp.recipe.cokeoven", - "Coke Oven", - null, - RES_PATH_GUI + "basicmachines/Dehydrator", - 2, - 9, - 1, - 0, - 1, - E, - 1, - E, - true, - true); - public static final GTPP_Recipe_Map_Internal sMatterFab2Recipes = new GTPP_Recipe_Map_Internal( - new HashSet<GT_Recipe>(200), - "gtpp.recipe.matterfab2", - "Matter Fabricator", - null, - RES_PATH_GUI + "basicmachines/Default", - 6, - 6, - 0, - 0, - 1, - E, - 1, - E, - true, - true); - // public static final Gregtech_Recipe_Map sMatterFabRecipes = new Gregtech_Recipe_Map(new - // HashSet<GregtechRecipe>(200), "gtpp.recipe.matterfab", "Matter Fabricator", null, RES_PATH_GUI + - // "basicmachines/Massfabricator", 1, 3, 1, 1, 1, E, 1, E, true, true); + public static final GT_Recipe_Map sCokeOvenRecipes = new GT_Recipe_Map( + new HashSet<>(200), + "gtpp.recipe.cokeoven", + "Coke Oven", + null, + RES_PATH_GUI + "basicmachines/Dehydrator", + 2, + 9, + 1, + 0, + 1, + E, + 1, + E, + true, + true) + .setProgressBar(GT_UITextures.PROGRESSBAR_SIFT, ProgressBar.Direction.DOWN); + public static final GT_Recipe_Map sMatterFab2Recipes = new GT_Recipe_Map( + new HashSet<>(200), + "gtpp.recipe.matterfab2", + "Matter Fabricator", + null, + RES_PATH_GUI + "basicmachines/Default", + 2, + 0, + 0, + 0, + 1, + E, + 1, + E, + true, + true) + .useModularUI(true); - public static final GT_Recipe_Map_Fuel sRocketFuels = new GT_Recipe_Map_Fuel( - new HashSet<GT_Recipe>(10), - "gtpp.recipe.rocketenginefuel", - "Rocket Engine Fuel", - null, - RES_PATH_GUI + "basicmachines/Default", - 1, - 1, - 0, - 0, - 1, - "Fuel Value: ", - 3000, - " EU", - true, - true); + public static final GT_Recipe_Map sRocketFuels = new GT_Recipe_Map_Fuel( + new HashSet<>(10), + "gtpp.recipe.rocketenginefuel", + "Rocket Engine Fuel", + null, + RES_PATH_GUI + "basicmachines/Default", + 0, + 0, + 0, + 0, + 1, + "Fuel Value: ", + 3000, + " EU", + true, + true) + .useModularUI(true); - public static final GTPP_Recipe_Map_Internal sGeoThermalFuels = new GTPP_Recipe_Map_Internal( - new HashSet<GT_Recipe>(10), - "gtpp.recipe.geothermalfuel", - "GeoThermal Fuel", - null, - RES_PATH_GUI + "basicmachines/Default", - 1, - 1, - 0, - 0, - 1, - "Fuel Value: ", - 1000, - " EU", - true, - true); - public static final GTPP_Recipe_Map_Internal sChemicalDehydratorRecipes = new GTPP_Recipe_Map_Internal( - new HashSet<GT_Recipe>(200), - "gtpp.recipe.chemicaldehydrator", - "Dehydrator", - null, - RES_PATH_GUI + "basicmachines/Dehydrator", - 2, - 9, - 0, - 0, - 1, - E, - 1, - E, - true, - true); - public static final GTPP_Recipe_Map_Internal sVacuumFurnaceRecipes = new GTPP_Recipe_Map_MultiNoCell( - new HashSet<GT_Recipe>(500), - "gtpp.recipe.vacfurnace", - "Vacuum Furnace", - null, - RES_PATH_GUI + "basicmachines/FissionFuel", - 6, - 6, - 1, - 0, - 1, - "Heat Capacity: ", - 1, - " K", - false, - true); - public static final GTPP_Recipe_Map_Internal sAlloyBlastSmelterRecipes = new GTPP_Recipe_Map_MultiNoCell( - new HashSet<GT_Recipe>(200), - "gtpp.recipe.alloyblastsmelter", - "Alloy Blast Smelter", - null, - RES_PATH_GUI + "basicmachines/FissionFuel", - 9, - 9, - 1, - 0, - 1, - E, - 1, - E, - true, - true); - public static final GTPP_Recipe_Map_Internal sSteamTurbineFuels = new GTPP_Recipe_Map_Internal( - new HashSet<GT_Recipe>(10), - "gtpp.recipe.steamturbinefuel", - "GeoThermal Fuel", - null, - RES_PATH_GUI + "basicmachines/Default", - 1, - 1, - 0, - 0, - 1, - "Fuel Value: ", - 1000, - " EU", - true, - false); + public static final GT_Recipe_Map sGeoThermalFuels = new GT_Recipe_Map( + new HashSet<>(10), + "gtpp.recipe.geothermalfuel", + "GeoThermal Fuel", + null, + RES_PATH_GUI + "basicmachines/Default", + 1, + 1, + 0, + 0, + 1, + "Fuel Value: ", + 1000, + " EU", + true, + true) + .useModularUI(true); + public static final GTPP_Recipe_Map_Internal sChemicalDehydratorRecipes = + (GTPP_Recipe_Map_Internal) new GTPP_Recipe_Map_Internal( + new HashSet<>(200), + "gtpp.recipe.chemicaldehydrator", + "Dehydrator", + null, + RES_PATH_GUI + "basicmachines/Dehydrator", + 2, + 9, + 0, + 0, + 1, + E, + 1, + E, + true, + true) + .setProgressBar(GT_UITextures.PROGRESSBAR_SIFT, ProgressBar.Direction.DOWN); + public static final GT_Recipe_Map sVacuumFurnaceRecipes = new GT_Recipe_Map_LargeNEI( + new HashSet<>(500), + "gtpp.recipe.vacfurnace", + "Vacuum Furnace", + null, + RES_PATH_GUI + "basicmachines/FissionFuel", + 9, + 9, + 1, + 0, + 1, + "Heat Capacity: ", + 1, + " K", + false, + true) + .setUsualFluidInputCount(3) + .setUsualFluidOutputCount(3); + public static final GT_Recipe_Map sAlloyBlastSmelterRecipes = new GT_Recipe_Map_LargeNEI( + new HashSet<>(200), + "gtpp.recipe.alloyblastsmelter", + "Alloy Blast Smelter", + null, + RES_PATH_GUI + "basicmachines/FissionFuel", + 9, + 9, + 1, + 0, + 1, + E, + 1, + E, + true, + true) + .setUsualFluidInputCount(3) + .setUsualFluidOutputCount(3); + public static final GT_Recipe_Map sSteamTurbineFuels = new GT_Recipe_Map( + new HashSet<>(10), + "gtpp.recipe.steamturbinefuel", + "GeoThermal Fuel", + null, + RES_PATH_GUI + "basicmachines/Default", + 1, + 1, + 0, + 0, + 1, + "Fuel Value: ", + 1000, + " EU", + true, + false) + .useModularUI(true); // LFTR recipes - public static final GTPP_Recipe_Map_Internal sLiquidFluorineThoriumReactorRecipes = - new GTPP_Recipe_Map_MultiNoCell( - new HashSet<GT_Recipe>(50), + public static final GT_Recipe_Map sLiquidFluorineThoriumReactorRecipes = new GT_Recipe_Map_FluidOnly( + new HashSet<>(50), "gtpp.recipe.lftr", "Liquid Fluoride Thorium Reactor", null, @@ -405,119 +306,129 @@ public class GTPP_Recipe extends GT_Recipe implements IComparableRecipe { 1, " EU/t per Dynamo", true, - true); + false) + .setUsualFluidInputCount(6) + .setUsualFluidOutputCount(6); // Ore Milling Map - public static final GTPP_Recipe_Map_Internal sOreMillRecipes = new GTPP_Recipe_Map_Internal( - new HashSet<GT_Recipe>(10000), - "gtpp.recipe.oremill", - "Milling", - null, - RES_PATH_GUI + "basicmachines/LFTR", - 3, - 4, - 1, - 0, - 1, - E, - 1, - E, - true, - true); + public static final GT_Recipe_Map sOreMillRecipes = new GT_Recipe_Map( + new HashSet<>(10000), + "gtpp.recipe.oremill", + "Milling", + null, + RES_PATH_GUI + "basicmachines/LFTR", + 3, + 3, + 1, + 0, + 1, + E, + 1, + E, + true, + false) + .useModularUI(true); // Fission Fuel Plant Recipes - public static final GTPP_Recipe_Map_Internal sFissionFuelProcessing = new GTPP_Recipe_Map_MultiNoCell( - new HashSet<GT_Recipe>(50), - "gtpp.recipe.fissionfuel", - "Nuclear Fuel Processing", - null, - RES_PATH_GUI + "basicmachines/FissionFuel", - 0, - 0, - 0, - 0, - 1, - E, - 1, - E, - true, - true); + public static final GT_Recipe_Map sFissionFuelProcessing = new GT_Recipe_Map_FluidOnly( + new HashSet<>(50), + "gtpp.recipe.fissionfuel", + "Nuclear Fuel Processing", + null, + RES_PATH_GUI + "basicmachines/FissionFuel", + 0, + 0, + 0, + 0, + 1, + E, + 1, + E, + true, + true) + .setUsualFluidInputCount(6) + .setUsualFluidOutputCount(6); // Cold Trap - public static final GTPP_Recipe_Map_Internal sColdTrapRecipes = new GTPP_Recipe_Map_Internal( - new HashSet<GT_Recipe>(10000), - "gtpp.recipe.coldtrap", - "Cold Trap", - null, - RES_PATH_GUI + "basicmachines/Dehydrator", - 2, - 9, - 0, - 0, - 1, - E, - 1, - E, - true, - true); + public static final GT_Recipe_Map sColdTrapRecipes = new GT_Recipe_Map( + new HashSet<>(10000), + "gtpp.recipe.coldtrap", + "Cold Trap", + null, + RES_PATH_GUI + "basicmachines/Dehydrator", + 2, + 9, + 0, + 0, + 1, + E, + 1, + E, + true, + true) + .setProgressBar(GT_UITextures.PROGRESSBAR_SIFT, ProgressBar.Direction.DOWN); // Reactor Processing Unit - public static final GTPP_Recipe_Map_Internal sReactorProcessingUnitRecipes = new GTPP_Recipe_Map_Internal( - new HashSet<GT_Recipe>(10000), - "gtpp.recipe.reactorprocessingunit", - "Reactor Processing Unit", - null, - RES_PATH_GUI + "basicmachines/Dehydrator", - 2, - 9, - 0, - 0, - 1, - E, - 1, - E, - true, - true); + public static final GT_Recipe_Map sReactorProcessingUnitRecipes = new GT_Recipe_Map( + new HashSet<>(10000), + "gtpp.recipe.reactorprocessingunit", + "Reactor Processing Unit", + null, + RES_PATH_GUI + "basicmachines/Dehydrator", + 2, + 9, + 0, + 0, + 1, + E, + 1, + E, + true, + true) + .setProgressBar(GT_UITextures.PROGRESSBAR_SIFT, ProgressBar.Direction.DOWN); // Basic Washer Map - public static final GTPP_Recipe_Map_Internal sSimpleWasherRecipes = new GTPP_Recipe_Map_Internal( - new HashSet<GT_Recipe>(3), - "gtpp.recipe.simplewasher", - "Simple Dust Washer", - null, - RES_PATH_GUI + "basicmachines/PotionBrewer", - 1, - 1, - 0, - 0, - 1, - E, - 1, - E, - true, - true); + public static final GTPP_Recipe_Map_Internal sSimpleWasherRecipes = + (GTPP_Recipe_Map_Internal) new GTPP_Recipe_Map_Internal( + new HashSet<>(3), + "gtpp.recipe.simplewasher", + "Simple Dust Washer", + null, + RES_PATH_GUI + "basicmachines/PotionBrewer", + 1, + 1, + 0, + 0, + 1, + E, + 1, + E, + true, + true) + .setProgressBar(GT_UITextures.PROGRESSBAR_ARROW_MULTIPLE); // Molecular Transformer Map - public static final GTPP_Recipe_Map_Internal sMolecularTransformerRecipes = new GTPP_Recipe_Map_Internal( - new HashSet<GT_Recipe>(3), - "gtpp.recipe.moleculartransformer", - "Molecular Transformer", - null, - RES_PATH_GUI + "basicmachines/Scanner", - 1, - 1, - 0, - 0, - 1, - E, - 1, - E, - true, - true); + public static final GT_Recipe_Map sMolecularTransformerRecipes = new GT_Recipe_Map( + new HashSet<>(3), + "gtpp.recipe.moleculartransformer", + "Molecular Transformer", + null, + RES_PATH_GUI + "basicmachines/Scanner", + 1, + 1, + 0, + 0, + 1, + E, + 1, + E, + true, + true) + .setSlotOverlay(false, false, GT_UITextures.OVERLAY_SLOT_MICROSCOPE); // Elemental Duplicator Map - public static final GTPP_Recipe_Map_Internal sElementalDuplicatorRecipes = new GTPP_Recipe_Map_Internal( - new HashSet<GT_Recipe>(3), + public static final GT_Recipe_Map sElementalDuplicatorRecipes = new GT_Recipe_Map( + new HashSet<>(3), "gtpp.recipe.elementaldupe", "Elemental Duplicator", null, @@ -533,18 +444,14 @@ public class GTPP_Recipe extends GT_Recipe implements IComparableRecipe { true, false); - // public static final GT_Recipe_Map sSimpleWasherRecipes_FakeFuckBW = new GT_Recipe_Map(new - // HashSet<GT_Recipe>(3), "gtpp.recipe.simplewasher", "Fuck you Bart", null, RES_PATH_GUI + - // "basicmachines/PotionBrewer", 1, 1, 0, 0, 1, E, 1, E, true, false); - - public static final GTPP_Recipe_Map_Internal sChemicalPlantRecipes = new GTPP_Recipe_Map_ChemicalPlant( - new HashSet<GT_Recipe>(100), + public static final GT_Recipe_Map sChemicalPlantRecipes = new GTPP_Recipe_Map_ChemicalPlant( + new HashSet<>(100), "gtpp.recipe.fluidchemicaleactor", "Chemical Plant", null, CORE.MODID + ":textures/gui/FluidReactor", - 0, - 0, + 4, + 4, 0, 2, 1, @@ -552,153 +459,163 @@ public class GTPP_Recipe extends GT_Recipe implements IComparableRecipe { 1, E, true, - true); + false); // RTG Fuel Map - public static final GT_Recipe.GT_Recipe_Map_Fuel sRTGFuels = new GTPP_Recipe.GT_Recipe_Map_Fuel( - new HashSet<GT_Recipe>(10), - "gtpp.recipe.RTGgenerators", - "RTG", - null, - "gregtech:textures/gui/basicmachines/Default", - 1, - 1, - 0, - 0, - 1, - "Fuel Value: ", - 365, - " Minecraft Days", - true, - true); + public static final GT_Recipe.GT_Recipe_Map_Fuel sRTGFuels = (GT_Recipe_Map_Fuel) new GT_Recipe_Map_Fuel( + new HashSet<>(10), + "gtpp.recipe.RTGgenerators", + "RTG", + null, + "gregtech:textures/gui/basicmachines/Default", + 1, + 0, + 0, + 0, + 1, + "Fuel Value: ", + 365, + " Minecraft Days", + true, + true) + .useModularUI(true); // Thermal Boiler map - public static final GTPP_Recipe_Map_Internal sThermalFuels = new GTPP_Recipe_Map_MultiNoCell( - new HashSet<GT_Recipe>(10), - "gtpp.recipe.thermalgeneratorfuel", - "Thermal Generator Fuel", - null, - RES_PATH_GUI + "basicmachines/FissionFuel", - 1, - 1, - 0, - 0, - 1, - null, - 1000, - null, - true, - true); + public static final GT_Recipe_Map sThermalFuels = new GT_Recipe_Map_LargeNEI( + new HashSet<>(10), + "gtpp.recipe.thermalgeneratorfuel", + "Thermal Generator Fuel", + null, + RES_PATH_GUI + "basicmachines/FissionFuel", + 9, + 9, + 0, + 0, + 1, + null, + 1000, + null, + true, + true) + .setUsualFluidInputCount(3) + .setUsualFluidOutputCount(3); // Solar Tower map - public static final GTPP_Recipe_Map_Internal sSolarTowerRecipes = new GTPP_Recipe_Map_MultiNoCell( - new HashSet<GT_Recipe>(10), - "gtpp.recipe.solartower", - "Solar Tower", - null, - RES_PATH_GUI + "basicmachines/FissionFuel", - 1, - 1, - 0, - 0, - 1, - null, - 1000, - null, - true, - true); + public static final GT_Recipe_Map sSolarTowerRecipes = new GT_Recipe_Map( + new HashSet<>(10), + "gtpp.recipe.solartower", + "Solar Tower", + null, + RES_PATH_GUI + "basicmachines/FissionFuel", + 0, + 0, + 0, + 0, + 1, + null, + 1000, + null, + true, + false) + .useModularUI(true); // Cyclotron recipe map - public static final GTPP_Recipe_Map_Internal sCyclotronRecipes = new GTPP_Recipe_Map_Internal( - new HashSet<GT_Recipe>(200), - "gtpp.recipe.cyclotron", - "COMET - Compact Cyclotron", - null, - RES_PATH_GUI + "basicmachines/BlastSmelter", - 2, - 16, - 0, - 0, - 1, - E, - 1, - E, - true, - true); + public static final GT_Recipe_Map sCyclotronRecipes = new GT_Recipe_Map( + new HashSet<>(200), + "gtpp.recipe.cyclotron", + "COMET - Compact Cyclotron", + null, + RES_PATH_GUI + "basicmachines/BlastSmelter", + 9, + 9, + 0, + 0, + 1, + E, + 1, + E, + true, + true) + .useModularUI(true); // Advanced Mixer - public static final GTPP_Recipe_Map_Internal sAdvancedMixerRecipes = new GTPP_Recipe_Map_Internal( - new HashSet<GT_Recipe>(1000), - "gtpp.recipe.advanced.mixer", - "Advanced Material Combiner", - null, - "gregtech:textures/gui/basicmachines/MixerAdvanced", - 4, - 4, - 1, - 0, - 2, - "", - 1, - "", - true, - true); + public static final GT_Recipe_Map sAdvancedMixerRecipes = new GT_Recipe_Map( + new HashSet<>(1000), + "gtpp.recipe.advanced.mixer", + "Advanced Material Combiner", + null, + "gregtech:textures/gui/basicmachines/MixerAdvanced", + 4, + 4, + 1, + 0, + 2, + "", + 1, + "", + true, + true) + .useModularUI(true); // Mini Fusion - public static final GTPP_Recipe_Map_Internal sSlowFusionRecipes = new GTPP_Recipe_Map_Internal( - new HashSet<GT_Recipe>(50), - "gtpp.recipe.slowfusionreactor", - "Mimir - Slow Fusion", - null, - "gregtech:textures/gui/basicmachines/LFTR", - 0, - 0, - 0, - 2, - 1, - "Start: ", - 1, - " EU", - true, - true); + public static final GT_Recipe_Map sSlowFusionRecipes = new GT_Recipe_Map( + new HashSet<>(50), + "gtpp.recipe.slowfusionreactor", + "Mimir - Slow Fusion", + null, + "gregtech:textures/gui/basicmachines/LFTR", + 0, + 0, + 0, + 2, + 1, + "Start: ", + 1, + " EU", + true, + true) + .useModularUI(true); // Component Assembler public static final GT_Recipe_Map sComponentAssemblerRecipes = new GT_Recipe_Map_Assembler( - new HashSet<GT_Recipe>(300), - "gtpp.recipe.componentassembler", - "Component Assembler", - null, - RES_PATH_GUI + "basicmachines/Assembler", - 6, - 1, - 1, - 0, - 1, - E, - 1, - E, - true, - true); + new HashSet<>(300), + "gtpp.recipe.componentassembler", + "Component Assembler", + null, + RES_PATH_GUI + "basicmachines/Assembler", + 6, + 1, + 1, + 0, + 1, + E, + 1, + E, + true, + true) + .useModularUI(true); // Special Maps for Multis - public static final GTPP_Recipe_Map_Internal sFishPondRecipes = new GTPP_Recipe_Map_Internal( - new HashSet<GT_Recipe>(3), - "gtpp.recipe.fishpond", - "Zhuhai - Fishing Port", - null, - RES_PATH_GUI + "basicmachines/PotionBrewer", - 0, - 1, - 0, - 0, - 1, - "Requires Circuit: ", - 1, - ".", - true, - true); - public static final GTPP_Recipe_Map_Internal sSpargeTowerRecipes = new GTPP_Recipe_Map_Internal( - new HashSet<GT_Recipe>(10000), + public static final GT_Recipe_Map sFishPondRecipes = new GT_Recipe_Map( + new HashSet<>(3), + "gtpp.recipe.fishpond", + "Zhuhai - Fishing Port", + null, + RES_PATH_GUI + "basicmachines/PotionBrewer", + 1, + 1, + 0, + 0, + 1, + E, + 1, + E, + true, + true) + .setSlotOverlay(false, false, GT_UITextures.OVERLAY_SLOT_CAULDRON) + .setProgressBar(GT_UITextures.PROGRESSBAR_ARROW_MULTIPLE); + public static final GT_Recipe_Map sSpargeTowerRecipes = new GT_Recipe_Map( + new HashSet<>(10000), "gtpp.recipe.spargetower", "Sparging", null, @@ -714,51 +631,50 @@ public class GTPP_Recipe extends GT_Recipe implements IComparableRecipe { true, false); - // public static final GTPP_Recipe_Map sMultiblockCentrifugeRecipes = new GT_Recipe_Map_LargeCentrifuge(); - // public static final GTPP_Recipe_Map sMultiblockElectrolyzerRecipes = new GT_Recipe_Map_LargeElectrolyzer(); - // public static final GTPP_Recipe_Map sAdvFreezerRecipes = new GT_Recipe_Map_AdvancedVacuumFreezer(); - - public static final GTPP_Recipe_Map_Internal sAdvFreezerRecipes_GT = new GTPP_Recipe_Map_MultiNoCell( - new HashSet<GT_Recipe>(2000), - "gtpp.recipe.cryogenicfreezer", - "Cryogenic Freezer", - null, - RES_PATH_GUI + "basicmachines/FissionFuel", - 9, - 9, - 0, - 0, - 1, - "", - 0, - "", - false, - true); - public static final GTPP_Recipe_Map_Internal sMultiblockCentrifugeRecipes_GT = new GTPP_Recipe_Map_MultiNoCell( - new HashSet<GT_Recipe>(2000), - "gtpp.recipe.multicentrifuge", - "Multiblock Centrifuge", - null, - RES_PATH_GUI + "basicmachines/FissionFuel", - 9, - 9, - 0, - 0, - 1, - "", - 0, - "", - false, - true); - public static final GTPP_Recipe_Map_Internal sMultiblockElectrolyzerRecipes_GT = - new GTPP_Recipe_Map_MultiNoCell( - new HashSet<GT_Recipe>(2000), + public static final GT_Recipe_Map sAdvFreezerRecipes_GT = new GT_Recipe_Map( + new HashSet<>(2000), + "gtpp.recipe.cryogenicfreezer", + "Cryogenic Freezer", + null, + RES_PATH_GUI + "basicmachines/FissionFuel", + 1, + 1, + 0, + 0, + 1, + "", + 0, + "", + false, + true) + .setUsualFluidInputCount(2); + public static final GT_Recipe_Map sMultiblockCentrifugeRecipes_GT = new GT_Recipe_Map_LargeNEI( + new HashSet<>(2000), + "gtpp.recipe.multicentrifuge", + "Multiblock Centrifuge", + null, + RES_PATH_GUI + "basicmachines/FissionFuel", + 6, + 6, + 0, + 0, + 1, + "", + 0, + "", + false, + true) + .setProgressBar(GT_UITextures.PROGRESSBAR_EXTRACT) + .setUsualFluidInputCount(6) + .setUsualFluidOutputCount(6); + public static final GT_Recipe_Map sMultiblockElectrolyzerRecipes_GT = new GT_Recipe_Map_LargeNEI( + new HashSet<>(2000), "gtpp.recipe.multielectro", "Multiblock Electrolyzer", null, RES_PATH_GUI + "basicmachines/FissionFuel", - 9, - 9, + 6, + 6, 0, 0, 1, @@ -766,10 +682,14 @@ public class GTPP_Recipe extends GT_Recipe implements IComparableRecipe { 0, "", false, - true); + true) + .setProgressBar(GT_UITextures.PROGRESSBAR_EXTRACT) + .setUsualFluidInputCount(6) + .setUsualFluidOutputCount(6); + // internal copy of sChemicalPlantRecipes - public static final GTPP_Recipe_Map_Internal sChemicalPlant_GT = new GTPP_Recipe_Map_Internal( - new HashSet<GT_Recipe>(2000), + public static final GT_Recipe_Map sChemicalPlant_GT = new GT_Recipe_Map( + new HashSet<>(2000), "gtpp.recipe.temp4", "temp4", null, @@ -784,31 +704,33 @@ public class GTPP_Recipe extends GT_Recipe implements IComparableRecipe { "", false, false); - public static final GTPP_Recipe_Map_Internal sMultiblockMixerRecipes_GT = new GTPP_Recipe_Map_MultiNoCell( - new HashSet<GT_Recipe>(2000), - "gtpp.recipe.multimixer", - "Multiblock Mixer", - null, - RES_PATH_GUI + "basicmachines/FissionFuel", - 12, - 9, - 0, - 0, - 1, - "", - 0, - "", - false, - true); - public static final GTPP_Recipe_Map_Internal sMultiblockChemicalDehydratorRecipes = - new GTPP_Recipe_Map_MultiNoCell( - new HashSet<GT_Recipe>(2000), + public static final GT_Recipe_Map sMultiblockMixerRecipes_GT = new GT_Recipe_Map_LargeNEI( + new HashSet<>(2000), + "gtpp.recipe.multimixer", + "Multiblock Mixer", + null, + RES_PATH_GUI + "basicmachines/FissionFuel", + 9, + 9, + 0, + 0, + 1, + "", + 0, + "", + false, + true) + .setProgressBar(GT_UITextures.PROGRESSBAR_MIXER, ProgressBar.Direction.CIRCULAR_CW) + .setUsualFluidInputCount(6) + .setUsualFluidOutputCount(6); + public static final GT_Recipe_Map sMultiblockChemicalDehydratorRecipes = new GT_Recipe_Map_LargeNEI( + new HashSet<>(2000), "gtpp.recipe.multidehydrator", "Multiblock Dehydrator", null, RES_PATH_GUI + "basicmachines/FissionFuel", - 4, - 12, + 6, + 9, 0, 0, 1, @@ -816,92 +738,71 @@ public class GTPP_Recipe extends GT_Recipe implements IComparableRecipe { 0, "", false, - true); + true) + .setUsualFluidInputCount(3) + .setUsualFluidOutputCount(3); // Semi-Fluid Fuel Map - public static final GT_Recipe_Map_Fuel sSemiFluidLiquidFuels = new GT_Recipe_Map_Fuel( - new HashSet<GT_Recipe>(10), - "gtpp.recipe.semifluidgeneratorfuels", - "Semifluid Generator Fuels", - null, - RES_PATH_GUI + "basicmachines/Default", - 1, - 1, - 0, - 0, - 1, - "Fuel Value: ", - 1000, - " EU", - true, - true); + public static final GT_Recipe_Map_Fuel sSemiFluidLiquidFuels = (GT_Recipe_Map_Fuel) new GT_Recipe_Map_Fuel( + new HashSet<>(10), + "gtpp.recipe.semifluidgeneratorfuels", + "Semifluid Generator Fuels", + null, + RES_PATH_GUI + "basicmachines/Default", + 0, + 0, + 0, + 0, + 1, + "Fuel Value: ", + 1000, + " EU", + true, + true) + .useModularUI(true); // Flotation Cell - public static final GTPP_Recipe_Map_Internal sFlotationCellRecipes = new GTPP_Recipe_Map_Internal( - new HashSet<GT_Recipe>(10000), - "gtpp.recipe.flotationcell", - "Flotation Cell", - null, - RES_PATH_GUI + "basicmachines/LFTR", - 6, - 4, - 1, - 1, - 1, - "", - 1, - E, - true, - true); + public static final GT_Recipe_Map sFlotationCellRecipes = new GT_Recipe_Map( + new HashSet<>(10000), + "gtpp.recipe.flotationcell", + "Flotation Cell", + null, + RES_PATH_GUI + "basicmachines/LFTR", + 6, + 0, + 1, + 1, + 1, + "", + 1, + E, + true, + true) + .useModularUI(true); // Tree Growth Simulator - public static final GTPP_Recipe_Map_Internal sTreeSimFakeRecipes = new GTPP_Recipe_Map_MultiNoCell( - new HashSet<GT_Recipe>(100), - "gtpp.recipe.treefarm", - "Tree Growth Simulator", - null, - RES_PATH_GUI + "basicmachines/FissionFuel", - 9, - 9, - 1, - 0, - 1, - "", - 1, - "", - false, - true); + public static final GT_Recipe_Map sTreeSimFakeRecipes = new GT_Recipe_Map( + new HashSet<>(100), + "gtpp.recipe.treefarm", + "Tree Growth Simulator", + null, + RES_PATH_GUI + "basicmachines/FissionFuel", + 1, + 2, + 1, + 0, + 1, + "", + 1, + "", + false, + false) + .useModularUI(true); } - public static class GTPP_Recipe_Map_MultiNoCell extends GTPP_Recipe_Map_Internal { - - // region NEI stuff - private static final HashMap<Integer, Pair<Integer, Integer>> mInputSlotMap = new HashMap<>(); - private static final HashMap<Integer, Pair<Integer, Integer>> mOutputSlotMap = new HashMap<>(); + public static class GTPP_Recipe_Map_ChemicalPlant extends GT_Recipe_Map { - static { - int[] slotsX = new int[] {12, 30, 48}; - int[] slotsY = new int[] {5, 23, 41, 64}; - // Input slots - int aIndex = 0; - for (int slotY : slotsY) { - for (int slotX : slotsX) { - mInputSlotMap.put(aIndex++, new Pair<>(slotX, slotY)); - } - } - // Output slots - slotsX = new int[] {102, 120, 138}; - aIndex = 0; - for (int slotY : slotsY) { - for (int slotX : slotsX) { - mOutputSlotMap.put(aIndex++, new Pair<>(slotX, slotY)); - } - } - } - - // endregion NEI stuff - - public GTPP_Recipe_Map_MultiNoCell( + public GTPP_Recipe_Map_ChemicalPlant( Collection<GT_Recipe> aRecipeList, String aUnlocalizedName, String aLocalName, @@ -933,511 +834,50 @@ public class GTPP_Recipe extends GT_Recipe implements IComparableRecipe { aNEISpecialValuePost, aShowVoltageAmperageInNEI, aNEIAllowed); + setSlotOverlay(false, false, GT_UITextures.OVERLAY_SLOT_MOLECULAR_1); + setSlotOverlay(false, true, GT_UITextures.OVERLAY_SLOT_VIAL_1); + setSlotOverlay(true, false, GT_UITextures.OVERLAY_SLOT_MOLECULAR_3); + setSlotOverlay(true, true, GT_UITextures.OVERLAY_SLOT_VIAL_2); + setProgressBar(GTPP_UITextures.PROGRESSBAR_FLUID_REACTOR, ProgressBar.Direction.CIRCULAR_CW); + setProgressBarPos(82, 24); + setUsualFluidInputCount(4); + setUsualFluidOutputCount(2); } @Override - public GT_Recipe addRecipe( - boolean aOptimize, - ItemStack[] aInputs, - ItemStack[] aOutputs, - Object aSpecial, - int[] aOutputChances, - FluidStack[] aFluidInputs, - FluidStack[] aFluidOutputs, - int aDuration, - int aEUt, - int aSpecialValue) { - return addRecipe(new GTPP_Recipe_MultiNoCell( - aOptimize, - aInputs, - aOutputs, - aSpecial, - aOutputChances, - aFluidInputs, - aFluidOutputs, - aDuration, - aEUt, - aSpecialValue)); - } - - @Override - public GT_Recipe addRecipe( - int[] aOutputChances, - FluidStack[] aFluidInputs, - FluidStack[] aFluidOutputs, - int aDuration, - int aEUt, - int aSpecialValue) { - return addRecipe( - new GTPP_Recipe_MultiNoCell( - false, - null, - null, - null, - aOutputChances, - aFluidInputs, - aFluidOutputs, - aDuration, - aEUt, - aSpecialValue), - false, - false, - false); - } - - @Override - public GT_Recipe addRecipe( - boolean aOptimize, - ItemStack[] aInputs, - ItemStack[] aOutputs, - Object aSpecial, - FluidStack[] aFluidInputs, - FluidStack[] aFluidOutputs, - int aDuration, - int aEUt, - int aSpecialValue) { - return addRecipe(new GTPP_Recipe_MultiNoCell( - aOptimize, - aInputs, - aOutputs, - aSpecial, - null, - aFluidInputs, - aFluidOutputs, - aDuration, - aEUt, - aSpecialValue)); - } - - @Override - public GT_Recipe addFakeRecipe( - boolean aCheckForCollisions, - ItemStack[] aInputs, - ItemStack[] aOutputs, - Object aSpecial, - int[] aOutputChances, - FluidStack[] aFluidInputs, - FluidStack[] aFluidOutputs, - int aDuration, - int aEUt, - int aSpecialValue) { - return addFakeRecipe( - aCheckForCollisions, - new GTPP_Recipe_MultiNoCell( - false, - aInputs, - aOutputs, - aSpecial, - aOutputChances, - aFluidInputs, - aFluidOutputs, - aDuration, - aEUt, - aSpecialValue)); - } - - @Override - public GT_Recipe addFakeRecipe( - boolean aCheckForCollisions, - ItemStack[] aInputs, - ItemStack[] aOutputs, - Object aSpecial, - FluidStack[] aFluidInputs, - FluidStack[] aFluidOutputs, - int aDuration, - int aEUt, - int aSpecialValue) { - return addFakeRecipe( - aCheckForCollisions, - new GTPP_Recipe_MultiNoCell( - false, - aInputs, - aOutputs, - aSpecial, - null, - aFluidInputs, - aFluidOutputs, - aDuration, - aEUt, - aSpecialValue)); - } - - @Override - public GT_Recipe addFakeRecipe( - boolean aCheckForCollisions, - ItemStack[] aInputs, - ItemStack[] aOutputs, - Object aSpecial, - FluidStack[] aFluidInputs, - FluidStack[] aFluidOutputs, - int aDuration, - int aEUt, - int aSpecialValue, - boolean hidden) { - return addFakeRecipe( - aCheckForCollisions, - new GTPP_Recipe_MultiNoCell( - false, - aInputs, - aOutputs, - aSpecial, - null, - aFluidInputs, - aFluidOutputs, - aDuration, - aEUt, - aSpecialValue), - hidden); - } - - public static class GTPP_Recipe_MultiNoCell extends GT_Recipe { - - public GTPP_Recipe_MultiNoCell( - boolean aOptimize, - ItemStack[] aInputs, - ItemStack[] aOutputs, - Object aSpecialItems, - int[] aChances, - FluidStack[] aFluidInputs, - FluidStack[] aFluidOutputs, - int aDuration, - int aEUt, - int aSpecialValue) { - super( - aOptimize, - aInputs, - aOutputs, - aSpecialItems, - aChances, - aFluidInputs, - aFluidOutputs, - aDuration, - aEUt, - aSpecialValue); - } - - @Override - public ArrayList<PositionedStack> getInputPositionedStacks() { - int aInputItemsCount = mInputs.length; - int aInputFluidsCount = mFluidInputs.length; - int aInputSlotsUsed = 0; - int aSlotToCheck = 0; - - ArrayList<PositionedStack> inputStacks = new ArrayList<>(aInputItemsCount + aInputFluidsCount); - - // Special Slot - if (mSpecialItems != null) { - inputStacks.add(new FixedPositionedStack(mSpecialItems, 120, 52)); - } - // Up to 9 Inputs Slots - if (aInputItemsCount > 0) { - if (aInputItemsCount > 9) { - aInputItemsCount = 9; - } - for (int i = 0; i < aInputItemsCount; i++) { - int x = mInputSlotMap.get(aInputSlotsUsed).getKey(); - int y = mInputSlotMap.get(aInputSlotsUsed).getValue(); - ItemStack aRepStack = getRepresentativeInput(aSlotToCheck++); - if (aRepStack != null) { - inputStacks.add(new FixedPositionedStack(aRepStack, x, y)); - aInputSlotsUsed++; - } - } - } - // Up to 9 Fluid Inputs Slots - aSlotToCheck = aInputSlotsUsed; - if (aInputFluidsCount > 0) { - for (int i = 0; i < aInputFluidsCount; i++) { - int x = mInputSlotMap.get(aSlotToCheck).getKey(); - int y = mInputSlotMap.get(aSlotToCheck).getValue(); - inputStacks.add( - new FixedPositionedStack(GT_Utility.getFluidDisplayStack(mFluidInputs[i], true), x, y)); - aSlotToCheck++; - aInputSlotsUsed++; - } - } - - return inputStacks; - } - - @Override - public ArrayList<PositionedStack> getOutputPositionedStacks() { - int aOutputItemsCount = mOutputs.length; - int aOutputFluidsCount = mFluidOutputs.length; - int aOutputSlotsUsed = 0; - int aSlotToCheck = 0; - - ArrayList<PositionedStack> outputStacks = new ArrayList<>(aOutputItemsCount + aOutputFluidsCount); - - // Up to 9 Output Slots - if (aOutputItemsCount > 0) { - if (aOutputItemsCount > 9) { - aOutputItemsCount = 9; - } - for (int i = 0; i < aOutputItemsCount; i++) { - int x = mOutputSlotMap.get(aOutputSlotsUsed).getKey(); - int y = mOutputSlotMap.get(aOutputSlotsUsed).getValue(); - ItemStack aRepStack = getOutput(aSlotToCheck); - if (aRepStack != null) { - outputStacks.add(new FixedPositionedStack(aRepStack, x, y, getOutputChance(aSlotToCheck))); - aOutputSlotsUsed++; - } - aSlotToCheck++; - } - } - // Up to 9 Fluid Outputs Slots - aSlotToCheck = aOutputSlotsUsed; - if (aOutputFluidsCount > 0) { - for (int i = 0; i < aOutputFluidsCount; i++) { - int x = mOutputSlotMap.get(aSlotToCheck).getKey(); - int y = mOutputSlotMap.get(aSlotToCheck).getValue(); - outputStacks.add(new FixedPositionedStack( - GT_Utility.getFluidDisplayStack(mFluidOutputs[i], true), x, y)); - aSlotToCheck++; - aOutputSlotsUsed++; - } - } - - return outputStacks; + public List<Pos2d> getItemInputPositions(int itemInputCount) { + List<Pos2d> results = new ArrayList<>(); + for (int i = 0; i < itemInputCount; i++) { + results.add(new Pos2d(7 + i * 18, 6)); } - } - } - - public static class GTPP_Recipe_Map_ChemicalPlant extends GTPP_Recipe_Map_Internal { - - public GTPP_Recipe_Map_ChemicalPlant( - Collection<GT_Recipe> aRecipeList, - String aUnlocalizedName, - String aLocalName, - String aNEIName, - String aNEIGUIPath, - int aUsualInputCount, - int aUsualOutputCount, - int aMinimalInputItems, - int aMinimalInputFluids, - int aAmperage, - String aNEISpecialValuePre, - int aNEISpecialValueMultiplier, - String aNEISpecialValuePost, - boolean aShowVoltageAmperageInNEI, - boolean aNEIAllowed) { - super( - aRecipeList, - aUnlocalizedName, - aLocalName, - aNEIName, - aNEIGUIPath, - aUsualInputCount, - aUsualOutputCount, - aMinimalInputItems, - aMinimalInputFluids, - aAmperage, - aNEISpecialValuePre, - aNEISpecialValueMultiplier, - aNEISpecialValuePost, - aShowVoltageAmperageInNEI, - aNEIAllowed); + return results; } @Override - public GT_Recipe addRecipe( - boolean aOptimize, - ItemStack[] aInputs, - ItemStack[] aOutputs, - Object aSpecial, - int[] aOutputChances, - FluidStack[] aFluidInputs, - FluidStack[] aFluidOutputs, - int aDuration, - int aEUt, - int aSpecialValue) { - return addRecipe(new GTPP_Recipe_ChemicalPlant( - aOptimize, - aInputs, - aOutputs, - aSpecial, - aOutputChances, - aFluidInputs, - aFluidOutputs, - aDuration, - aEUt, - aSpecialValue)); + public List<Pos2d> getItemOutputPositions(int itemOutputCount) { + List<Pos2d> results = new ArrayList<>(); + for (int i = 0; i < itemOutputCount; i++) { + results.add(new Pos2d(106 + (i % 2) * 18, 15 + (i / 2) * 18)); + } + return results; } @Override - public GT_Recipe addRecipe( - int[] aOutputChances, - FluidStack[] aFluidInputs, - FluidStack[] aFluidOutputs, - int aDuration, - int aEUt, - int aSpecialValue) { - return addRecipe( - new GTPP_Recipe_ChemicalPlant( - false, - null, - null, - null, - aOutputChances, - aFluidInputs, - aFluidOutputs, - aDuration, - aEUt, - aSpecialValue), - false, - false, - false); + public List<Pos2d> getFluidInputPositions(int fluidInputCount) { + List<Pos2d> results = new ArrayList<>(); + for (int i = 0; i < fluidInputCount; i++) { + results.add(new Pos2d(7 + i * 18, 41)); + } + return results; } @Override - public GT_Recipe addRecipe( - boolean aOptimize, - ItemStack[] aInputs, - ItemStack[] aOutputs, - Object aSpecial, - FluidStack[] aFluidInputs, - FluidStack[] aFluidOutputs, - int aDuration, - int aEUt, - int aSpecialValue) { - return addRecipe(new GTPP_Recipe_ChemicalPlant( - aOptimize, - aInputs, - aOutputs, - aSpecial, - null, - aFluidInputs, - aFluidOutputs, - aDuration, - aEUt, - aSpecialValue)); - } - - public static class GTPP_Recipe_ChemicalPlant extends GT_Recipe { - - public GTPP_Recipe_ChemicalPlant( - boolean aOptimize, - ItemStack[] aInputs, - ItemStack[] aOutputs, - Object aSpecialItems, - int[] aChances, - FluidStack[] aFluidInputs, - FluidStack[] aFluidOutputs, - int aDuration, - int aEUt, - int aSpecialValue) { - super( - aOptimize, - aInputs, - aOutputs, - aSpecialItems, - aChances, - aFluidInputs, - aFluidOutputs, - aDuration, - aEUt, - aSpecialValue); - } - - @Override - public ArrayList<PositionedStack> getInputPositionedStacks() { - int tStartIndex = 0; - ArrayList<PositionedStack> inputStacks = new ArrayList<>(mInputs.length + mFluidInputs.length); - - // Four Input Slots - if (getRepresentativeInput(tStartIndex) != null) { - inputStacks.add(new FixedPositionedStack(getRepresentativeInput(tStartIndex), 3, -4)); - } - tStartIndex++; - if (getRepresentativeInput(tStartIndex) != null) { - inputStacks.add(new FixedPositionedStack(getRepresentativeInput(tStartIndex), 21, -4)); - } - tStartIndex++; - if (getRepresentativeInput(tStartIndex) != null) { - inputStacks.add(new FixedPositionedStack(getRepresentativeInput(tStartIndex), 39, -4)); - } - tStartIndex++; - if (getRepresentativeInput(tStartIndex) != null) { - inputStacks.add(new FixedPositionedStack(getRepresentativeInput(tStartIndex), 57, -4)); - } - tStartIndex++; - - if (mSpecialItems != null) { - inputStacks.add(new FixedPositionedStack(mSpecialItems, 120, 52)); - } - - // New fluid display behaviour when 3 fluid inputs are detected. (Basically a mix of the code below for - // outputs an the code above for 9 input slots.) - if (mFluidInputs.length >= 1) { - if ((mFluidInputs[0] != null) && (mFluidInputs[0].getFluid() != null)) { - inputStacks.add(new FixedPositionedStack( - GT_Utility.getFluidDisplayStack(mFluidInputs[0], true), 3, 31)); - } - if ((mFluidInputs.length > 1) - && (mFluidInputs[1] != null) - && (mFluidInputs[1].getFluid() != null)) { - inputStacks.add(new FixedPositionedStack( - GT_Utility.getFluidDisplayStack(mFluidInputs[1], true), 21, 31)); - } - if ((mFluidInputs.length > 2) - && (mFluidInputs[2] != null) - && (mFluidInputs[2].getFluid() != null)) { - inputStacks.add(new FixedPositionedStack( - GT_Utility.getFluidDisplayStack(mFluidInputs[2], true), 39, 31)); - } - if ((mFluidInputs.length > 3) - && (mFluidInputs[3] != null) - && (mFluidInputs[3].getFluid() != null)) { - inputStacks.add(new FixedPositionedStack( - GT_Utility.getFluidDisplayStack(mFluidInputs[3], true), 57, 31)); - } - } - - return inputStacks; - } - - @Override - public ArrayList<PositionedStack> getOutputPositionedStacks() { - int tStartIndex = 0; - ArrayList<PositionedStack> outputStacks = new ArrayList<>(mOutputs.length + mFluidOutputs.length); - - // Four Output Slots - if (getOutput(tStartIndex) != null) { - outputStacks.add( - new FixedPositionedStack(getOutput(tStartIndex), 102, 5, getOutputChance(tStartIndex))); - } - tStartIndex++; - if (getOutput(tStartIndex) != null) { - outputStacks.add( - new FixedPositionedStack(getOutput(tStartIndex), 120, 5, getOutputChance(tStartIndex))); - } - tStartIndex++; - if (getOutput(tStartIndex) != null) { - outputStacks.add( - new FixedPositionedStack(getOutput(tStartIndex), 102, 23, getOutputChance(tStartIndex))); - } - tStartIndex++; - if (getOutput(tStartIndex) != null) { - outputStacks.add( - new FixedPositionedStack(getOutput(tStartIndex), 120, 23, getOutputChance(tStartIndex))); - } - tStartIndex++; - - if (mFluidOutputs.length > 0) { - if ((mFluidOutputs[0] != null) && (mFluidOutputs[0].getFluid() != null)) { - outputStacks.add(new FixedPositionedStack( - GT_Utility.getFluidDisplayStack(mFluidOutputs[0], true), 138, 5)); - } - if ((mFluidOutputs.length > 1) - && (mFluidOutputs[1] != null) - && (mFluidOutputs[1].getFluid() != null)) { - outputStacks.add(new FixedPositionedStack( - GT_Utility.getFluidDisplayStack(mFluidOutputs[1], true), 138, 23)); - } - } - - return outputStacks; + public List<Pos2d> getFluidOutputPositions(int fluidOutputCount) { + List<Pos2d> results = new ArrayList<>(); + for (int i = 0; i < fluidOutputCount; i++) { + results.add(new Pos2d(142, 15 + i * 18)); } + return results; } } } diff --git a/src/main/java/gtPlusPlus/GTplusplus.java b/src/main/java/gtPlusPlus/GTplusplus.java index f21700cf85..cea985301f 100644 --- a/src/main/java/gtPlusPlus/GTplusplus.java +++ b/src/main/java/gtPlusPlus/GTplusplus.java @@ -207,7 +207,6 @@ public class GTplusplus implements ActionListener { ItemGiantEgg.postInit(ModItems.itemBigEgg); BlockEventHandler.init(); - GTPP_Recipe.reInit(); Logger.INFO("~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~"); Logger.INFO("| Recipes succesfully Loaded: " @@ -269,14 +268,6 @@ public class GTplusplus implements ActionListener { public void onLoadComplete(FMLLoadCompleteEvent event) { proxy.onLoadComplete(event); generateGregtechRecipeMaps(); - // Check our maps are untouched - GTPP_Recipe.checkRecipeModifications(); - Logger.INFO("Passed verification checks."); - } - - @Mod.EventHandler - public void onIDChangingEvent(FMLModIdMappingEvent aEvent) { - GTPP_Recipe.reInit(); } protected void generateGregtechRecipeMaps() { diff --git a/src/main/java/gtPlusPlus/core/item/chemistry/AgriculturalChem.java b/src/main/java/gtPlusPlus/core/item/chemistry/AgriculturalChem.java index 84e02d452f..017b23d02f 100644 --- a/src/main/java/gtPlusPlus/core/item/chemistry/AgriculturalChem.java +++ b/src/main/java/gtPlusPlus/core/item/chemistry/AgriculturalChem.java @@ -6,6 +6,7 @@ import gtPlusPlus.api.helpers.MaterialHelper; import gtPlusPlus.api.objects.Logger; import gtPlusPlus.api.objects.data.AutoMap; import gtPlusPlus.api.objects.minecraft.ItemPackage; +import gtPlusPlus.core.item.circuit.GTPP_IntegratedCircuit_Item; import gtPlusPlus.core.lib.CORE; import gtPlusPlus.core.lib.LoadedMods; import gtPlusPlus.core.material.ELEMENT; @@ -17,7 +18,6 @@ import gtPlusPlus.core.util.reflect.ReflectionUtils; import gtPlusPlus.plugin.agrichem.BioRecipes; import gtPlusPlus.plugin.agrichem.item.algae.ItemAgrichemBase; import gtPlusPlus.plugin.agrichem.item.algae.ItemAlgaeBase; -import gtPlusPlus.plugin.agrichem.item.algae.ItemBioChip; import gtPlusPlus.xmod.gregtech.api.enums.GregtechItemList; import java.lang.reflect.Field; import java.util.ArrayList; @@ -152,7 +152,7 @@ public class AgriculturalChem extends ItemPackage { mAlgae = new ItemAlgaeBase(); mAgrichemItem1 = new ItemAgrichemBase(); - mBioCircuit = new ItemBioChip(); + mBioCircuit = new GTPP_IntegratedCircuit_Item("BioRecipeSelector", "bioscience/BioCircuit"); GregtechItemList.Circuit_BioRecipeSelector.set(mBioCircuit); mAlgaeBiosmass = ItemUtils.simpleMetaStack(mAgrichemItem1, 0, 1); diff --git a/src/main/java/gtPlusPlus/core/item/chemistry/GenericChem.java b/src/main/java/gtPlusPlus/core/item/chemistry/GenericChem.java index d5224f48e4..31e2492259 100644 --- a/src/main/java/gtPlusPlus/core/item/chemistry/GenericChem.java +++ b/src/main/java/gtPlusPlus/core/item/chemistry/GenericChem.java @@ -5,7 +5,7 @@ import gregtech.api.util.GT_ModHandler; import gregtech.api.util.GT_Utility; import gtPlusPlus.api.objects.minecraft.ItemPackage; import gtPlusPlus.core.item.chemistry.general.ItemGenericChemBase; -import gtPlusPlus.core.item.circuit.ItemAdvancedChip; +import gtPlusPlus.core.item.circuit.GTPP_IntegratedCircuit_Item; import gtPlusPlus.core.lib.CORE; import gtPlusPlus.core.material.*; import gtPlusPlus.core.material.state.MaterialState; @@ -126,7 +126,7 @@ public class GenericChem extends ItemPackage { MaterialGenerator.generate(TEFLON, false); mGenericChemItem1 = new ItemGenericChemBase(); - mAdvancedCircuit = new ItemAdvancedChip(); + mAdvancedCircuit = new GTPP_IntegratedCircuit_Item("T3RecipeSelector", "science/general/AdvancedCircuit"); GregtechItemList.Circuit_T3RecipeSelector.set(mAdvancedCircuit); registerItemStacks(); diff --git a/src/main/java/gtPlusPlus/core/item/circuit/ItemAdvancedChip.java b/src/main/java/gtPlusPlus/core/item/circuit/GTPP_IntegratedCircuit_Item.java index d76a71d24e..cbc7be7efc 100644 --- a/src/main/java/gtPlusPlus/core/item/circuit/ItemAdvancedChip.java +++ b/src/main/java/gtPlusPlus/core/item/circuit/GTPP_IntegratedCircuit_Item.java @@ -1,45 +1,52 @@ package gtPlusPlus.core.item.circuit; -import cpw.mods.fml.common.FMLCommonHandler; +import com.gtnewhorizons.modularui.api.UIInfos; import cpw.mods.fml.common.registry.GameRegistry; import gregtech.api.GregTech_API; import gregtech.api.enums.GT_Values; -import gregtech.api.gui.GT_GUIDialogSelectItem; import gregtech.api.interfaces.INetworkUpdatableItem; import gregtech.api.net.GT_Packet_UpdateItem; import gregtech.api.objects.XSTR; import gregtech.api.util.GT_LanguageManager; import gregtech.api.util.GT_Utility; +import gregtech.common.gui.modularui.uifactory.SelectItemUIFactory; import gtPlusPlus.core.lib.CORE; import gtPlusPlus.core.util.minecraft.ItemUtils; -import java.util.*; +import java.util.ArrayList; +import java.util.List; +import java.util.Map; import java.util.function.BiFunction; import java.util.function.Predicate; import net.minecraft.client.renderer.texture.IIconRegister; import net.minecraft.creativetab.CreativeTabs; -import net.minecraft.entity.Entity; import net.minecraft.entity.player.EntityPlayer; import net.minecraft.entity.player.EntityPlayerMP; import net.minecraft.item.EnumRarity; import net.minecraft.item.Item; import net.minecraft.item.ItemStack; import net.minecraft.nbt.NBTTagCompound; -import net.minecraft.util.*; +import net.minecraft.util.ChatComponentText; +import net.minecraft.util.ChatComponentTranslation; +import net.minecraft.util.IIcon; +import net.minecraft.util.StatCollector; import net.minecraft.world.World; import net.minecraftforge.common.util.Constants; import net.minecraftforge.common.util.FakePlayer; import org.apache.commons.lang3.tuple.Pair; -public class ItemAdvancedChip extends Item implements INetworkUpdatableItem { - private static final List<ItemStack> ALL_VARIANTS = new ArrayList<>(); +public class GTPP_IntegratedCircuit_Item extends Item implements INetworkUpdatableItem { + private final List<ItemStack> ALL_VARIANTS = new ArrayList<>(); + + private final String iconLocation; protected IIcon base; - public ItemAdvancedChip() { + public GTPP_IntegratedCircuit_Item(String unlocalizedName, String iconLocation) { this.setHasSubtypes(true); this.setNoRepair(); this.setMaxStackSize(64); this.setMaxDamage(0); - this.setUnlocalizedName("T3RecipeSelector"); + this.setUnlocalizedName(unlocalizedName); + this.iconLocation = iconLocation; GameRegistry.registerItem(this, this.getUnlocalizedName()); ALL_VARIANTS.add(new ItemStack(this, 0, 0)); for (int i = 1; i <= 24; i++) { @@ -54,22 +61,6 @@ public class ItemAdvancedChip extends Item implements INetworkUpdatableItem { } @Override - public boolean shouldRotateAroundWhenRendering() { - return super.shouldRotateAroundWhenRendering(); - } - - @Override - public void onUpdate( - ItemStack p_77663_1_, World p_77663_2_, Entity p_77663_3_, int p_77663_4_, boolean p_77663_5_) { - super.onUpdate(p_77663_1_, p_77663_2_, p_77663_3_, p_77663_4_, p_77663_5_); - } - - @Override - public String getItemStackDisplayName(ItemStack aStack) { - return super.getItemStackDisplayName(aStack); - } - - @Override public void addInformation(ItemStack aStack, EntityPlayer p_77624_2_, List aList, boolean p_77624_4_) { try { aList.add("Configuration == " + aStack.getItemDamage()); @@ -102,11 +93,6 @@ public class ItemAdvancedChip extends Item implements INetworkUpdatableItem { } @Override - public boolean getIsRepairable(ItemStack p_82789_1_, ItemStack p_82789_2_) { - return false; - } - - @Override public boolean isRepairable() { return false; } @@ -117,28 +103,13 @@ public class ItemAdvancedChip extends Item implements INetworkUpdatableItem { } @Override - public int getDisplayDamage(ItemStack stack) { - return stack.getItemDamage(); - } - - @Override public boolean showDurabilityBar(ItemStack stack) { return false; } @Override - public int getItemEnchantability() { - return 0; - } - - @Override - public int getItemEnchantability(ItemStack stack) { - return 0; - } - - @Override public void registerIcons(final IIconRegister u) { - this.base = u.registerIcon(CORE.MODID + ":" + "science/general/AdvancedCircuit"); + this.base = u.registerIcon(CORE.MODID + ":" + iconLocation); } @Override @@ -162,11 +133,6 @@ public class ItemAdvancedChip extends Item implements INetworkUpdatableItem { } @Override - public String getUnlocalizedName(ItemStack stack) { - return super.getUnlocalizedName(); - } - - @Override public boolean receive(ItemStack stack, EntityPlayerMP player, NBTTagCompound tag) { int meta = tag.hasKey("meta", Constants.NBT.TAG_BYTE) ? tag.getByte("meta") : -1; if (meta < 0 || meta > 24) return true; @@ -184,19 +150,9 @@ public class ItemAdvancedChip extends Item implements INetworkUpdatableItem { } @Override - public boolean onItemUse( - ItemStack stack, - EntityPlayer player, - World world, - int x, - int y, - int z, - int side, - float xOffset, - float yOffset, - float zOffset) { + public ItemStack onItemRightClick(ItemStack stack, World world, EntityPlayer player) { // nothing on server side or fake player - if (player instanceof FakePlayer || !world.isRemote) return false; + if (player instanceof FakePlayer || !world.isRemote) return stack; // check if any screwdriver ItemStack configuratorStack; if (player.capabilities.isCreativeMode) { @@ -216,24 +172,23 @@ public class ItemAdvancedChip extends Item implements INetworkUpdatableItem { } player.addChatComponentMessage(new ChatComponentTranslation( "GT5U.item.programmed_circuit.no_screwdriver." + XSTR.XSTR_INSTANCE.nextInt(count))); - return false; + return stack; } configuratorStack = player.inventory.mainInventory[configurator.getKey()]; } - openSelectorGui(configuratorStack, stack.getItemDamage()); - return true; + openSelectorGui(configuratorStack, stack.getItemDamage(), player); + return stack; } - private void openSelectorGui(ItemStack configurator, int meta) { - FMLCommonHandler.instance() - .showGuiScreen(new GT_GUIDialogSelectItem( + private void openSelectorGui(ItemStack configurator, int meta, EntityPlayer player) { + UIInfos.openClientUI(player, buildContext -> new SelectItemUIFactory( StatCollector.translateToLocal("GT5U.item.programmed_circuit.select.header"), configurator, - null, - ItemAdvancedChip::onConfigured, + GTPP_IntegratedCircuit_Item::onConfigured, ALL_VARIANTS, meta, - true)); + true) + .createWindow(buildContext)); } private static void onConfigured(ItemStack stack) { diff --git a/src/main/java/gtPlusPlus/core/slots/SlotAirFilter.java b/src/main/java/gtPlusPlus/core/slots/SlotAirFilter.java deleted file mode 100644 index 8ad0b000bc..0000000000 --- a/src/main/java/gtPlusPlus/core/slots/SlotAirFilter.java +++ /dev/null @@ -1,29 +0,0 @@ -package gtPlusPlus.core.slots; - -import gtPlusPlus.core.item.general.ItemAirFilter; -import net.minecraft.inventory.IInventory; -import net.minecraft.inventory.Slot; -import net.minecraft.item.ItemStack; - -public class SlotAirFilter extends Slot { - - public SlotAirFilter(final IInventory inventory, final int slot, final int x, final int y) { - super(inventory, slot, x, y); - } - - @Override - public boolean isItemValid(final ItemStack itemstack) { - if (itemstack == null) { - return false; - } - if (itemstack.getItem() instanceof ItemAirFilter) { - return true; - } - return false; - } - - @Override - public int getSlotStackLimit() { - return 1; - } -} diff --git a/src/main/java/gtPlusPlus/core/slots/SlotBlueprint.java b/src/main/java/gtPlusPlus/core/slots/SlotBlueprint.java deleted file mode 100644 index 56d39233e7..0000000000 --- a/src/main/java/gtPlusPlus/core/slots/SlotBlueprint.java +++ /dev/null @@ -1,29 +0,0 @@ -package gtPlusPlus.core.slots; - -import gtPlusPlus.api.objects.Logger; -import gtPlusPlus.core.interfaces.IItemBlueprint; -import net.minecraft.inventory.IInventory; -import net.minecraft.inventory.Slot; -import net.minecraft.item.ItemStack; - -public class SlotBlueprint extends Slot { - - public SlotBlueprint(final IInventory inventory, final int x, final int y, final int z) { - super(inventory, x, y, z); - } - - @Override - public boolean isItemValid(final ItemStack itemstack) { - if (itemstack.getItem() instanceof IItemBlueprint) { - Logger.WARNING(itemstack.getDisplayName() + " is a valid Blueprint."); - return true; - } - Logger.WARNING(itemstack.getDisplayName() + " is not a valid Blueprint."); - return false; - } - - @Override - public int getSlotStackLimit() { - return 1; - } -} diff --git a/src/main/java/gtPlusPlus/core/slots/SlotElectric.java b/src/main/java/gtPlusPlus/core/slots/SlotElectric.java deleted file mode 100644 index 9c14afc6cc..0000000000 --- a/src/main/java/gtPlusPlus/core/slots/SlotElectric.java +++ /dev/null @@ -1,48 +0,0 @@ -package gtPlusPlus.core.slots; - -import gregtech.api.interfaces.tileentity.IGregTechTileEntity; -import gregtech.api.items.GT_MetaGenerated_Tool; -import ic2.api.info.Info; -import ic2.api.item.ElectricItem; -import ic2.api.item.IElectricItem; -import net.minecraft.inventory.IInventory; -import net.minecraft.inventory.Slot; -import net.minecraft.item.ItemStack; - -public class SlotElectric extends Slot { - - public SlotElectric(final IInventory inventory, final int x, final int y, final int z) { - super(inventory, x, y, z); - } - - public SlotElectric(IGregTechTileEntity mTileEntity, int i, int j, int k) { - this( - mTileEntity.getIInventory(mTileEntity.getXCoord(), mTileEntity.getYCoord(), mTileEntity.getZCoord()), - i, - j, - k); - } - - @Override - public boolean isItemValid(final ItemStack itemstack) { - if ((accepts(itemstack)) - || (itemstack.getItem() instanceof GT_MetaGenerated_Tool) - || (itemstack.getItem() instanceof IElectricItem)) { - return true; - } - return false; - } - - public boolean accepts(final ItemStack stack) { - if (stack == null) { - return false; - } - return (Info.itemEnergy.getEnergyValue(stack) > 0.0D) - || (ElectricItem.manager.discharge(stack, (1.0D / 0.0D), 4, true, true, true) > 0.0D); - } - - @Override - public int getSlotStackLimit() { - return 1; - } -} diff --git a/src/main/java/gtPlusPlus/core/slots/SlotLockedInput.java b/src/main/java/gtPlusPlus/core/slots/SlotLockedInput.java deleted file mode 100644 index 41a3236275..0000000000 --- a/src/main/java/gtPlusPlus/core/slots/SlotLockedInput.java +++ /dev/null @@ -1,53 +0,0 @@ -package gtPlusPlus.core.slots; - -import gregtech.api.interfaces.tileentity.IGregTechTileEntity; -import gtPlusPlus.core.util.reflect.ReflectionUtils; -import net.minecraft.inventory.Slot; -import net.minecraft.item.ItemStack; - -public class SlotLockedInput extends Slot { - - private ItemStack mLockStack; - private final IGregTechTileEntity mEntity; - private boolean mChecked = false; - - public SlotLockedInput( - final IGregTechTileEntity inventory, final int index, final int x, final int y, ItemStack lockStack) { - super(inventory, index, x, y); - mLockStack = lockStack; - mEntity = inventory; - } - - @Override - public boolean isItemValid(final ItemStack itemstack) { - if (mEntity == null) { - return false; - } else { - if (!mChecked) { - try { - mLockStack = (ItemStack) ReflectionUtils.getField( - this.mEntity.getMetaTileEntity().getClass(), "mItemStack") - .get(this.mEntity.getMetaTileEntity()); - } catch (Throwable t) { - t.printStackTrace(); - mLockStack = null; - } - mChecked = true; - } - } - - if (mLockStack == null) { - return true; - } else { - if (ItemStack.areItemStacksEqual(itemstack, mLockStack)) { - return true; - } - } - return false; - } - - @Override - public int getSlotStackLimit() { - return mLockStack == null ? 64 : mLockStack.getMaxStackSize(); - } -} diff --git a/src/main/java/gtPlusPlus/core/slots/SlotNoInputLogging.java b/src/main/java/gtPlusPlus/core/slots/SlotNoInputLogging.java deleted file mode 100644 index 230a299d41..0000000000 --- a/src/main/java/gtPlusPlus/core/slots/SlotNoInputLogging.java +++ /dev/null @@ -1,34 +0,0 @@ -package gtPlusPlus.core.slots; - -import gtPlusPlus.api.objects.Logger; -import gtPlusPlus.core.util.minecraft.ItemUtils; -import net.minecraft.block.Block; -import net.minecraft.inventory.IInventory; -import net.minecraft.item.ItemStack; - -public class SlotNoInputLogging extends SlotNoInput { - - private final int aSlotIndex; - - public SlotNoInputLogging(final IInventory inventory, final int index, final int x, final int y) { - super(inventory, index, x, y); - aSlotIndex = index; - Logger.INFO("Slot " + index + " is doing logging"); - } - - @Override - public boolean isItemValid(final ItemStack itemstack) { - if (ItemUtils.checkForInvalidItems(itemstack)) { - Logger.INFO("Tried Inserting " + ItemUtils.getItemName(itemstack) + " into slot " + aSlotIndex); - Block b = Block.getBlockFromItem(itemstack.getItem()); - Logger.INFO("" + itemstack.getUnlocalizedName()); - if (b != null) { - Logger.INFO("" + b.getLocalizedName()); - Logger.INFO("" + b.getUnlocalizedName()); - } - } else { - Logger.INFO("Bad Itemstack"); - } - return false; - } -} diff --git a/src/main/java/gtPlusPlus/core/slots/SlotPollutionScrubber.java b/src/main/java/gtPlusPlus/core/slots/SlotPollutionScrubber.java deleted file mode 100644 index 7025943908..0000000000 --- a/src/main/java/gtPlusPlus/core/slots/SlotPollutionScrubber.java +++ /dev/null @@ -1,67 +0,0 @@ -package gtPlusPlus.core.slots; - -import gregtech.api.items.GT_MetaGenerated_Tool; -import gregtech.api.util.GT_Utility; -import gtPlusPlus.core.item.general.ItemAirFilter; -import gtPlusPlus.core.item.general.ItemBasicScrubberTurbine; -import gtPlusPlus.core.lib.CORE; -import gtPlusPlus.core.recipe.common.CI; -import java.util.HashMap; -import net.minecraft.inventory.IInventory; -import net.minecraft.inventory.Slot; -import net.minecraft.item.ItemStack; - -public class SlotPollutionScrubber extends Slot { - - private final int mType; - private final int mTier; - - private static HashMap<Integer, ItemStack> mConveyorMap = new HashMap<Integer, ItemStack>(); - - static { - for (int i = 0; i < (CORE.MAIN_GREGTECH_5U_EXPERIMENTAL_FORK ? 9 : 5); i++) { - mConveyorMap.put(i, CI.getConveyor(i, 1)); - } - } - - public SlotPollutionScrubber( - final int aType, final int aTier, final IInventory inventory, final int slot, final int x, final int y) { - super(inventory, slot, x, y); - mType = aType; - mTier = aTier; - } - - @Override - public synchronized boolean isItemValid(final ItemStack itemstack) { - return isItemValidForSlot(this, itemstack); - } - - public static synchronized boolean isItemValidForSlot( - final SlotPollutionScrubber aSlot, final ItemStack itemstack) { - if (aSlot.mType == 0) { - if (itemstack.getItem() instanceof ItemBasicScrubberTurbine) { - return true; - } - if (itemstack.getItem() instanceof GT_MetaGenerated_Tool - && itemstack.getItemDamage() >= 170 - && itemstack.getItemDamage() <= 179) { - return true; - } - } else if (aSlot.mType == 1) { - if (itemstack.getItem() instanceof ItemAirFilter) { - return true; - } - } else if (aSlot.mType == 2) { - ItemStack aConveyorStack = mConveyorMap.get(aSlot.mTier); - if (GT_Utility.areStacksEqual(itemstack, aConveyorStack, true)) { - return true; - } - } - return false; - } - - @Override - public int getSlotStackLimit() { - return 1; - } -} diff --git a/src/main/java/gtPlusPlus/core/tileentities/base/TileEntityBase.java b/src/main/java/gtPlusPlus/core/tileentities/base/TileEntityBase.java index f52ce86a99..59516e4231 100644 --- a/src/main/java/gtPlusPlus/core/tileentities/base/TileEntityBase.java +++ b/src/main/java/gtPlusPlus/core/tileentities/base/TileEntityBase.java @@ -554,19 +554,6 @@ public class TileEntityBase extends TileEntity implements ILazyCoverable, IGregT return this.zCoord + ForgeDirection.getOrientation(aSide).offsetZ * aMultiplier; } - public final boolean openGUI(EntityPlayer aPlayer) { - return this.openGUI(aPlayer, 0); - } - - public final boolean openGUI(EntityPlayer aPlayer, int aID) { - if (aPlayer == null) { - return false; - } else { - aPlayer.openGui(GT_Values.GT, aID, this.worldObj, this.xCoord, this.yCoord, this.zCoord); - return true; - } - } - public final int getRandomNumber(int aRange) { return this.worldObj.rand.nextInt(aRange); } diff --git a/src/main/java/gtPlusPlus/core/util/debug/DEBUG_MULTIBLOCK_ShapeSpawner.java b/src/main/java/gtPlusPlus/core/util/debug/DEBUG_MULTIBLOCK_ShapeSpawner.java index b4d2480a02..9cff0758a7 100644 --- a/src/main/java/gtPlusPlus/core/util/debug/DEBUG_MULTIBLOCK_ShapeSpawner.java +++ b/src/main/java/gtPlusPlus/core/util/debug/DEBUG_MULTIBLOCK_ShapeSpawner.java @@ -7,8 +7,7 @@ import gregtech.api.GregTech_API; import gregtech.api.enums.ConfigCategories; import gregtech.api.enums.Materials; import gregtech.api.enums.OrePrefixes; -import gregtech.api.gui.GT_Container_MultiMachine; -import gregtech.api.gui.GT_GUIContainer_MultiMachine; +import gregtech.api.gui.modularui.GT_UIInfos; import gregtech.api.interfaces.metatileentity.IMetaTileEntity; import gregtech.api.interfaces.tileentity.IGregTechTileEntity; import gregtech.api.items.GT_MetaGenerated_Tool; @@ -22,7 +21,6 @@ import gregtech.api.util.GT_Utility; import gregtech.common.items.GT_MetaGenerated_Tool_01; import java.util.ArrayList; import net.minecraft.entity.player.EntityPlayer; -import net.minecraft.entity.player.InventoryPlayer; import net.minecraft.item.ItemStack; import net.minecraft.nbt.NBTTagCompound; import net.minecraftforge.fluids.FluidStack; @@ -183,27 +181,11 @@ public abstract class DEBUG_MULTIBLOCK_ShapeSpawner extends MetaTileEntity { @Override public boolean onRightclick(final IGregTechTileEntity aBaseMetaTileEntity, final EntityPlayer aPlayer) { - if (aBaseMetaTileEntity.isClientSide()) { - return true; - } - aBaseMetaTileEntity.openGUI(aPlayer); + GT_UIInfos.openGTTileEntityUI(aBaseMetaTileEntity, aPlayer); return true; } @Override - public Object getServerGUI( - final int aID, final InventoryPlayer aPlayerInventory, final IGregTechTileEntity aBaseMetaTileEntity) { - return new GT_Container_MultiMachine(aPlayerInventory, aBaseMetaTileEntity); - } - - @Override - public Object getClientGUI( - final int aID, final InventoryPlayer aPlayerInventory, final IGregTechTileEntity aBaseMetaTileEntity) { - return new GT_GUIContainer_MultiMachine( - aPlayerInventory, aBaseMetaTileEntity, this.getLocalName(), "MultiblockDisplay.png"); - } - - @Override public byte getTileEntityBaseType() { return 2; } @@ -982,4 +964,9 @@ public abstract class DEBUG_MULTIBLOCK_ShapeSpawner extends MetaTileEntity { final IGregTechTileEntity aBaseMetaTileEntity, final int aIndex, final byte aSide, final ItemStack aStack) { return false; } + + @Override + public boolean useModularUI() { + return true; + } } 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<String> mUniqueRecipeMapHandling = new AutoMap<String>(); - @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); + } } diff --git a/src/main/java/gtPlusPlus/plugin/agrichem/item/algae/ItemBioChip.java b/src/main/java/gtPlusPlus/plugin/agrichem/item/algae/ItemBioChip.java deleted file mode 100644 index 7e4c68b2f4..0000000000 --- a/src/main/java/gtPlusPlus/plugin/agrichem/item/algae/ItemBioChip.java +++ /dev/null @@ -1,260 +0,0 @@ -package gtPlusPlus.plugin.agrichem.item.algae; - -import cpw.mods.fml.common.FMLCommonHandler; -import cpw.mods.fml.common.registry.GameRegistry; -import gregtech.api.GregTech_API; -import gregtech.api.enums.GT_Values; -import gregtech.api.gui.GT_GUIDialogSelectItem; -import gregtech.api.interfaces.INetworkUpdatableItem; -import gregtech.api.net.GT_Packet_UpdateItem; -import gregtech.api.objects.XSTR; -import gregtech.api.util.GT_LanguageManager; -import gregtech.api.util.GT_Utility; -import gtPlusPlus.core.lib.CORE; -import gtPlusPlus.core.util.minecraft.ItemUtils; -import java.util.*; -import java.util.function.BiFunction; -import java.util.function.Predicate; -import net.minecraft.client.renderer.texture.IIconRegister; -import net.minecraft.creativetab.CreativeTabs; -import net.minecraft.entity.Entity; -import net.minecraft.entity.player.EntityPlayer; -import net.minecraft.entity.player.EntityPlayerMP; -import net.minecraft.item.EnumRarity; -import net.minecraft.item.Item; -import net.minecraft.item.ItemStack; -import net.minecraft.nbt.NBTTagCompound; -import net.minecraft.util.*; -import net.minecraft.world.World; -import net.minecraftforge.common.util.Constants; -import net.minecraftforge.common.util.FakePlayer; -import org.apache.commons.lang3.tuple.Pair; - -public class ItemBioChip extends Item implements INetworkUpdatableItem { - private static final List<ItemStack> ALL_VARIANTS = new ArrayList<>(); - - protected IIcon base; - - public ItemBioChip() { - this.setHasSubtypes(true); - this.setNoRepair(); - this.setMaxStackSize(64); - this.setMaxDamage(0); - this.setUnlocalizedName("BioRecipeSelector"); - GameRegistry.registerItem(this, this.getUnlocalizedName()); - ALL_VARIANTS.add(new ItemStack(this, 0, 0)); - for (int i = 1; i <= 24; i++) { - ItemStack aStack = new ItemStack(this, 0, i); - ALL_VARIANTS.add(aStack); - } - } - - @Override - public boolean isDamageable() { - return false; - } - - @Override - public boolean shouldRotateAroundWhenRendering() { - return super.shouldRotateAroundWhenRendering(); - } - - @Override - public void onUpdate( - ItemStack p_77663_1_, World p_77663_2_, Entity p_77663_3_, int p_77663_4_, boolean p_77663_5_) { - super.onUpdate(p_77663_1_, p_77663_2_, p_77663_3_, p_77663_4_, p_77663_5_); - } - - @Override - public String getItemStackDisplayName(ItemStack aStack) { - return super.getItemStackDisplayName(aStack); - } - - @Override - public void addInformation(ItemStack aStack, EntityPlayer p_77624_2_, List aList, boolean p_77624_4_) { - try { - aList.add("Configuration == " + aStack.getItemDamage()); - aList.add(GT_LanguageManager.addStringLocalization( - new StringBuilder() - .append(getUnlocalizedName()) - .append(".tooltip.0") - .toString(), - "Right click to reconfigure")); - aList.add(GT_LanguageManager.addStringLocalization( - new StringBuilder() - .append(getUnlocalizedName()) - .append(".tooltip.1") - .toString(), - "Needs a screwdriver or circuit programming tool")); - } catch (Throwable t) { - t.printStackTrace(); - } - super.addInformation(aStack, p_77624_2_, aList, p_77624_4_); - } - - @Override - public EnumRarity getRarity(ItemStack p_77613_1_) { - return EnumRarity.common; - } - - @Override - public void getSubItems(Item aItem, CreativeTabs p_150895_2_, List aList) { - aList.add(ItemUtils.simpleMetaStack(aItem, 0, 1)); - } - - @Override - public boolean getIsRepairable(ItemStack p_82789_1_, ItemStack p_82789_2_) { - return false; - } - - @Override - public boolean isRepairable() { - return false; - } - - @Override - public boolean isBookEnchantable(ItemStack stack, ItemStack book) { - return false; - } - - @Override - public int getDisplayDamage(ItemStack stack) { - return stack.getItemDamage(); - } - - @Override - public boolean showDurabilityBar(ItemStack stack) { - return false; - } - - @Override - public int getItemEnchantability() { - return 0; - } - - @Override - public int getItemEnchantability(ItemStack stack) { - return 0; - } - - @Override - public void registerIcons(final IIconRegister u) { - this.base = u.registerIcon(CORE.MODID + ":" + "bioscience/BioCircuit"); - } - - @Override - public IIcon getIconFromDamageForRenderPass(final int damage, final int pass) { - return this.base; - } - - @Override - public IIcon getIconFromDamage(int damage) { - return this.base; - } - - @Override - public IIcon getIcon(ItemStack stack, int renderPass, EntityPlayer player, ItemStack usingItem, int useRemaining) { - return this.base; - } - - @Override - public IIcon getIcon(ItemStack stack, int pass) { - return this.base; - } - - @Override - public String getUnlocalizedName(ItemStack stack) { - return super.getUnlocalizedName(); - } - - @Override - public boolean receive(ItemStack stack, EntityPlayerMP player, NBTTagCompound tag) { - int meta = tag.hasKey("meta", Constants.NBT.TAG_BYTE) ? tag.getByte("meta") : -1; - if (meta < 0 || meta > 24) return true; - - if (!player.capabilities.isCreativeMode) { - Pair<Integer, BiFunction<ItemStack, EntityPlayerMP, ItemStack>> toolIndex = findConfiguratorInInv(player); - if (toolIndex == null) return true; - - ItemStack[] mainInventory = player.inventory.mainInventory; - mainInventory[toolIndex.getKey()] = toolIndex.getValue().apply(mainInventory[toolIndex.getKey()], player); - } - stack.setItemDamage(meta); - - return true; - } - - @Override - public boolean onItemUse( - ItemStack stack, - EntityPlayer player, - World world, - int x, - int y, - int z, - int side, - float xOffset, - float yOffset, - float zOffset) { - // nothing on server side or fake player - if (player instanceof FakePlayer || !world.isRemote) return false; - // check if any screwdriver - ItemStack configuratorStack; - if (player.capabilities.isCreativeMode) { - configuratorStack = null; - } else { - Pair<Integer, ?> configurator = findConfiguratorInInv(player); - if (configurator == null) { - int count; - try { - count = Integer.parseInt( - StatCollector.translateToLocal("GT5U.item.programmed_circuit.no_screwdriver.count")); - } catch (NumberFormatException e) { - player.addChatComponentMessage(new ChatComponentText( - "Error in translation GT5U.item.programmed_circuit.no_screwdriver.count: " - + e.getMessage())); - count = 1; - } - player.addChatComponentMessage(new ChatComponentTranslation( - "GT5U.item.programmed_circuit.no_screwdriver." + XSTR.XSTR_INSTANCE.nextInt(count))); - return false; - } - configuratorStack = player.inventory.mainInventory[configurator.getKey()]; - } - openSelectorGui(configuratorStack, stack.getItemDamage()); - return true; - } - - private void openSelectorGui(ItemStack configurator, int meta) { - FMLCommonHandler.instance() - .showGuiScreen(new GT_GUIDialogSelectItem( - StatCollector.translateToLocal("GT5U.item.programmed_circuit.select.header"), - configurator, - null, - ItemBioChip::onConfigured, - ALL_VARIANTS, - meta, - true)); - } - - private static void onConfigured(ItemStack stack) { - NBTTagCompound tag = new NBTTagCompound(); - tag.setByte("meta", (byte) stack.getItemDamage()); - GT_Values.NW.sendToServer(new GT_Packet_UpdateItem(tag)); - } - - private static Pair<Integer, BiFunction<ItemStack, EntityPlayerMP, ItemStack>> findConfiguratorInInv( - EntityPlayer player) { - ItemStack[] mainInventory = player.inventory.mainInventory; - for (int j = 0, mainInventoryLength = mainInventory.length; j < mainInventoryLength; j++) { - ItemStack toolStack = mainInventory[j]; - - if (!GT_Utility.isStackValid(toolStack)) continue; - - for (Map.Entry<Predicate<ItemStack>, BiFunction<ItemStack, EntityPlayerMP, ItemStack>> p : - GregTech_API.sCircuitProgrammerList.entrySet()) - if (p.getKey().test(toolStack)) return Pair.of(j, p.getValue()); - } - return null; - } -} diff --git a/src/main/java/gtPlusPlus/xmod/gregtech/api/gui/CONTAINER_AdvancedBoiler.java b/src/main/java/gtPlusPlus/xmod/gregtech/api/gui/CONTAINER_AdvancedBoiler.java deleted file mode 100644 index 005485cbde..0000000000 --- a/src/main/java/gtPlusPlus/xmod/gregtech/api/gui/CONTAINER_AdvancedBoiler.java +++ /dev/null @@ -1,102 +0,0 @@ -package gtPlusPlus.xmod.gregtech.api.gui; - -import cpw.mods.fml.relauncher.Side; -import cpw.mods.fml.relauncher.SideOnly; -import gregtech.api.gui.GT_ContainerMetaTile_Machine; -import gregtech.api.interfaces.tileentity.IGregTechTileEntity; -import gtPlusPlus.xmod.gregtech.common.tileentities.generators.GT_MetaTileEntity_Boiler_Base; -import java.util.Iterator; -import net.minecraft.entity.player.InventoryPlayer; -import net.minecraft.inventory.ICrafting; -import net.minecraft.inventory.Slot; - -public class CONTAINER_AdvancedBoiler extends GT_ContainerMetaTile_Machine { - public int mWaterAmount = 0; - public int mSteamAmount = 0; - public int mProcessingEnergy = 0; - public int mTemperature = 2; - - public CONTAINER_AdvancedBoiler(InventoryPlayer aInventoryPlayer, IGregTechTileEntity aTileEntity) { - super(aInventoryPlayer, aTileEntity); - } - - @Override - public void addSlots(InventoryPlayer aInventoryPlayer) { - addSlotToContainer(new Slot(this.mTileEntity, 2, 116, 62)); - addSlotToContainer(new Slot(this.mTileEntity, 0, 44, 26)); - addSlotToContainer(new Slot(this.mTileEntity, 1, 44, 62)); - addSlotToContainer(new Slot(this.mTileEntity, 3, 116, 26)); - } - - @Override - public int getSlotCount() { - return 4; - } - - @Override - public int getShiftClickSlotCount() { - return 1; - } - - @Override - public void detectAndSendChanges() { - super.detectAndSendChanges(); - if ((this.mTileEntity.isClientSide()) || (this.mTileEntity.getMetaTileEntity() == null)) { - return; - } - - int steamCapacity = ((GT_MetaTileEntity_Boiler_Base) this.mTileEntity.getMetaTileEntity()).getSteamCapacity(); - int waterCapacity = ((GT_MetaTileEntity_Boiler_Base) this.mTileEntity.getMetaTileEntity()).getCapacity(); - this.mTemperature = ((GT_MetaTileEntity_Boiler_Base) this.mTileEntity.getMetaTileEntity()).mTemperature; - this.mProcessingEnergy = - ((GT_MetaTileEntity_Boiler_Base) this.mTileEntity.getMetaTileEntity()).mProcessingEnergy; - this.mSteamAmount = (((GT_MetaTileEntity_Boiler_Base) this.mTileEntity.getMetaTileEntity()).mSteam == null - ? 0 - : ((GT_MetaTileEntity_Boiler_Base) this.mTileEntity.getMetaTileEntity()).mSteam.amount); - this.mWaterAmount = (((GT_MetaTileEntity_Boiler_Base) this.mTileEntity.getMetaTileEntity()).mFluid == null - ? 0 - : ((GT_MetaTileEntity_Boiler_Base) this.mTileEntity.getMetaTileEntity()).mFluid.amount); - - this.mTemperature = Math.min( - 54, - Math.max( - 0, - this.mTemperature - * 54 - / (((GT_MetaTileEntity_Boiler_Base) this.mTileEntity.getMetaTileEntity()) - .maxProgresstime() - - 10))); - this.mSteamAmount = Math.min(54, Math.max(0, this.mSteamAmount * 54 / (steamCapacity - 100))); - this.mWaterAmount = Math.min(54, Math.max(0, this.mWaterAmount * 54 / (waterCapacity - 100))); - this.mProcessingEnergy = - Math.min(14, Math.max(this.mProcessingEnergy > 0 ? 1 : 0, this.mProcessingEnergy * 14 / 1000)); - - Iterator<?> var2 = this.crafters.iterator(); - while (var2.hasNext()) { - ICrafting var1 = (ICrafting) var2.next(); - var1.sendProgressBarUpdate(this, 100, this.mTemperature); - var1.sendProgressBarUpdate(this, 101, this.mProcessingEnergy); - var1.sendProgressBarUpdate(this, 102, this.mSteamAmount); - var1.sendProgressBarUpdate(this, 103, this.mWaterAmount); - } - } - - @Override - @SideOnly(Side.CLIENT) - public void updateProgressBar(int par1, int par2) { - super.updateProgressBar(par1, par2); - switch (par1) { - case 100: - this.mTemperature = par2; - break; - case 101: - this.mProcessingEnergy = par2; - break; - case 102: - this.mSteamAmount = par2; - break; - case 103: - this.mWaterAmount = par2; - } - } -} diff --git a/src/main/java/gtPlusPlus/xmod/gregtech/api/gui/CONTAINER_Cyclotron.java b/src/main/java/gtPlusPlus/xmod/gregtech/api/gui/CONTAINER_Cyclotron.java deleted file mode 100644 index f11a943e44..0000000000 --- a/src/main/java/gtPlusPlus/xmod/gregtech/api/gui/CONTAINER_Cyclotron.java +++ /dev/null @@ -1,40 +0,0 @@ -package gtPlusPlus.xmod.gregtech.api.gui; - -import gregtech.api.gui.GT_ContainerMetaTile_Machine; -import gregtech.api.interfaces.tileentity.IGregTechTileEntity; -import net.minecraft.entity.player.InventoryPlayer; - -/** - * NEVER INCLUDE THIS FILE IN YOUR MOD!!! - * <p/> - * The Container I use for all my Basic Machines - */ -public class CONTAINER_Cyclotron extends GT_ContainerMetaTile_Machine { - - public CONTAINER_Cyclotron(final InventoryPlayer aInventoryPlayer, final IGregTechTileEntity aTileEntity) { - - super(aInventoryPlayer, aTileEntity); - } - - public CONTAINER_Cyclotron( - final InventoryPlayer aInventoryPlayer, - final IGregTechTileEntity aTileEntity, - final boolean bindInventory) { - super(aInventoryPlayer, aTileEntity, bindInventory); - } - - @Override - public void addSlots(final InventoryPlayer aInventoryPlayer) { - // this.addSlotToContainer(new Slot(this.mTileEntity, 1, 154, 42)); - } - - @Override - public int getSlotCount() { - return 0; - } - - @Override - public int getShiftClickSlotCount() { - return 0; - } -} diff --git a/src/main/java/gtPlusPlus/xmod/gregtech/api/gui/CONTAINER_DataHatch.java b/src/main/java/gtPlusPlus/xmod/gregtech/api/gui/CONTAINER_DataHatch.java deleted file mode 100644 index 0951c231d5..0000000000 --- a/src/main/java/gtPlusPlus/xmod/gregtech/api/gui/CONTAINER_DataHatch.java +++ /dev/null @@ -1,76 +0,0 @@ -package gtPlusPlus.xmod.gregtech.api.gui; - -import gregtech.api.enums.ItemList; -import gregtech.api.gui.GT_ContainerMetaTile_Machine; -import gregtech.api.interfaces.tileentity.IGregTechTileEntity; -import gtPlusPlus.core.slots.SlotIntegratedCircuit; -import net.minecraft.entity.player.InventoryPlayer; -import net.minecraft.inventory.IInventory; -import net.minecraft.inventory.Slot; -import net.minecraft.item.ItemStack; - -public class CONTAINER_DataHatch extends GT_ContainerMetaTile_Machine { - - public CONTAINER_DataHatch(InventoryPlayer aInventoryPlayer, IGregTechTileEntity aTileEntity) { - super(aInventoryPlayer, aTileEntity); - } - - @Override - public void addSlots(InventoryPlayer aInventoryPlayer) { - addSlotToContainer(new GT_Slot_DataOrb(mTileEntity, 0, 53, 8)); - addSlotToContainer(new GT_Slot_DataOrb(mTileEntity, 1, 71, 8)); - addSlotToContainer(new GT_Slot_DataOrb(mTileEntity, 2, 89, 8)); - addSlotToContainer(new GT_Slot_DataOrb(mTileEntity, 3, 107, 8)); - addSlotToContainer(new GT_Slot_DataOrb(mTileEntity, 4, 53, 26)); - addSlotToContainer(new GT_Slot_DataOrb(mTileEntity, 5, 71, 26)); - addSlotToContainer(new GT_Slot_DataOrb(mTileEntity, 6, 89, 26)); - addSlotToContainer(new GT_Slot_DataOrb(mTileEntity, 7, 107, 26)); - addSlotToContainer(new GT_Slot_DataOrb(mTileEntity, 8, 53, 44)); - addSlotToContainer(new GT_Slot_DataOrb(mTileEntity, 9, 71, 44)); - addSlotToContainer(new GT_Slot_DataOrb(mTileEntity, 10, 89, 44)); - addSlotToContainer(new GT_Slot_DataOrb(mTileEntity, 11, 107, 44)); - addSlotToContainer(new GT_Slot_DataOrb(mTileEntity, 12, 53, 62)); - addSlotToContainer(new GT_Slot_DataOrb(mTileEntity, 13, 71, 62)); - addSlotToContainer(new GT_Slot_DataOrb(mTileEntity, 14, 89, 62)); - addSlotToContainer(new GT_Slot_DataOrb(mTileEntity, 15, 107, 62)); - addSlotToContainer(new SlotIntegratedCircuit(mTileEntity, 16, 19, 35)); - } - - @Override - public int getSlotCount() { - return 17; - } - - @Override - public int getShiftClickSlotCount() { - return 0; - } - - @Override - public void putStackInSlot(int par1, ItemStack par2ItemStack) { - /*Logger.INFO("Slot: "+par1); - if (par1 < 16 && ItemList.Tool_DataOrb.isStackEqual(par2ItemStack)) { - super.putStackInSlot(par1, par2ItemStack); - } - if (par1 == 16 && ItemUtils.isControlCircuit(par2ItemStack)) { - super.putStackInSlot(par1, par2ItemStack); - }*/ - super.putStackInSlot(par1, par2ItemStack); - } - - @Override - public boolean canDragIntoSlot(Slot par1Slot) { - return super.canDragIntoSlot(par1Slot); - } - - public class GT_Slot_DataOrb extends Slot { - public GT_Slot_DataOrb(IInventory par1iInventory, int par2, int par3, int par4) { - super(par1iInventory, par2, par3, par4); - } - - @Override - public boolean isItemValid(ItemStack aStack) { - return ItemList.Tool_DataOrb.isStackEqual(aStack, false, true); - } - } -} diff --git a/src/main/java/gtPlusPlus/xmod/gregtech/api/gui/CONTAINER_DeluxeTank.java b/src/main/java/gtPlusPlus/xmod/gregtech/api/gui/CONTAINER_DeluxeTank.java deleted file mode 100644 index e0698f9d24..0000000000 --- a/src/main/java/gtPlusPlus/xmod/gregtech/api/gui/CONTAINER_DeluxeTank.java +++ /dev/null @@ -1,76 +0,0 @@ -package gtPlusPlus.xmod.gregtech.api.gui; - -import cpw.mods.fml.relauncher.Side; -import cpw.mods.fml.relauncher.SideOnly; -import gregtech.api.gui.GT_Container_BasicTank; -import gregtech.api.gui.GT_Slot_Output; -import gregtech.api.gui.GT_Slot_Render; -import gregtech.api.interfaces.tileentity.IGregTechTileEntity; -import gtPlusPlus.xmod.gregtech.api.metatileentity.implementations.GT_MetaTileEntity_DeluxeTank; -import java.util.Iterator; -import net.minecraft.entity.player.InventoryPlayer; -import net.minecraft.inventory.ICrafting; -import net.minecraft.inventory.Slot; - -/** - * NEVER INCLUDE THIS FILE IN YOUR MOD!!! - * <p/> - * The Container I use for all my Basic Tanks - */ -public class CONTAINER_DeluxeTank extends GT_Container_BasicTank { - - public CONTAINER_DeluxeTank(final InventoryPlayer aInventoryPlayer, final IGregTechTileEntity aTileEntity) { - super(aInventoryPlayer, aTileEntity); - } - - @Override - public void addSlots(final InventoryPlayer aInventoryPlayer) { - this.addSlotToContainer(new Slot(this.mTileEntity, 0, 80, 17)); - this.addSlotToContainer(new GT_Slot_Output(this.mTileEntity, 1, 80, 53)); - this.addSlotToContainer(new GT_Slot_Render(this.mTileEntity, 2, 41, 42)); - this.addSlotToContainer(new GT_Slot_Render(this.mTileEntity, 3, 59, 42)); - } - - @Override - public void detectAndSendChanges() { - super.detectAndSendChanges(); - if (this.mTileEntity.isClientSide() || (this.mTileEntity.getMetaTileEntity() == null)) { - return; - } - if (((GT_MetaTileEntity_DeluxeTank) this.mTileEntity.getMetaTileEntity()).mFluid != null) { - this.mContent = ((GT_MetaTileEntity_DeluxeTank) this.mTileEntity.getMetaTileEntity()).mFluid.amount; - } else { - this.mContent = 0; - } - final Iterator var2 = this.crafters.iterator(); - while (var2.hasNext()) { - final ICrafting var1 = (ICrafting) var2.next(); - var1.sendProgressBarUpdate(this, 100, this.mContent & 65535); - var1.sendProgressBarUpdate(this, 101, this.mContent >>> 16); - } - } - - @Override - @SideOnly(Side.CLIENT) - public void updateProgressBar(final int par1, final int par2) { - super.updateProgressBar(par1, par2); - switch (par1) { - case 100: - this.mContent = (this.mContent & -65536) | par2; - break; - case 101: - this.mContent = (this.mContent & 65535) | (par2 << 16); - break; - } - } - - @Override - public int getSlotCount() { - return 2; - } - - @Override - public int getShiftClickSlotCount() { - return 1; - } -} diff --git a/src/main/java/gtPlusPlus/xmod/gregtech/api/gui/CONTAINER_Hatch_Muffler_Advanced.java b/src/main/java/gtPlusPlus/xmod/gregtech/api/gui/CONTAINER_Hatch_Muffler_Advanced.java deleted file mode 100644 index 9031003349..0000000000 --- a/src/main/java/gtPlusPlus/xmod/gregtech/api/gui/CONTAINER_Hatch_Muffler_Advanced.java +++ /dev/null @@ -1,53 +0,0 @@ -package gtPlusPlus.xmod.gregtech.api.gui; - -import gregtech.api.gui.GT_ContainerMetaTile_Machine; -import gregtech.api.interfaces.tileentity.IGregTechTileEntity; -import gtPlusPlus.core.slots.SlotAirFilter; -import net.minecraft.entity.player.InventoryPlayer; - -public class CONTAINER_Hatch_Muffler_Advanced extends GT_ContainerMetaTile_Machine { - - public long maxEU = 0; - public long storedEU = 0; - - public CONTAINER_Hatch_Muffler_Advanced( - final InventoryPlayer aInventoryPlayer, final IGregTechTileEntity aTileEntity) { - super(aInventoryPlayer, aTileEntity); - } - - public CONTAINER_Hatch_Muffler_Advanced( - final InventoryPlayer aInventoryPlayer, - final IGregTechTileEntity aTileEntity, - final boolean bindInventory) { - super(aInventoryPlayer, aTileEntity, bindInventory); - } - - @Override - public void addSlots(final InventoryPlayer aInventoryPlayer) { - this.addSlotToContainer(new SlotAirFilter(this.mTileEntity, 0, 80, 35)); - } - - @Override - public int getSlotCount() { - return 1; - } - - @Override - public int getShiftClickSlotCount() { - return 1; - } - - @Override - public void updateProgressBar(final int id, final int value) { - super.updateProgressBar(id, value); - switch (id) { - default: - break; - } - } - - @Override - public void detectAndSendChanges() { - super.detectAndSendChanges(); - } -} diff --git a/src/main/java/gtPlusPlus/xmod/gregtech/api/gui/CONTAINER_IndustrialCentrifuge.java b/src/main/java/gtPlusPlus/xmod/gregtech/api/gui/CONTAINER_IndustrialCentrifuge.java deleted file mode 100644 index a24288e877..0000000000 --- a/src/main/java/gtPlusPlus/xmod/gregtech/api/gui/CONTAINER_IndustrialCentrifuge.java +++ /dev/null @@ -1,42 +0,0 @@ -package gtPlusPlus.xmod.gregtech.api.gui; - -import gregtech.api.gui.GT_ContainerMetaTile_Machine; -import gregtech.api.interfaces.tileentity.IGregTechTileEntity; -import net.minecraft.entity.player.InventoryPlayer; -import net.minecraft.inventory.Slot; - -/** - * NEVER INCLUDE THIS FILE IN YOUR MOD!!! - * <p/> - * The Container I use for all my Basic Machines - */ -public class CONTAINER_IndustrialCentrifuge extends GT_ContainerMetaTile_Machine { - - public CONTAINER_IndustrialCentrifuge( - final InventoryPlayer aInventoryPlayer, final IGregTechTileEntity aTileEntity) { - - super(aInventoryPlayer, aTileEntity); - } - - public CONTAINER_IndustrialCentrifuge( - final InventoryPlayer aInventoryPlayer, - final IGregTechTileEntity aTileEntity, - final boolean bindInventory) { - super(aInventoryPlayer, aTileEntity, bindInventory); - } - - @Override - public void addSlots(final InventoryPlayer aInventoryPlayer) { - this.addSlotToContainer(new Slot(this.mTileEntity, 1, 154, 42)); - } - - @Override - public int getSlotCount() { - return 1; - } - - @Override - public int getShiftClickSlotCount() { - return 1; - } -} diff --git a/src/main/java/gtPlusPlus/xmod/gregtech/api/gui/CONTAINER_IronBlastFurnace.java b/src/main/java/gtPlusPlus/xmod/gregtech/api/gui/CONTAINER_IronBlastFurnace.java deleted file mode 100644 index 483a1abc16..0000000000 --- a/src/main/java/gtPlusPlus/xmod/gregtech/api/gui/CONTAINER_IronBlastFurnace.java +++ /dev/null @@ -1,31 +0,0 @@ -package gtPlusPlus.xmod.gregtech.api.gui; - -import gregtech.api.gui.GT_ContainerMetaTile_Machine; -import gregtech.api.gui.GT_Slot_Output; -import gregtech.api.interfaces.tileentity.IGregTechTileEntity; -import net.minecraft.entity.player.InventoryPlayer; -import net.minecraft.inventory.Slot; - -public class CONTAINER_IronBlastFurnace extends GT_ContainerMetaTile_Machine { - public CONTAINER_IronBlastFurnace(final InventoryPlayer aInventoryPlayer, final IGregTechTileEntity aTileEntity) { - super(aInventoryPlayer, aTileEntity); - } - - @Override - public void addSlots(final InventoryPlayer aInventoryPlayer) { - this.addSlotToContainer(new Slot(this.mTileEntity, 0, 34, 16)); - this.addSlotToContainer(new Slot(this.mTileEntity, 1, 34, 34)); - this.addSlotToContainer(new GT_Slot_Output(this.mTileEntity, 2, 86, 25)); - this.addSlotToContainer(new GT_Slot_Output(this.mTileEntity, 3, 104, 25)); - } - - @Override - public int getSlotCount() { - return 4; - } - - @Override - public int getShiftClickSlotCount() { - return 2; - } -} diff --git a/src/main/java/gtPlusPlus/xmod/gregtech/api/gui/CONTAINER_MatterFab.java b/src/main/java/gtPlusPlus/xmod/gregtech/api/gui/CONTAINER_MatterFab.java deleted file mode 100644 index 43996e25c8..0000000000 --- a/src/main/java/gtPlusPlus/xmod/gregtech/api/gui/CONTAINER_MatterFab.java +++ /dev/null @@ -1,104 +0,0 @@ -package gtPlusPlus.xmod.gregtech.api.gui; - -import cpw.mods.fml.relauncher.Side; -import cpw.mods.fml.relauncher.SideOnly; -import gregtech.api.gui.GT_ContainerMetaTile_Machine; -import gregtech.api.interfaces.tileentity.IGregTechTileEntity; -import gtPlusPlus.xmod.gregtech.common.tileentities.machines.multi.production.GregtechMetaTileEntity_MassFabricator; -import java.util.Iterator; -import net.minecraft.entity.player.InventoryPlayer; -import net.minecraft.inventory.ICrafting; - -/** - * NEVER INCLUDE THIS FILE IN YOUR MOD!!! - * <p/> - * The Container I use for all my Basic Machines - */ -public class CONTAINER_MatterFab extends GT_ContainerMetaTile_Machine { - - public int mMatterProduced = 0; - public int mScrapProduced = 0; - public int mAmplifierProduced = 0; - public int mScrapUsed = 0; - public int mAmplifierUsed = 0; - - public CONTAINER_MatterFab(final InventoryPlayer aInventoryPlayer, final IGregTechTileEntity aTileEntity) { - super(aInventoryPlayer, aTileEntity); - } - - public CONTAINER_MatterFab( - final InventoryPlayer aInventoryPlayer, - final IGregTechTileEntity aTileEntity, - final boolean bindInventory) { - super(aInventoryPlayer, aTileEntity, bindInventory); - } - - @Override - public void addSlots(InventoryPlayer aInventoryPlayer) { - // addSlotToContainer(new SlotNoInput(mTileEntity, 1, 152, 5)); - } - - @Override - public int getSlotCount() { - return 0; - } - - @Override - public int getShiftClickSlotCount() { - return 0; - } - - @Override - public void detectAndSendChanges() { - super.detectAndSendChanges(); - if (mTileEntity.isClientSide() || mTileEntity.getMetaTileEntity() == null) { - return; - } - GregtechMetaTileEntity_MassFabricator aTile = - ((GregtechMetaTileEntity_MassFabricator) this.mTileEntity.getMetaTileEntity()); - - mAmplifierProduced = aTile.mAmplifierProduced; - mAmplifierUsed = aTile.mAmplifierUsed; - mMatterProduced = aTile.mMatterProduced; - mScrapProduced = aTile.mScrapProduced; - mScrapUsed = aTile.mScrapUsed; - - Iterator var2 = this.crafters.iterator(); - while (var2.hasNext()) { - ICrafting var1 = (ICrafting) var2.next(); - var1.sendProgressBarUpdate(this, 201, mAmplifierProduced); - var1.sendProgressBarUpdate(this, 202, mAmplifierUsed); - var1.sendProgressBarUpdate(this, 203, mMatterProduced); - var1.sendProgressBarUpdate(this, 204, mScrapProduced); - var1.sendProgressBarUpdate(this, 205, mScrapUsed); - } - } - - @Override - public void addCraftingToCrafters(ICrafting par1ICrafting) { - super.addCraftingToCrafters(par1ICrafting); - } - - @Override - @SideOnly(Side.CLIENT) - public void updateProgressBar(int par1, int par2) { - super.updateProgressBar(par1, par2); - switch (par1) { - case 201: - mAmplifierProduced = (par2); - break; - case 202: - mAmplifierUsed = (par2); - break; - case 203: - mMatterProduced = (par2); - break; - case 204: - mScrapProduced = (par2); - break; - case 205: - mScrapUsed = (par2); - break; - } - } -} diff --git a/src/main/java/gtPlusPlus/xmod/gregtech/api/gui/CONTAINER_MetaTileMachineLong.java b/src/main/java/gtPlusPlus/xmod/gregtech/api/gui/CONTAINER_MetaTileMachineLong.java deleted file mode 100644 index 456d501fdc..0000000000 --- a/src/main/java/gtPlusPlus/xmod/gregtech/api/gui/CONTAINER_MetaTileMachineLong.java +++ /dev/null @@ -1,256 +0,0 @@ -package gtPlusPlus.xmod.gregtech.api.gui; - -import cpw.mods.fml.relauncher.Side; -import cpw.mods.fml.relauncher.SideOnly; -import gregtech.api.gui.GT_Container; -import gregtech.api.interfaces.tileentity.IGregTechTileEntity; -import gregtech.api.util.GT_LanguageManager; -import gtPlusPlus.api.objects.Logger; -import gtPlusPlus.api.objects.data.Pair; -import java.util.Iterator; -import net.minecraft.entity.player.EntityPlayer; -import net.minecraft.entity.player.InventoryPlayer; -import net.minecraft.inventory.ICrafting; - -public class CONTAINER_MetaTileMachineLong extends GT_Container { - - public int mActive = 0, - mMaxProgressTime = 0, - mProgressTime = 0, - mSteam = 0, - mSteamStorage = 0, - mOutput = 0, - mInput = 0, - mID = 0, - mDisplayErrorCode = 0; - private int oActive = 0, - oMaxProgressTime = 0, - oProgressTime = 0, - oSteam = 0, - oSteamStorage = 0, - oOutput = 0, - oInput = 0, - oID = 0, - oDisplayErrorCode = 0, - mTimer = 0; - public long pEnergy, pStorage; - private long nEnergy, nStorage; - public short pIntMaxCountCurrent, pIntMaxCountMax; - private short nIntMaxCountCurrent, nIntMaxCountMax; - - public CONTAINER_MetaTileMachineLong(InventoryPlayer aInventoryPlayer, IGregTechTileEntity aTileEntity) { - super(aInventoryPlayer, aTileEntity); - - mTileEntity = aTileEntity; - - if (mTileEntity != null && mTileEntity.getMetaTileEntity() != null) { - addSlots(aInventoryPlayer); - if (doesBindPlayerInventory()) bindPlayerInventory(aInventoryPlayer); - detectAndSendChanges(); - } else { - aInventoryPlayer.player.openContainer = aInventoryPlayer.player.inventoryContainer; - } - } - - public CONTAINER_MetaTileMachineLong( - InventoryPlayer aInventoryPlayer, IGregTechTileEntity aTileEntity, boolean doesBindInventory) { - super(aInventoryPlayer, aTileEntity); - mTileEntity = aTileEntity; - - if (mTileEntity != null && mTileEntity.getMetaTileEntity() != null) { - addSlots(aInventoryPlayer); - if (doesBindPlayerInventory() && doesBindInventory) bindPlayerInventory(aInventoryPlayer); - detectAndSendChanges(); - } else { - aInventoryPlayer.player.openContainer = aInventoryPlayer.player.inventoryContainer; - } - } - - private Pair<Integer, Integer> getPowerStored() { - final long mStoredPower = this.pEnergy; - long mMaxInts = (mStoredPower / Integer.MAX_VALUE); - long mLeftOver = (mStoredPower % Integer.MAX_VALUE); - if (mMaxInts < 0 || mMaxInts >= /*4294967298L*/ Integer.MAX_VALUE) { - return new Pair<Integer, Integer>(-1, 0); - } - if (mLeftOver < 0 || mLeftOver > Integer.MAX_VALUE) { - mLeftOver = 0; - } - Pair<Integer, Integer> power = new Pair<Integer, Integer>((int) mMaxInts, (int) mLeftOver); - return power; - } - - private Pair<Integer, Integer> getMaxPowerStored() { - final long mMaxStoredPower = this.pStorage; - long mMaxInts = (mMaxStoredPower / Integer.MAX_VALUE); - long mLeftOver = (mMaxStoredPower % Integer.MAX_VALUE); - if (mMaxInts < 0 || mMaxInts >= /*4294967298L*/ Integer.MAX_VALUE) { - return new Pair<Integer, Integer>(-1, 0); - } - if (mLeftOver < 0 || mLeftOver > Integer.MAX_VALUE) { - mLeftOver = 0; - } - Pair<Integer, Integer> power = new Pair<Integer, Integer>((int) mMaxInts, (int) mLeftOver); - return power; - } - - @Override - public void detectAndSendChanges() { - super.detectAndSendChanges(); - if (mTileEntity.isClientSide() || mTileEntity.getMetaTileEntity() == null) return; - pStorage = Math.min(Long.MAX_VALUE, mTileEntity.getEUCapacity()); - pEnergy = Math.min(Long.MAX_VALUE, mTileEntity.getStoredEU()); - mSteamStorage = (int) Math.min(Integer.MAX_VALUE, mTileEntity.getSteamCapacity()); - mSteam = (int) Math.min(Integer.MAX_VALUE, mTileEntity.getStoredSteam()); - mOutput = (int) Math.min(Integer.MAX_VALUE, mTileEntity.getOutputVoltage()); - mInput = (int) Math.min(Integer.MAX_VALUE, mTileEntity.getInputVoltage()); - mDisplayErrorCode = mTileEntity.getErrorDisplayID(); - mProgressTime = mTileEntity.getProgress(); - mMaxProgressTime = mTileEntity.getMaxProgress(); - mActive = mTileEntity.isActive() ? 1 : 0; - mTimer++; - - Pair<Integer, Integer> powerPacket = getPowerStored(); - Pair<Integer, Integer> maxPowerPacket = getMaxPowerStored(); - - int mPacketsToSend = powerPacket.getKey(); - int mLeftOverPowerStored = powerPacket.getValue(); - - int mMaxStorageA = maxPowerPacket.getKey(); - int mMaxStorageB = maxPowerPacket.getValue(); - - // Someone has a VERY FULL power supply. - if (mPacketsToSend == -1) { - Logger.INFO("TOO MUCH MATH - USE BIGINTEGER - GAME BREAKING BUG MAY OCCUR"); - return; - } - - Iterator var2 = this.crafters.iterator(); - while (var2.hasNext()) { - ICrafting var1 = (ICrafting) var2.next(); - if (mTimer % 500 == 10 || nEnergy != pEnergy) { - var1.sendProgressBarUpdate(this, 0, mLeftOverPowerStored & 65535); - var1.sendProgressBarUpdate(this, 1, mLeftOverPowerStored >>> 16); - var1.sendProgressBarUpdate(this, 7730, mPacketsToSend); - } - if (mTimer % 500 == 10 || nStorage != pStorage) { - var1.sendProgressBarUpdate(this, 2, mMaxStorageB & 65535); - var1.sendProgressBarUpdate(this, 3, mMaxStorageB >>> 16); - var1.sendProgressBarUpdate(this, 7731, mMaxStorageA); - } - if (mTimer % 500 == 10 || oOutput != mOutput) { - var1.sendProgressBarUpdate(this, 4, mOutput); - } - if (mTimer % 500 == 10 || oInput != mInput) { - var1.sendProgressBarUpdate(this, 5, mInput); - } - if (mTimer % 500 == 10 || oDisplayErrorCode != mDisplayErrorCode) { - var1.sendProgressBarUpdate(this, 6, mDisplayErrorCode); - } - if (mTimer % 500 == 10 || oProgressTime != mProgressTime) { - var1.sendProgressBarUpdate(this, 11, mProgressTime & 65535); - var1.sendProgressBarUpdate(this, 12, mProgressTime >>> 16); - } - if (mTimer % 500 == 10 || oMaxProgressTime != mMaxProgressTime) { - var1.sendProgressBarUpdate(this, 13, mMaxProgressTime & 65535); - var1.sendProgressBarUpdate(this, 14, mMaxProgressTime >>> 16); - } - if (mTimer % 500 == 10 || oID != mID) { - var1.sendProgressBarUpdate(this, 15, mID); - } - if (mTimer % 500 == 10 || oActive != mActive) { - var1.sendProgressBarUpdate(this, 16, mActive); - } - if (mTimer % 500 == 10 || oSteam != mSteam) { - var1.sendProgressBarUpdate(this, 17, mSteam & 65535); - var1.sendProgressBarUpdate(this, 18, mSteam >>> 16); - } - if (mTimer % 500 == 10 || oSteamStorage != mSteamStorage) { - var1.sendProgressBarUpdate(this, 19, mSteamStorage & 65535); - var1.sendProgressBarUpdate(this, 20, mSteamStorage >>> 16); - } - } - - oID = mID; - oSteam = mSteam; - oInput = mInput; - oActive = mActive; - oOutput = mOutput; - nEnergy = pEnergy; - nStorage = pStorage; - oSteamStorage = mSteamStorage; - oProgressTime = mProgressTime; - oMaxProgressTime = mMaxProgressTime; - oDisplayErrorCode = mDisplayErrorCode; - } - - @SideOnly(Side.CLIENT) - @Override - public void updateProgressBar(int par1, int par2) { - super.updateProgressBar(par1, par2); - switch (par1) { - /*case 7730: - pIntMaxCountCurrent = par2;*/ - case 0: - pEnergy = pEnergy & -65536 | par2; - break; - case 1: - pEnergy = pEnergy & 65535 | par2 << 16; - break; - case 2: - pStorage = pStorage & -65536 | par2; - break; - case 3: - pStorage = pStorage & 65535 | par2 << 16; - break; - case 4: - mOutput = par2; - break; - case 5: - mInput = par2; - break; - case 6: - mDisplayErrorCode = par2; - break; - case 11: - mProgressTime = mProgressTime & -65536 | par2; - break; - case 12: - mProgressTime = mProgressTime & 65535 | par2 << 16; - break; - case 13: - mMaxProgressTime = mMaxProgressTime & -65536 | par2; - break; - case 14: - mMaxProgressTime = mMaxProgressTime & 65535 | par2 << 16; - break; - case 15: - mID = par2; - break; - case 16: - mActive = par2; - break; - case 17: - mSteam = mSteam & -65536 | par2; - break; - case 18: - mSteam = mSteam & 65535 | par2 << 16; - break; - case 19: - mSteamStorage = mSteamStorage & -65536 | par2; - break; - case 20: - mSteamStorage = mSteamStorage & 65535 | par2 << 16; - break; - } - } - - @Override - public boolean canInteractWith(EntityPlayer player) { - return mTileEntity.isUseableByPlayer(player); - } - - public String trans(String aKey, String aEnglish) { - return GT_LanguageManager.addStringLocalization("Interaction_DESCRIPTION_Index_" + aKey, aEnglish, false); - } -} diff --git a/src/main/java/gtPlusPlus/xmod/gregtech/api/gui/CONTAINER_MultiMachine.java b/src/main/java/gtPlusPlus/xmod/gregtech/api/gui/CONTAINER_MultiMachine.java deleted file mode 100644 index fd4aff592e..0000000000 --- a/src/main/java/gtPlusPlus/xmod/gregtech/api/gui/CONTAINER_MultiMachine.java +++ /dev/null @@ -1,286 +0,0 @@ -package gtPlusPlus.xmod.gregtech.api.gui; - -import cpw.mods.fml.relauncher.Side; -import cpw.mods.fml.relauncher.SideOnly; -import gregtech.api.gui.GT_ContainerMetaTile_Machine; -import gregtech.api.interfaces.metatileentity.IMetaTileEntity; -import gregtech.api.interfaces.tileentity.IGregTechTileEntity; -import gregtech.api.util.GT_Recipe; -import gtPlusPlus.api.objects.Logger; -import gtPlusPlus.core.util.math.MathUtils; -import gtPlusPlus.core.util.reflect.ReflectionUtils; -import gtPlusPlus.xmod.gregtech.api.metatileentity.implementations.base.GregtechMeta_MultiBlockBase; -import java.lang.reflect.Field; -import java.util.ArrayList; -import java.util.List; -import net.minecraft.entity.player.InventoryPlayer; -import net.minecraft.inventory.Container; -import net.minecraft.inventory.ICrafting; - -/** - * NEVER INCLUDE THIS FILE IN YOUR MOD!!! - * <p/> - * The Container I use for all my Basic Machines - */ -public class CONTAINER_MultiMachine extends GT_ContainerMetaTile_Machine { - - public String[] mTileDescription; - private String[] oTileDescription; - - private GregtechMeta_MultiBlockBase mMCTEI; - private boolean mControllerSet = false; - - public CONTAINER_MultiMachine(final InventoryPlayer aInventoryPlayer, final IGregTechTileEntity aTileEntity) { - super(aInventoryPlayer, aTileEntity); - } - - public CONTAINER_MultiMachine( - final InventoryPlayer aInventoryPlayer, - final IGregTechTileEntity aTileEntity, - final boolean bindInventory) { - super(aInventoryPlayer, aTileEntity, bindInventory); - } - - public static void setControllerInstance(CONTAINER_MultiMachine aContainer, IGregTechTileEntity aTile) { - if (aTile == null) { - return; - } - final IMetaTileEntity aMetaTileEntity = aTile.getMetaTileEntity(); - if (aMetaTileEntity == null) { - return; - } - if (aMetaTileEntity instanceof GregtechMeta_MultiBlockBase) { - aContainer.mMCTEI = (GregtechMeta_MultiBlockBase) aMetaTileEntity; - } - } - - public int aTotalTickTime = 0; - public int aMaxParallel = 0; - public int aPollutionTick = 0; - public int aMaxInputVoltage = 0; - public int aInputTier = 0; - public int aOutputTier = 0; - public int aRecipeDuration = 0; - public int aRecipeEU = 0; - public int aRecipeSpecial = 0; - public int aPollutionReduction = 0; - public int aStoredEnergy = 0; - public int aMaxEnergy = 0; - public int aEfficiency = 0; - - private int oTotalTickTime = 0; - private int oMaxParallel = 0; - private int oPollutionTick = 0; - private int oMaxInputVoltage = 0; - private int oInputTier = 0; - private int oOutputTier = 0; - private int oRecipeDuration = 0; - private int oRecipeEU = 0; - private int oRecipeSpecial = 0; - private int oPollutionReduction = 0; - private int oStoredEnergy = 0; - private int oMaxEnergy = 0; - private int oEfficiency = 0; - - private static Field timer; - // private static Field crafters; - - @Override - public final void detectAndSendChanges() { - super.detectAndSendChanges(); - if (this.mTileEntity.isClientSide() || this.mTileEntity.getMetaTileEntity() == null) { - return; - } - if (!mControllerSet) { - setControllerInstance(this, this.mTileEntity); - } - mControllerSet = (mMCTEI != null); - if (timer == null) { - timer = ReflectionUtils.getField(getClass(), "mTimer"); - } - if (crafters == null) { - // crafters = ReflectionUtils.getField(getClass(), "crafters"); - } - if (timer != null && crafters != null && mControllerSet) { - // Logger.INFO("Trying to update clientside GUI data"); - try { - // Logger.INFO("0"); - int aTimer = (int) ReflectionUtils.getFieldValue(timer, this); - - // List crafters1List = (List) crafters1; - List<ICrafting> crafters2 = new ArrayList<ICrafting>(); - // Logger.INFO("1"); - for (Object o : crafters) { - if (o instanceof ICrafting) { - crafters2.add((ICrafting) o); - } - } - // Logger.INFO("2"); - if (!crafters2.isEmpty()) { - // Logger.INFO("3"); - handleInitialFieldSetting(); - - try { - // Logger.INFO("4"); - for (final ICrafting var3 : crafters2) { - handleCraftingEvent(aTimer, var3); - } - // Logger.INFO("5"); - handleInternalFieldSetting(); - // Logger.INFO("6"); - } catch (Throwable t) { - - } - } - } catch (Throwable t) { - t.printStackTrace(); - } - } else { - Logger.INFO("Failed."); - } - } - - public void handleInitialFieldSetting() { - this.aTotalTickTime = - MathUtils.balance((int) mMCTEI.getTotalRuntimeInTicks(), Integer.MIN_VALUE, Integer.MAX_VALUE); - this.aMaxParallel = mMCTEI.getMaxParallelRecipes(); - this.aPollutionTick = mMCTEI.getPollutionPerTick(null); - this.aMaxInputVoltage = - MathUtils.balance((int) mMCTEI.getMaxInputVoltage(), Integer.MIN_VALUE, Integer.MAX_VALUE); - this.aInputTier = MathUtils.balance((int) mMCTEI.getInputTier(), Integer.MIN_VALUE, Integer.MAX_VALUE); - this.aOutputTier = MathUtils.balance((int) mMCTEI.getOutputTier(), Integer.MIN_VALUE, Integer.MAX_VALUE); - if (mMCTEI.mLastRecipe != null) { - GT_Recipe aRecipe = mMCTEI.mLastRecipe; - this.aRecipeDuration = MathUtils.balance(aRecipe.mDuration, Integer.MIN_VALUE, Integer.MAX_VALUE); - this.aRecipeEU = MathUtils.balance(aRecipe.mEUt, Integer.MIN_VALUE, Integer.MAX_VALUE); - this.aRecipeSpecial = MathUtils.balance(aRecipe.mSpecialValue, Integer.MIN_VALUE, Integer.MAX_VALUE); - } - this.aPollutionReduction = mMCTEI.getPollutionReductionForAllMufflers(); - - this.aStoredEnergy = MathUtils.balance( - (int) mMCTEI.getStoredEnergyInAllEnergyHatches(), Integer.MIN_VALUE, Integer.MAX_VALUE); - this.aMaxEnergy = MathUtils.balance( - (int) mMCTEI.getMaxEnergyStorageOfAllEnergyHatches(), Integer.MIN_VALUE, Integer.MAX_VALUE); - this.aEfficiency = MathUtils.balance(mMCTEI.mEfficiency, Integer.MIN_VALUE, Integer.MAX_VALUE); - } - - public void handleCraftingEvent(int aTimer, ICrafting aCrafter) { - int aID = 750; - if (aTimer % 500 == 10 || this.oTotalTickTime != this.aTotalTickTime) { - aCrafter.sendProgressBarUpdate((Container) this, aID++, this.aTotalTickTime); - } - if (aTimer % 500 == 10 || this.oMaxParallel != this.aMaxParallel) { - aCrafter.sendProgressBarUpdate((Container) this, aID++, this.aMaxParallel); - } - if (aTimer % 500 == 10 || this.oPollutionTick != this.aPollutionTick) { - aCrafter.sendProgressBarUpdate((Container) this, aID++, this.aPollutionTick); - } - if (aTimer % 500 == 10 || this.oMaxInputVoltage != this.aMaxInputVoltage) { - aCrafter.sendProgressBarUpdate((Container) this, aID++, this.aMaxInputVoltage); - } - if (aTimer % 500 == 10 || this.oInputTier != this.aInputTier) { - aCrafter.sendProgressBarUpdate((Container) this, aID++, this.aInputTier); - } - if (aTimer % 500 == 10 || this.oOutputTier != this.aOutputTier) { - aCrafter.sendProgressBarUpdate((Container) this, aID++, this.aOutputTier); - } - if (aTimer % 500 == 10 || this.oRecipeDuration != this.aRecipeDuration) { - aCrafter.sendProgressBarUpdate((Container) this, aID++, this.aRecipeDuration); - } - if (aTimer % 500 == 10 || this.oRecipeEU != this.aRecipeEU) { - aCrafter.sendProgressBarUpdate((Container) this, aID++, this.aRecipeEU); - } - if (aTimer % 500 == 10 || this.oRecipeSpecial != this.aRecipeSpecial) { - aCrafter.sendProgressBarUpdate((Container) this, aID++, this.aRecipeSpecial); - } - if (aTimer % 500 == 10 || this.oPollutionReduction != this.aPollutionReduction) { - aCrafter.sendProgressBarUpdate((Container) this, aID++, this.aPollutionReduction); - } - if (aTimer % 500 == 10 || this.oStoredEnergy != this.aStoredEnergy) { - aCrafter.sendProgressBarUpdate((Container) this, aID++, this.aStoredEnergy); - } - if (aTimer % 500 == 10 || this.oMaxEnergy != this.aMaxEnergy) { - aCrafter.sendProgressBarUpdate((Container) this, aID++, this.aMaxEnergy); - } - if (aTimer % 500 == 10 || this.oEfficiency != this.aEfficiency) { - aCrafter.sendProgressBarUpdate((Container) this, aID++, this.aEfficiency); - } - } - - public void handleInternalFieldSetting() { - this.oTotalTickTime = this.aTotalTickTime; - this.oMaxParallel = this.aMaxParallel; - this.oPollutionTick = this.aPollutionTick; - this.oMaxInputVoltage = this.aMaxInputVoltage; - this.oInputTier = this.aInputTier; - this.oOutputTier = this.aOutputTier; - this.oRecipeDuration = this.aRecipeDuration; - this.oRecipeEU = this.aRecipeEU; - this.oRecipeSpecial = this.aRecipeSpecial; - this.oPollutionReduction = this.aPollutionReduction; - this.oStoredEnergy = this.aStoredEnergy; - this.oMaxEnergy = this.aMaxEnergy; - this.oEfficiency = this.aEfficiency; - } - - @SideOnly(Side.CLIENT) - @Override - public void updateProgressBar(final int par1, final int par2) { - super.updateProgressBar(par1, par2); - int shiftedSwitch = par1 - 750; - switch (shiftedSwitch) { - case 0: { - this.aTotalTickTime = par2; - break; - } - case 1: { - this.aMaxParallel = par2; - break; - } - case 2: { - this.aPollutionTick = par2; - break; - } - case 3: { - this.aMaxInputVoltage = par2; - break; - } - case 4: { - this.aInputTier = par2; - break; - } - case 5: { - this.aOutputTier = par2; - break; - } - case 6: { - this.aRecipeDuration = par2; - break; - } - case 7: { - this.aRecipeEU = par2; - break; - } - case 8: { - this.aRecipeSpecial = par2; - break; - } - case 9: { - this.aPollutionReduction = par2; - break; - } - case 10: { - this.aStoredEnergy = par2; - break; - } - case 11: { - this.aMaxEnergy = par2; - break; - } - case 12: { - this.aEfficiency = par2; - break; - } - } - } -} diff --git a/src/main/java/gtPlusPlus/xmod/gregtech/api/gui/CONTAINER_MultiMachine_NoPlayerInventory.java b/src/main/java/gtPlusPlus/xmod/gregtech/api/gui/CONTAINER_MultiMachine_NoPlayerInventory.java deleted file mode 100644 index 579e0a7e1d..0000000000 --- a/src/main/java/gtPlusPlus/xmod/gregtech/api/gui/CONTAINER_MultiMachine_NoPlayerInventory.java +++ /dev/null @@ -1,31 +0,0 @@ -package gtPlusPlus.xmod.gregtech.api.gui; - -import gregtech.api.interfaces.tileentity.IGregTechTileEntity; -import net.minecraft.entity.player.EntityPlayer; -import net.minecraft.entity.player.InventoryPlayer; -import net.minecraft.item.ItemStack; - -public class CONTAINER_MultiMachine_NoPlayerInventory extends CONTAINER_MultiMachine { - - public CONTAINER_MultiMachine_NoPlayerInventory( - final InventoryPlayer aInventoryPlayer, final IGregTechTileEntity aTileEntity) { - super(aInventoryPlayer, aTileEntity); - } - - public CONTAINER_MultiMachine_NoPlayerInventory( - final InventoryPlayer aInventoryPlayer, - final IGregTechTileEntity aTileEntity, - final boolean bindInventory) { - super(aInventoryPlayer, aTileEntity, bindInventory); - } - - public boolean doesBindPlayerInventory() { - return false; - } - - @Override - public ItemStack slotClick( - final int aSlotIndex, final int aMouseclick, final int aShifthold, final EntityPlayer aPlayer) { - return null; - } -} diff --git a/src/main/java/gtPlusPlus/xmod/gregtech/api/gui/CONTAINER_PowerSubStation.java b/src/main/java/gtPlusPlus/xmod/gregtech/api/gui/CONTAINER_PowerSubStation.java deleted file mode 100644 index f975539b83..0000000000 --- a/src/main/java/gtPlusPlus/xmod/gregtech/api/gui/CONTAINER_PowerSubStation.java +++ /dev/null @@ -1,85 +0,0 @@ -package gtPlusPlus.xmod.gregtech.api.gui; - -import cpw.mods.fml.relauncher.Side; -import cpw.mods.fml.relauncher.SideOnly; -import gregtech.api.gui.GT_Container_MultiMachine; -import gregtech.api.interfaces.tileentity.IGregTechTileEntity; -import gtPlusPlus.core.slots.SlotNoInput; -import gtPlusPlus.xmod.gregtech.common.tileentities.machines.multi.storage.GregtechMetaTileEntity_PowerSubStationController; -import net.minecraft.entity.player.InventoryPlayer; -import net.minecraft.inventory.*; - -public class CONTAINER_PowerSubStation extends GT_Container_MultiMachine { - private final SyncedValueManager manager = new SyncedValueManager(21); - public final SyncedLong mStoredEU = manager.allocateLong(); - public final SyncedLong mMaxStoredEU = manager.allocateLong(); - public final SyncedLong mAverageEuAdded = manager.allocateLong(); - public final SyncedLong mAverageEuConsumed = manager.allocateLong(); - - public CONTAINER_PowerSubStation(final InventoryPlayer aInventoryPlayer, final IGregTechTileEntity aTileEntity) { - super(aInventoryPlayer, aTileEntity); - } - - public CONTAINER_PowerSubStation( - final InventoryPlayer aInventoryPlayer, - final IGregTechTileEntity aTileEntity, - final boolean bindInventory) { - super(aInventoryPlayer, aTileEntity, bindInventory); - } - - public void addSlots(final InventoryPlayer aInventoryPlayer) { - this.addSlotToContainer(new Slot(this.mTileEntity, 1, 155, 5)); - this.addSlotToContainer(new SlotNoInput(this.mTileEntity, 2, 155, 23)); - - for (int i = 0; i < 9; ++i) { - this.addSlotToContainer(new Slot(aInventoryPlayer, i, 8 + i * 18, 167)); - } - } - - @Override - public boolean doesBindPlayerInventory() { - return false; - } - - public int getSlotCount() { - return 10; - } - - public int getShiftClickSlotCount() { - return 1; - } - - @Override - public void detectAndSendChanges() { - super.detectAndSendChanges(); - - if (manager == null) - // maybe not yet initialized - // stupid java - // ask greg why he wants to call a method that's definitely going to be overridden in subclass in - // constructor - return; - - GregtechMetaTileEntity_PowerSubStationController aPSS = - (GregtechMetaTileEntity_PowerSubStationController) mTileEntity.getMetaTileEntity(); - mStoredEU.setValue(mTileEntity.getStoredEU()); - mMaxStoredEU.setValue(mTileEntity.getEUCapacity()); - mAverageEuAdded.setValue(aPSS.getAverageEuAdded()); - mAverageEuConsumed.setValue(aPSS.getAverageEuConsumed()); - - manager.detectAndSendChanges(this::sendProgressBarUpdate, mTimer); - } - - @SideOnly(Side.CLIENT) - @Override - public void updateProgressBar(int par1, int par2) { - super.updateProgressBar(par1, par2); - manager.updateProgressBar(par1, par2); - } - - private void sendProgressBarUpdate(int short1, int short2) { - for (Object crafter : this.crafters) { - ((ICrafting) crafter).sendProgressBarUpdate(this, short1, short2); - } - } -} diff --git a/src/main/java/gtPlusPlus/xmod/gregtech/api/gui/CONTAINER_SafeBlock.java b/src/main/java/gtPlusPlus/xmod/gregtech/api/gui/CONTAINER_SafeBlock.java deleted file mode 100644 index e317583413..0000000000 --- a/src/main/java/gtPlusPlus/xmod/gregtech/api/gui/CONTAINER_SafeBlock.java +++ /dev/null @@ -1,118 +0,0 @@ -package gtPlusPlus.xmod.gregtech.api.gui; - -import gregtech.api.gui.GT_ContainerMetaTile_Machine; -import gregtech.api.gui.GT_Slot_Holo; -import gregtech.api.interfaces.tileentity.IGregTechTileEntity; -import gtPlusPlus.core.util.player.PlayerCache; -import gtPlusPlus.xmod.gregtech.common.tileentities.storage.GregtechMetaSafeBlock; -import java.util.UUID; -import net.minecraft.entity.player.EntityPlayer; -import net.minecraft.entity.player.InventoryPlayer; -import net.minecraft.inventory.Slot; -import net.minecraft.item.ItemStack; - -public class CONTAINER_SafeBlock extends GT_ContainerMetaTile_Machine { - public CONTAINER_SafeBlock(final InventoryPlayer aInventoryPlayer, final IGregTechTileEntity aTileEntity) { - super(aInventoryPlayer, aTileEntity); - } - - // public String UUID = - // ((BaseMetaTileEntity)mTileEntity).getMetaTileEntity().getBaseMetaTileEntity().getOwnerName(); - public UUID ownerUUID = ((GregtechMetaSafeBlock) this.mTileEntity.getMetaTileEntity()).ownerUUID; - public String tempPlayer = PlayerCache.lookupPlayerByUUID(this.ownerUUID); - public boolean blockStatus = ((GregtechMetaSafeBlock) this.mTileEntity.getMetaTileEntity()).bUnbreakable; - - @Override - public void addSlots(final InventoryPlayer aInventoryPlayer) { - for (int y = 0; y < 3; y++) { - for (int x = 0; x < 9; x++) { - this.addSlotToContainer(new Slot(this.mTileEntity, x + (y * 9), 8 + (x * 18), 5 + (y * 18))); - } - } - this.addSlotToContainer(new GT_Slot_Holo(this.mTileEntity, 27, 8, 63, false, true, 1)); - this.addSlotToContainer(new GT_Slot_Holo(this.mTileEntity, 27, 26, 63, false, true, 1)); - this.addSlotToContainer(new GT_Slot_Holo(this.mTileEntity, 27, 44, 63, false, true, 1)); - } - - @Override - public ItemStack slotClick( - final int aSlotIndex, final int aMouseclick, final int aShifthold, final EntityPlayer aPlayer) { - final int runs = 0; - if (aSlotIndex < 27) { - return super.slotClick(aSlotIndex, aMouseclick, aShifthold, aPlayer); - } - final Slot tSlot = (Slot) this.inventorySlots.get(aSlotIndex); - if (tSlot != null) { - if (this.mTileEntity.getMetaTileEntity() == null) { - return null; - } - if (aSlotIndex == 27) { - - /*((GregtechMetaSafeBlock) this.mTileEntity.getMetaTileEntity()).bOutput = (!((GregtechMetaSafeBlock) this.mTileEntity.getMetaTileEntity()).bOutput); - if (((GregtechMetaSafeBlock) this.mTileEntity.getMetaTileEntity()).bOutput) { - if (aPlayer != null && aPlayer instanceof EntityPlayerMP && (((GregtechMetaSafeBlock)this.mTileEntity.getMetaTileEntity()).bOutput != false)) { - - Utils.LOG_INFO(String.valueOf(Sys.is64Bit())); - Utils.messagePlayer(aPlayer, "Salmon"); - } - - GT_Utility.sendChatToPlayer(aPlayer, "Emit Energy to Outputside"); - } else { - GT_Utility.sendChatToPlayer(aPlayer, "Don't emit Energy"); - } - return null;*/ - - } - if (aSlotIndex == 28) {} - /* ((GregtechMetaSafeBlock) this.mTileEntity.getMetaTileEntity()).bRedstoneIfFull = (!((GregtechMetaSafeBlock) this.mTileEntity.getMetaTileEntity()).bRedstoneIfFull); - if (((GregtechMetaSafeBlock) this.mTileEntity.getMetaTileEntity()).bRedstoneIfFull) { - GT_Utility.sendChatToPlayer(aPlayer, "Emit Redstone if no Slot is free"); - } else { - GT_Utility.sendChatToPlayer(aPlayer, "Don't emit Redstone"); - } - return null; - }*/ - if (aSlotIndex == 29) /*{ - if (((GregtechMetaSafeBlock) this.mTileEntity.getMetaTileEntity()).bUnbreakable) { - if (((GregtechMetaSafeBlock) this.mTileEntity.getMetaTileEntity()).bUnbreakable) { - makeIndestructible(aPlayer); - } - else { - - } - } else { - makeIndestructible(aPlayer); - } - return null; - }*/ { - - ((GregtechMetaSafeBlock) this.mTileEntity.getMetaTileEntity()).bUnbreakable = - (!((GregtechMetaSafeBlock) this.mTileEntity.getMetaTileEntity()).bUnbreakable); - this.blockStatus = ((GregtechMetaSafeBlock) this.mTileEntity.getMetaTileEntity()).bUnbreakable; - this.ownerUUID = ((GregtechMetaSafeBlock) this.mTileEntity.getMetaTileEntity()).ownerUUID; - // Utils.messagePlayer(aPlayer, "Is the safe locked? "+String.valueOf(((GregtechMetaSafeBlock) - // this.mTileEntity.getMetaTileEntity()).bUnbreakable).toUpperCase()); - /*if (aPlayer != null && aPlayer instanceof EntityPlayerMP && (((GregtechMetaSafeBlock)this.mTileEntity.getMetaTileEntity()).bUnbreakable != false)) { - UnbreakableBlockManager Xasda = new UnbreakableBlockManager(); - Xasda.setmTileEntity((BaseMetaTileEntity) mTileEntity, aPlayer); - } - else { - UnbreakableBlockManager Xasda = new UnbreakableBlockManager(); - Xasda.setmTileEntity((BaseMetaTileEntity) mTileEntity, aPlayer); - }*/ - return null; - } - } - return super.slotClick(aSlotIndex, aMouseclick, aShifthold, aPlayer); - } - - @Override - public int getSlotCount() { - return 27; - } - - @Override - public int getShiftClickSlotCount() { - return 27; - } -} diff --git a/src/main/java/gtPlusPlus/xmod/gregtech/api/gui/CONTAINER_SolarGenerator.java b/src/main/java/gtPlusPlus/xmod/gregtech/api/gui/CONTAINER_SolarGenerator.java deleted file mode 100644 index 93ba937f45..0000000000 --- a/src/main/java/gtPlusPlus/xmod/gregtech/api/gui/CONTAINER_SolarGenerator.java +++ /dev/null @@ -1,90 +0,0 @@ -package gtPlusPlus.xmod.gregtech.api.gui; - -import cpw.mods.fml.relauncher.Side; -import cpw.mods.fml.relauncher.SideOnly; -import gregtech.api.gui.GT_ContainerMetaTile_Machine; -import gregtech.api.interfaces.tileentity.IGregTechTileEntity; -import gtPlusPlus.xmod.gregtech.common.tileentities.generators.GregtechMetaTileEntitySolarGenerator; -import java.util.Iterator; -import net.minecraft.entity.player.InventoryPlayer; -import net.minecraft.inventory.ICrafting; - -public class CONTAINER_SolarGenerator extends GT_ContainerMetaTile_Machine { - public int mWaterAmount = 0; - public int mSteamAmount = 0; - public int mProcessingEnergy = 0; - public int mTemperature = 2; - - public CONTAINER_SolarGenerator(final InventoryPlayer aInventoryPlayer, final IGregTechTileEntity aTileEntity) { - super(aInventoryPlayer, aTileEntity); - } - - @Override - public void addSlots(final InventoryPlayer aInventoryPlayer) { - // addSlotToContainer(new Slot(this.mTileEntity, 2, 116, 62)); - // addSlotToContainer(new Slot(this.mTileEntity, 0, 44, 26)); - // addSlotToContainer(new Slot(this.mTileEntity, 1, 44, 62)); - // addSlotToContainer(new Slot(this.mTileEntity, 3, 116, 26)); - } - - @Override - public int getSlotCount() { - return 0; - } - - @Override - public int getShiftClickSlotCount() { - return 0; - } - - @Override - public void detectAndSendChanges() { - super.detectAndSendChanges(); - if ((this.mTileEntity.isClientSide()) || (this.mTileEntity.getMetaTileEntity() == null)) { - return; - } - this.mTemperature = ((GregtechMetaTileEntitySolarGenerator) this.mTileEntity.getMetaTileEntity()).mSolarCharge; - this.mProcessingEnergy = - ((GregtechMetaTileEntitySolarGenerator) this.mTileEntity.getMetaTileEntity()).mProcessingEnergy; - - this.mTemperature = Math.min( - 54, - Math.max( - 0, - (this.mTemperature * 54) - / (((GregtechMetaTileEntitySolarGenerator) this.mTileEntity.getMetaTileEntity()) - .maxProgresstime() - - 10))); - this.mEnergy = (int) Math.min(Integer.MAX_VALUE, this.mTileEntity.getStoredEU()); - this.mProcessingEnergy = - Math.min(14, Math.max(this.mProcessingEnergy > 0 ? 1 : 0, (this.mProcessingEnergy * 14) / 1000)); - - final Iterator var2 = this.crafters.iterator(); - while (var2.hasNext()) { - final ICrafting var1 = (ICrafting) var2.next(); - var1.sendProgressBarUpdate(this, 100, this.mTemperature); - var1.sendProgressBarUpdate(this, 101, this.mProcessingEnergy); - var1.sendProgressBarUpdate(this, 102, this.mSteamAmount); - var1.sendProgressBarUpdate(this, 103, this.mWaterAmount); - } - } - - @Override - @SideOnly(Side.CLIENT) - public void updateProgressBar(final int par1, final int par2) { - super.updateProgressBar(par1, par2); - switch (par1) { - case 100: - this.mTemperature = par2; - break; - case 101: - this.mProcessingEnergy = par2; - break; - case 102: - this.mSteamAmount = par2; - break; - case 103: - this.mWaterAmount = par2; - } - } -} diff --git a/src/main/java/gtPlusPlus/xmod/gregtech/api/gui/CONTAINER_SteamCondenser.java b/src/main/java/gtPlusPlus/xmod/gregtech/api/gui/CONTAINER_SteamCondenser.java deleted file mode 100644 index 361f24c4a1..0000000000 --- a/src/main/java/gtPlusPlus/xmod/gregtech/api/gui/CONTAINER_SteamCondenser.java +++ /dev/null @@ -1,100 +0,0 @@ -package gtPlusPlus.xmod.gregtech.api.gui; - -import cpw.mods.fml.relauncher.Side; -import cpw.mods.fml.relauncher.SideOnly; -import gregtech.api.gui.GT_ContainerMetaTile_Machine; -import gregtech.api.interfaces.tileentity.IGregTechTileEntity; -import gtPlusPlus.xmod.gregtech.api.metatileentity.implementations.base.generators.GregtechMetaBoilerBase; -import java.util.Iterator; -import net.minecraft.entity.player.InventoryPlayer; -import net.minecraft.inventory.ICrafting; -import net.minecraft.inventory.Slot; - -public class CONTAINER_SteamCondenser extends GT_ContainerMetaTile_Machine { - public CONTAINER_SteamCondenser(final InventoryPlayer aInventoryPlayer, final IGregTechTileEntity aTileEntity) { - super(aInventoryPlayer, aTileEntity); - } - - @Override - public void addSlots(final InventoryPlayer aInventoryPlayer) { - this.addSlotToContainer(new Slot(this.mTileEntity, 2, 116, 62)); - this.addSlotToContainer(new Slot(this.mTileEntity, 0, 44, 26)); - this.addSlotToContainer(new Slot(this.mTileEntity, 1, 44, 62)); - this.addSlotToContainer(new Slot(this.mTileEntity, 3, 116, 26)); - } - - @Override - public int getSlotCount() { - return 4; - } - - @Override - public int getShiftClickSlotCount() { - return 1; - } - - public int mWaterAmount = 0; - public int mSteamAmount = 0; - public int mProcessingEnergy = 0; - public int mTemperature = 2; - public long mTickingTime = ((GregtechMetaBoilerBase) this.mTileEntity.getMetaTileEntity()).RI; - - @Override - public void detectAndSendChanges() { - super.detectAndSendChanges(); - if ((this.mTileEntity.isClientSide()) || (this.mTileEntity.getMetaTileEntity() == null)) { - return; - } - int steamCapacity = ((GregtechMetaBoilerBase) this.mTileEntity.getMetaTileEntity()).getSteamCapacity(); - int waterCapacity = ((GregtechMetaBoilerBase) this.mTileEntity.getMetaTileEntity()).getCapacity(); - this.mTemperature = ((GregtechMetaBoilerBase) this.mTileEntity.getMetaTileEntity()).mTemperature; - this.mProcessingEnergy = ((GregtechMetaBoilerBase) this.mTileEntity.getMetaTileEntity()).mProcessingEnergy; - this.mSteamAmount = (((GregtechMetaBoilerBase) this.mTileEntity.getMetaTileEntity()).mSteam == null - ? 0 - : ((GregtechMetaBoilerBase) this.mTileEntity.getMetaTileEntity()).mSteam.amount); - this.mWaterAmount = (((GregtechMetaBoilerBase) this.mTileEntity.getMetaTileEntity()).mFluid == null - ? 0 - : ((GregtechMetaBoilerBase) this.mTileEntity.getMetaTileEntity()).mFluid.amount); - this.mTickingTime = ((GregtechMetaBoilerBase) this.mTileEntity.getMetaTileEntity()).RI; - - this.mTemperature = Math.min( - 54, - Math.max( - 0, - (this.mTemperature * 54) - / (((GregtechMetaBoilerBase) this.mTileEntity.getMetaTileEntity()).maxProgresstime() - - 10))); - this.mSteamAmount = Math.min(54, Math.max(0, (this.mSteamAmount * 54) / (steamCapacity - 100))); - this.mWaterAmount = Math.min(54, Math.max(0, (this.mWaterAmount * 54) / (waterCapacity - 100))); - this.mProcessingEnergy = - Math.min(14, Math.max(this.mProcessingEnergy > 0 ? 1 : 0, (this.mProcessingEnergy * 14) / 1000)); - - final Iterator var2 = this.crafters.iterator(); - while (var2.hasNext()) { - final ICrafting var1 = (ICrafting) var2.next(); - var1.sendProgressBarUpdate(this, 100, this.mTemperature); - var1.sendProgressBarUpdate(this, 101, this.mProcessingEnergy); - var1.sendProgressBarUpdate(this, 102, this.mSteamAmount); - var1.sendProgressBarUpdate(this, 103, this.mWaterAmount); - } - } - - @Override - @SideOnly(Side.CLIENT) - public void updateProgressBar(final int par1, final int par2) { - super.updateProgressBar(par1, par2); - switch (par1) { - case 100: - this.mTemperature = par2; - break; - case 101: - this.mProcessingEnergy = par2; - break; - case 102: - this.mSteamAmount = par2; - break; - case 103: - this.mWaterAmount = par2; - } - } -} diff --git a/src/main/java/gtPlusPlus/xmod/gregtech/api/gui/CONTAINER_SuperChest.java b/src/main/java/gtPlusPlus/xmod/gregtech/api/gui/CONTAINER_SuperChest.java deleted file mode 100644 index 65d4e46069..0000000000 --- a/src/main/java/gtPlusPlus/xmod/gregtech/api/gui/CONTAINER_SuperChest.java +++ /dev/null @@ -1,75 +0,0 @@ -package gtPlusPlus.xmod.gregtech.api.gui; - -import cpw.mods.fml.relauncher.Side; -import cpw.mods.fml.relauncher.SideOnly; -import gregtech.api.gui.GT_ContainerMetaTile_Machine; -import gregtech.api.gui.GT_Slot_Output; -import gregtech.api.gui.GT_Slot_Render; -import gregtech.api.interfaces.tileentity.IGregTechTileEntity; -import gtPlusPlus.core.slots.SlotLockedInput; -import gtPlusPlus.xmod.gregtech.common.tileentities.storage.GT_MetaTileEntity_TieredChest; -import gtPlusPlus.xmod.gregtech.common.tileentities.storage.shelving.GT4Entity_Shelf_Large; -import java.util.Iterator; -import net.minecraft.entity.player.InventoryPlayer; -import net.minecraft.inventory.ICrafting; -import net.minecraft.item.ItemStack; - -public class CONTAINER_SuperChest extends GT_ContainerMetaTile_Machine { - - public int mContent = 0; - private ItemStack mLockedSlotStack = null; - - public CONTAINER_SuperChest(InventoryPlayer aInventoryPlayer, IGregTechTileEntity aTileEntity) { - super(aInventoryPlayer, aTileEntity); - } - - public void addSlots(InventoryPlayer aInventoryPlayer) { - this.addSlotToContainer(new SlotLockedInput(this.mTileEntity, 0, 80, 17, mLockedSlotStack)); - this.addSlotToContainer(new GT_Slot_Output(this.mTileEntity, 1, 80, 53)); - this.addSlotToContainer(new GT_Slot_Render(this.mTileEntity, 2, 59, 42)); - } - - public void detectAndSendChanges() { - super.detectAndSendChanges(); - if (!this.mTileEntity.isClientSide() && this.mTileEntity.getMetaTileEntity() != null) { - if (this.mTileEntity.getMetaTileEntity() instanceof GT_MetaTileEntity_TieredChest) { - this.mContent = ((GT_MetaTileEntity_TieredChest) this.mTileEntity.getMetaTileEntity()).mItemCount; - mLockedSlotStack = ((GT_MetaTileEntity_TieredChest) this.mTileEntity.getMetaTileEntity()).mItemStack; - } - if (this.mTileEntity.getMetaTileEntity() instanceof GT4Entity_Shelf_Large) { - this.mContent = ((GT4Entity_Shelf_Large) this.mTileEntity.getMetaTileEntity()).mItemCount; - mLockedSlotStack = ((GT4Entity_Shelf_Large) this.mTileEntity.getMetaTileEntity()).mItemStack; - } else { - this.mContent = 0; - } - - Iterator var2 = this.crafters.iterator(); - - while (var2.hasNext()) { - ICrafting var1 = (ICrafting) var2.next(); - var1.sendProgressBarUpdate(this, 100, this.mContent & 65535); - var1.sendProgressBarUpdate(this, 101, this.mContent >>> 16); - } - } - } - - @SideOnly(Side.CLIENT) - public void updateProgressBar(int par1, int par2) { - super.updateProgressBar(par1, par2); - switch (par1) { - case 100: - this.mContent = this.mContent & -65536 | par2; - break; - case 101: - this.mContent = this.mContent & 65535 | par2 << 16; - } - } - - public int getSlotCount() { - return 2; - } - - public int getShiftClickSlotCount() { - return 1; - } -} diff --git a/src/main/java/gtPlusPlus/xmod/gregtech/api/gui/CONTAINER_TreeFarmer.java b/src/main/java/gtPlusPlus/xmod/gregtech/api/gui/CONTAINER_TreeFarmer.java deleted file mode 100644 index 5724ab6c04..0000000000 --- a/src/main/java/gtPlusPlus/xmod/gregtech/api/gui/CONTAINER_TreeFarmer.java +++ /dev/null @@ -1,72 +0,0 @@ -package gtPlusPlus.xmod.gregtech.api.gui; - -import gregtech.api.gui.GT_ContainerMetaTile_Machine; -import gregtech.api.interfaces.tileentity.IGregTechTileEntity; -import gtPlusPlus.core.slots.SlotBuzzSaw; -import gtPlusPlus.xmod.gregtech.common.tileentities.machines.multi.production.GregtechMetaTileEntityTreeFarm; -import java.util.List; -import net.minecraft.entity.player.InventoryPlayer; -import net.minecraft.inventory.ICrafting; - -public class CONTAINER_TreeFarmer extends GT_ContainerMetaTile_Machine { - - public long maxEU = 0; - public long storedEU = 0; - - public CONTAINER_TreeFarmer(final InventoryPlayer aInventoryPlayer, final IGregTechTileEntity aTileEntity) { - super(aInventoryPlayer, aTileEntity); - } - - public CONTAINER_TreeFarmer( - final InventoryPlayer aInventoryPlayer, - final IGregTechTileEntity aTileEntity, - final boolean bindInventory) { - super(aInventoryPlayer, aTileEntity, bindInventory); - } - - @Override - public void addSlots(final InventoryPlayer aInventoryPlayer) { - this.addSlotToContainer(new SlotBuzzSaw(this.mTileEntity, 1, 80, 17)); - } - - @Override - public int getSlotCount() { - return 1; - } - - @Override - public int getShiftClickSlotCount() { - return 1; - } - - @Override - public void updateProgressBar(final int id, final int value) { - super.updateProgressBar(id, value); - switch (id) { - case 100: - this.maxEU = value; - return; - case 101: - this.storedEU = value; - break; - default: - break; - } - } - - @SuppressWarnings("unchecked") - @Override - public void detectAndSendChanges() { - super.detectAndSendChanges(); - for (final ICrafting crafting : (List<ICrafting>) this.crafters) { - crafting.sendProgressBarUpdate(this, 100, (int) - ((GregtechMetaTileEntityTreeFarm) this.mTileEntity.getMetaTileEntity()).maxEUStore()); - crafting.sendProgressBarUpdate(this, 101, (int) - ((GregtechMetaTileEntityTreeFarm) this.mTileEntity.getMetaTileEntity()).getEUVar()); - if (((GregtechMetaTileEntityTreeFarm) this.mTileEntity.getMetaTileEntity()) - .isCorrectMachinePart(this.mTileEntity.getStackInSlot(1))) { - this.mTileEntity.markDirty(); - } - } - } -} diff --git a/src/main/java/gtPlusPlus/xmod/gregtech/api/gui/GTPP_UITextures.java b/src/main/java/gtPlusPlus/xmod/gregtech/api/gui/GTPP_UITextures.java new file mode 100644 index 0000000000..06a59cc52e --- /dev/null +++ b/src/main/java/gtPlusPlus/xmod/gregtech/api/gui/GTPP_UITextures.java @@ -0,0 +1,150 @@ +package gtPlusPlus.xmod.gregtech.api.gui; + +import static gtPlusPlus.core.lib.CORE.MODID; + +import com.gtnewhorizons.modularui.api.drawable.AdaptableUITexture; +import com.gtnewhorizons.modularui.api.drawable.UITexture; +import java.util.stream.Collectors; +import java.util.stream.IntStream; + +public class GTPP_UITextures { + + public static final AdaptableUITexture BACKGROUND_YELLOW = + AdaptableUITexture.of(MODID, "gui/background/yellow", 176, 166, 4); + + public static final AdaptableUITexture SLOT_ITEM_YELLOW = + AdaptableUITexture.of(MODID, "gui/slot/item_yellow", 18, 18, 1); + public static final AdaptableUITexture[] SLOT_INVENTORY_MANAGER = new AdaptableUITexture[] { + AdaptableUITexture.of(MODID, "gui/slot/red", 18, 18, 1), + AdaptableUITexture.of(MODID, "gui/slot/green", 18, 18, 1), + AdaptableUITexture.of(MODID, "gui/slot/blue", 18, 18, 1), + AdaptableUITexture.of(MODID, "gui/slot/cyan", 18, 18, 1), + AdaptableUITexture.of(MODID, "gui/slot/magenta", 18, 18, 1), + AdaptableUITexture.of(MODID, "gui/slot/yellow", 18, 18, 1), + }; + + public static final UITexture BUTTON_STANDARD_BRONZE = UITexture.fullImage(MODID, "gui/button/standard_bronze"); + public static final UITexture BUTTON_STANDARD_16x16 = UITexture.fullImage(MODID, "gui/button/standard_16x16"); + + public static final UITexture OVERLAY_SLOT_COAL = UITexture.fullImage(MODID, "gui/overlay_slot/coal"); + public static final UITexture OVERLAY_SLOT_CANISTER_DARK = + UITexture.fullImage(MODID, "gui/overlay_slot/canister_dark"); + public static final UITexture OVERLAY_SLOT_WEED_EX = UITexture.fullImage(MODID, "gui/overlay_slot/weed_ex"); + public static final UITexture OVERLAY_SLOT_FERTILIZER = UITexture.fullImage(MODID, "gui/overlay_slot/fertilizer"); + public static final UITexture OVERLAY_SLOT_ELECTRIC_TOOL = + UITexture.fullImage(MODID, "gui/overlay_slot/electric_tool"); + public static final UITexture OVERLAY_SLOT_PAGE_PRINTED_BRONZE = + UITexture.fullImage(MODID, "gui/overlay_slot/page_printed_bronze"); + public static final UITexture OVERLAY_SLOT_ARROW = UITexture.fullImage(MODID, "gui/overlay_slot/arrow"); + public static final UITexture OVERLAY_SLOT_ARROW_BRONZE = + UITexture.fullImage(MODID, "gui/overlay_slot/arrow_bronze"); + public static final UITexture OVERLAY_SLOT_CRAFT_OUTPUT = + UITexture.fullImage(MODID, "gui/overlay_slot/craft_output"); + public static final UITexture OVERLAY_SLOT_CRAFT_OUTPUT_BRONZE = + UITexture.fullImage(MODID, "gui/overlay_slot/craft_output_bronze"); + public static final UITexture OVERLAY_SLOT_PARK = UITexture.fullImage(MODID, "gui/overlay_slot/park"); + public static final UITexture OVERLAY_SLOT_PARK_BRONZE = UITexture.fullImage(MODID, "gui/overlay_slot/park_bronze"); + public static final UITexture OVERLAY_SLOT_INGOT = UITexture.fullImage(MODID, "gui/overlay_slot/ingot"); + public static final UITexture OVERLAY_SLOT_ARROW_4 = UITexture.fullImage(MODID, "gui/overlay_slot/arrow_4"); + public static final UITexture OVERLAY_SLOT_TURBINE = UITexture.fullImage(MODID, "gui/overlay_slot/turbine"); + public static final UITexture OVERLAY_SLOT_CHEST = UITexture.fullImage(MODID, "gui/overlay_slot/chest"); + public static final UITexture[] OVERLAY_SLOT_INVENTORY_MANAGER_COLOR = new UITexture[] { + UITexture.fullImage(MODID, "gui/overlay_slot/red"), + UITexture.fullImage(MODID, "gui/overlay_slot/green"), + UITexture.fullImage(MODID, "gui/overlay_slot/blue"), + UITexture.fullImage(MODID, "gui/overlay_slot/cyan"), + UITexture.fullImage(MODID, "gui/overlay_slot/magenta"), + UITexture.fullImage(MODID, "gui/overlay_slot/yellow"), + }; + public static final UITexture[] OVERLAY_SLOT_INVENTORY_MANAGER_ARROW = new UITexture[] { + UITexture.fullImage(MODID, "gui/overlay_slot/arrow_red"), + UITexture.fullImage(MODID, "gui/overlay_slot/arrow_green"), + UITexture.fullImage(MODID, "gui/overlay_slot/arrow_blue"), + UITexture.fullImage(MODID, "gui/overlay_slot/arrow_cyan"), + UITexture.fullImage(MODID, "gui/overlay_slot/arrow_magenta"), + UITexture.fullImage(MODID, "gui/overlay_slot/arrow_yellow"), + }; + + public static final UITexture PROGRESSBAR_FLUID_REACTOR = + UITexture.fullImage(MODID, "gui/progressbar/fluid_reactor"); + public static final UITexture PROGRESSBAR_BOILER_EMPTY = UITexture.fullImage(MODID, "gui/progressbar/boiler_empty"); + public static final UITexture PROGRESSBAR_FUEL = UITexture.fullImage(MODID, "gui/progressbar/fuel"); + public static final UITexture PROGRESSBAR_ARROW_2 = UITexture.fullImage(MODID, "gui/progressbar/arrow_2"); + public static final UITexture PROGRESSBAR_COMPUTER_ENERGY = + UITexture.fullImage(MODID, "gui/progressbar/computer_energy"); + public static final UITexture PROGRESSBAR_PSS_ENERGY = UITexture.fullImage(MODID, "gui/progressbar/pss_energy"); + + public static final AdaptableUITexture TAB_TITLE_YELLOW = + AdaptableUITexture.of(MODID, "gui/tab/title_yellow", 28, 28, 4); + public static final AdaptableUITexture TAB_TITLE_ANGULAR_YELLOW = + AdaptableUITexture.of(MODID, "gui/tab/title_angular_yellow", 28, 28, 4); + public static final AdaptableUITexture TAB_TITLE_DARK_YELLOW = + AdaptableUITexture.of(MODID, "gui/tab/title_dark_yellow", 28, 28, 4); + + public static final UITexture OVERLAY_BUTTON_HARVESTER_MODE = + UITexture.fullImage(MODID, "gui/overlay_button/harvester_mode"); + public static final UITexture OVERLAY_BUTTON_FLUSH = UITexture.fullImage(MODID, "gui/overlay_button/flush"); + public static final UITexture OVERLAY_BUTTON_FLUSH_BRONZE = + UITexture.fullImage(MODID, "gui/overlay_button/flush_bronze"); + public static final UITexture OVERLAY_BUTTON_AUTOMATION = + UITexture.fullImage(MODID, "gui/overlay_button/automation"); + public static final UITexture OVERLAY_BUTTON_LOCK = UITexture.fullImage(MODID, "gui/overlay_button/lock"); + public static final UITexture[] OVERLAY_BUTTON_THROUGHPUT = IntStream.range( + 0, 4) // GT_MetaTileEntity_ElectricAutoWorkbench#MAX_THROUGHPUT + .mapToObj(i -> UITexture.fullImage(MODID, "gui/overlay_button/throughput_" + i)) + .collect(Collectors.toList()) + .toArray(new UITexture[0]); + public static final UITexture[] OVERLAY_BUTTON_MODE = IntStream.range( + 0, 10) // GT_MetaTileEntity_ElectricAutoWorkbench#MAX_MODES + .mapToObj(i -> UITexture.fullImage(MODID, "gui/overlay_button/mode_" + i)) + .collect(Collectors.toList()) + .toArray(new UITexture[0]); + public static final UITexture OVERLAY_BUTTON_COMPUTER_MODE = + UITexture.fullImage(MODID, "gui/overlay_button/computer_mode"); + public static final UITexture OVERLAY_BUTTON_SAVE = UITexture.fullImage(MODID, "gui/overlay_button/save"); + public static final UITexture OVERLAY_BUTTON_LOAD = UITexture.fullImage(MODID, "gui/overlay_button/load"); + public static final UITexture OVERLAY_BUTTON_NUCLEAR_SWITCH = + UITexture.fullImage(MODID, "gui/overlay_button/nuclear_switch"); + public static final UITexture OVERLAY_BUTTON_ARROW_LEFT = + UITexture.fullImage(MODID, "gui/overlay_button/arrow_left"); + public static final UITexture OVERLAY_BUTTON_ARROW_RIGHT = + UITexture.fullImage(MODID, "gui/overlay_button/arrow_right"); + public static final UITexture[] OVERLAY_BUTTON_DIRECTION = new UITexture[] { + UITexture.fullImage(MODID, "gui/overlay_button/bottom"), + UITexture.fullImage(MODID, "gui/overlay_button/top"), + UITexture.fullImage(MODID, "gui/overlay_button/north"), + UITexture.fullImage(MODID, "gui/overlay_button/south"), + UITexture.fullImage(MODID, "gui/overlay_button/west"), + UITexture.fullImage(MODID, "gui/overlay_button/east"), + }; + public static final UITexture[] OVERLAY_BUTTON_DIRECTION_GRAY = new UITexture[] { + UITexture.fullImage(MODID, "gui/overlay_button/bottom_gray"), + UITexture.fullImage(MODID, "gui/overlay_button/top_gray"), + UITexture.fullImage(MODID, "gui/overlay_button/north_gray"), + UITexture.fullImage(MODID, "gui/overlay_button/south_gray"), + UITexture.fullImage(MODID, "gui/overlay_button/west_gray"), + UITexture.fullImage(MODID, "gui/overlay_button/east_gray"), + }; + public static final UITexture OVERLAY_BUTTON_TIP_GREEN = UITexture.fullImage(MODID, "gui/overlay_button/tip_green"); + public static final UITexture OVERLAY_BUTTON_TIP_RED = UITexture.fullImage(MODID, "gui/overlay_button/tip_red"); + public static final UITexture OVERLAY_BUTTON_ACTIVE_STATE = + UITexture.fullImage(MODID, "gui/overlay_button/active_state"); + public static final UITexture OVERLAY_BUTTON_CHANGE_MODE = + UITexture.fullImage(MODID, "gui/overlay_button/change_mode"); + public static final UITexture OVERLAY_BUTTON_PLUS_MINUS = + UITexture.fullImage(MODID, "gui/overlay_button/plus_minus"); + + public static final UITexture PICTURE_WORKBENCH_CIRCLE = UITexture.fullImage(MODID, "gui/picture/workbench_circle"); + public static final UITexture PICTURE_ARROW_WHITE_DOWN = UITexture.fullImage(MODID, "gui/picture/arrow_white_down"); + public static final UITexture PICTURE_V202 = UITexture.fullImage(MODID, "gui/picture/v202"); + public static final UITexture PICTURE_COMPUTER_TOP = UITexture.fullImage(MODID, "gui/picture/computer_top"); + public static final UITexture PICTURE_COMPUTER_GRID = UITexture.fullImage(MODID, "gui/picture/computer_grid"); + public static final UITexture PICTURE_ARROWS_SEPARATE = UITexture.fullImage(MODID, "gui/picture/arrows_separate"); + public static final UITexture PICTURE_ARROWS_FUSION = UITexture.fullImage(MODID, "gui/picture/arrows_fusion"); + public static final UITexture PICTURE_REDSTONE_CIRCUIT_SCREEN = + UITexture.fullImage(MODID, "gui/picture/redstone_circuit_screen"); + public static final UITexture PICTURE_ELECTRICITY_ERROR = + UITexture.fullImage(MODID, "gui/picture/electricity_error"); + public static final UITexture PICTURE_ELECTRICITY_FINE = UITexture.fullImage(MODID, "gui/picture/electricity_fine"); + public static final UITexture PICTURE_ENERGY_FRAME = UITexture.fullImage(MODID, "gui/picture/energy_frame"); +} diff --git a/src/main/java/gtPlusPlus/xmod/gregtech/api/gui/GUI_AdvancedBoiler.java b/src/main/java/gtPlusPlus/xmod/gregtech/api/gui/GUI_AdvancedBoiler.java deleted file mode 100644 index a924e2a6a5..0000000000 --- a/src/main/java/gtPlusPlus/xmod/gregtech/api/gui/GUI_AdvancedBoiler.java +++ /dev/null @@ -1,42 +0,0 @@ -package gtPlusPlus.xmod.gregtech.api.gui; - -import gregtech.api.gui.GT_GUIContainerMetaTile_Machine; -import gregtech.api.interfaces.tileentity.IGregTechTileEntity; -import net.minecraft.entity.player.InventoryPlayer; - -public class GUI_AdvancedBoiler extends GT_GUIContainerMetaTile_Machine { - public GUI_AdvancedBoiler(InventoryPlayer aInventoryPlayer, IGregTechTileEntity aTileEntity, String aTextureName) { - super(new CONTAINER_AdvancedBoiler(aInventoryPlayer, aTileEntity), "miscutils:textures/gui/" + aTextureName); - } - - @Override - protected void drawGuiContainerForegroundLayer(int par1, int par2) { - this.fontRendererObj.drawString("Advanced Boiler", 8, 4, 4210752); - } - - @Override - protected void drawGuiContainerBackgroundLayer(float par1, int par2, int par3) { - super.drawGuiContainerBackgroundLayer(par1, par2, par3); - int x = (this.width - this.xSize) / 2; - int y = (this.height - this.ySize) / 2; - drawTexturedModalRect(x, y, 0, 0, this.xSize, this.ySize); - if (this.mContainer != null) { - int tScale = ((CONTAINER_AdvancedBoiler) this.mContainer).mSteamAmount; - if (tScale > 0) { - drawTexturedModalRect(x + 70, y + 25 + 54 - tScale, 194, 54 - tScale, 10, tScale); - } - tScale = ((CONTAINER_AdvancedBoiler) this.mContainer).mWaterAmount; - if (tScale > 0) { - drawTexturedModalRect(x + 83, y + 25 + 54 - tScale, 204, 54 - tScale, 10, tScale); - } - tScale = ((CONTAINER_AdvancedBoiler) this.mContainer).mTemperature; - if (tScale > 0) { - drawTexturedModalRect(x + 96, y + 25 + 54 - tScale, 214, 54 - tScale, 10, tScale); - } - tScale = ((CONTAINER_AdvancedBoiler) this.mContainer).mProcessingEnergy; - if (tScale > 0) { - drawTexturedModalRect(x + 117, y + 44 + 14 - tScale, 177, 14 - tScale, 15, tScale + 1); - } - } - } -} diff --git a/src/main/java/gtPlusPlus/xmod/gregtech/api/gui/GUI_Cyclotron.java b/src/main/java/gtPlusPlus/xmod/gregtech/api/gui/GUI_Cyclotron.java deleted file mode 100644 index b31bc7b24c..0000000000 --- a/src/main/java/gtPlusPlus/xmod/gregtech/api/gui/GUI_Cyclotron.java +++ /dev/null @@ -1,49 +0,0 @@ -package gtPlusPlus.xmod.gregtech.api.gui; - -import gregtech.api.gui.GT_Container_MultiMachine; -import gregtech.api.gui.GT_GUIContainerMetaTile_Machine; -import gregtech.api.interfaces.tileentity.IGregTechTileEntity; -import net.minecraft.entity.player.InventoryPlayer; - -public class GUI_Cyclotron extends GT_GUIContainerMetaTile_Machine { - public final String mNEI; - public final String mName; - - public GUI_Cyclotron( - final InventoryPlayer aInventoryPlayer, - final IGregTechTileEntity aTileEntity, - final String aName, - final String aNEI) { - super( - new GT_Container_MultiMachine(aInventoryPlayer, aTileEntity, false), - "gregtech:textures/gui/multimachines/" + "FusionComputer.png"); - this.mName = aName; - this.mNEI = aNEI; - } - - @Override - protected void drawGuiContainerForegroundLayer(final int par1, final int par2) { - this.fontRendererObj.drawString(this.mName, 8, -10, 16448255); - if (this.mContainer != null) { - if ((((GT_Container_MultiMachine) this.mContainer).mDisplayErrorCode & 0x40) != 0x0) { - this.fontRendererObj.drawString("Incomplete Structure.", 10, 8, 16448255); - } - if (((GT_Container_MultiMachine) this.mContainer).mDisplayErrorCode == 0) { - if (((GT_Container_MultiMachine) this.mContainer).mActive == 0) { - this.fontRendererObj.drawString( - "Hit with Soft Hammer to (re-)start the Machine if it doesn't start.", -70, 170, 16448255); - } else { - this.fontRendererObj.drawString("Running perfectly.", 10, 170, 16448255); - } - } - } - } - - @Override - protected void drawGuiContainerBackgroundLayer(final float par1, final int par2, final int par3) { - super.drawGuiContainerBackgroundLayer(par1, par2, par3); - final int x = (this.width - this.xSize) / 2; - final int y = (this.height - this.ySize) / 2; - this.drawTexturedModalRect(x, y, 0, 0, this.xSize, this.ySize); - } -} diff --git a/src/main/java/gtPlusPlus/xmod/gregtech/api/gui/GUI_DataHatch.java b/src/main/java/gtPlusPlus/xmod/gregtech/api/gui/GUI_DataHatch.java deleted file mode 100644 index b42e2fae2f..0000000000 --- a/src/main/java/gtPlusPlus/xmod/gregtech/api/gui/GUI_DataHatch.java +++ /dev/null @@ -1,41 +0,0 @@ -package gtPlusPlus.xmod.gregtech.api.gui; - -import static gregtech.api.enums.GT_Values.RES_PATH_GUI; - -import gregtech.api.gui.GT_GUIContainerMetaTile_Machine; -import gregtech.api.interfaces.tileentity.IGregTechTileEntity; -import net.minecraft.entity.player.InventoryPlayer; - -public class GUI_DataHatch extends GT_GUIContainerMetaTile_Machine { - - private final String mName; - - public GUI_DataHatch(InventoryPlayer aInventoryPlayer, IGregTechTileEntity aTileEntity, String aName) { - super(new CONTAINER_DataHatch(aInventoryPlayer, aTileEntity), RES_PATH_GUI + "HatchDataOrb.png"); - mName = aName; - } - - public GUI_DataHatch( - InventoryPlayer aInventoryPlayer, IGregTechTileEntity aTileEntity, String aName, String aBackground) { - super(new CONTAINER_DataHatch(aInventoryPlayer, aTileEntity), RES_PATH_GUI + aBackground + "HatchDataOrb.png"); - mName = aName; - } - - @Override - protected void drawGuiContainerForegroundLayer(int par1, int par2) { - fontRendererObj.drawString(mName, 8, 4, 4210752); - /*String[] aName = mName.trim().split("\\s+"); - int aY = 4; - for (String s : aName) { - fontRendererObj.drawString(s, 120, (aY += 12), 4210752); - }*/ - } - - @Override - protected void drawGuiContainerBackgroundLayer(float par1, int par2, int par3) { - super.drawGuiContainerBackgroundLayer(par1, par2, par3); - int x = (width - xSize) / 2; - int y = (height - ySize) / 2; - drawTexturedModalRect(x, y, 0, 0, xSize, ySize); - } -} diff --git a/src/main/java/gtPlusPlus/xmod/gregtech/api/gui/GUI_DeluxeTank.java b/src/main/java/gtPlusPlus/xmod/gregtech/api/gui/GUI_DeluxeTank.java deleted file mode 100644 index 0b851332b8..0000000000 --- a/src/main/java/gtPlusPlus/xmod/gregtech/api/gui/GUI_DeluxeTank.java +++ /dev/null @@ -1,39 +0,0 @@ -package gtPlusPlus.xmod.gregtech.api.gui; - -import static gregtech.api.enums.GT_Values.RES_PATH_GUI; - -import gregtech.api.gui.GT_GUIContainerMetaTile_Machine; -import gregtech.api.interfaces.tileentity.IGregTechTileEntity; -import net.minecraft.entity.player.InventoryPlayer; -import net.minecraft.util.StatCollector; - -public class GUI_DeluxeTank extends GT_GUIContainerMetaTile_Machine { - - private final String mName; - - public GUI_DeluxeTank( - final InventoryPlayer aInventoryPlayer, final IGregTechTileEntity aTileEntity, final String aName) { - super(new CONTAINER_DeluxeTank(aInventoryPlayer, aTileEntity), RES_PATH_GUI + "BasicTank.png"); - this.mName = aName; - } - - @Override - protected void drawGuiContainerForegroundLayer(final int par1, final int par2) { - this.fontRendererObj.drawString( - StatCollector.translateToLocal("container.inventory"), 8, (this.ySize - 96) + 2, 4210752); - this.fontRendererObj.drawString(this.mName, 8, 6, 4210752); - if (this.mContainer != null) { - this.fontRendererObj.drawString("Fuel | A | B |", 10, 20, 16448255); - // fontRendererObj.drawString(GT_Utility.parseNumberToString(((CONTAINER_DeluxeTank) mContainer).mContent), - // 10, 30, 16448255); - } - } - - @Override - protected void drawGuiContainerBackgroundLayer(final float par1, final int par2, final int par3) { - super.drawGuiContainerBackgroundLayer(par1, par2, par3); - final int x = (this.width - this.xSize) / 2; - final int y = (this.height - this.ySize) / 2; - this.drawTexturedModalRect(x, y, 0, 0, this.xSize, this.ySize); - } -} diff --git a/src/main/java/gtPlusPlus/xmod/gregtech/api/gui/GUI_Hatch_Muffler_Advanced.java b/src/main/java/gtPlusPlus/xmod/gregtech/api/gui/GUI_Hatch_Muffler_Advanced.java deleted file mode 100644 index af0462b773..0000000000 --- a/src/main/java/gtPlusPlus/xmod/gregtech/api/gui/GUI_Hatch_Muffler_Advanced.java +++ /dev/null @@ -1,51 +0,0 @@ -package gtPlusPlus.xmod.gregtech.api.gui; - -import gregtech.api.gui.GT_GUIContainerMetaTile_Machine; -import gregtech.api.interfaces.tileentity.IGregTechTileEntity; -import gtPlusPlus.core.lib.CORE; -import net.minecraft.entity.player.InventoryPlayer; - -public class GUI_Hatch_Muffler_Advanced extends GT_GUIContainerMetaTile_Machine { - - String mName = ""; - long maxPower = 0; - long storedPower = 0; - - public GUI_Hatch_Muffler_Advanced( - final InventoryPlayer aInventoryPlayer, - final IGregTechTileEntity aTileEntity, - final String aName, - final String aTextureFile) { - super( - new CONTAINER_Hatch_Muffler_Advanced(aInventoryPlayer, aTileEntity), - CORE.RES_PATH_GUI + (aTextureFile == null ? "MultiblockDisplay" : aTextureFile)); - this.mName = aName; - } - - @Override - protected void drawGuiContainerForegroundLayer(final int par1, final int par2) { - this.fontRendererObj.drawString(this.mName, 8, 8, 16448255); - /* - * ReflectionUtils.setField(this.fontRendererObj, "underlineStyle", true); - * ReflectionUtils.setField(this.fontRendererObj, "italicStyle", true); - * ReflectionUtils.setField(this.fontRendererObj, "boldStyle", true); boolean - * isBold = ReflectionUtils.getField(this.fontRendererObj, "boldStyle"); - * this.fontRendererObj.drawString("Insert Air Filters - Bold: "+isBold, 8, 18, - * 16448255); - */ - if (this.mContainer != null) { - // this.maxPower = ((CONTAINER_TreeFarmer)this.mContainer).maxEU; - // this.storedPower = ((CONTAINER_TreeFarmer)this.mContainer).storedEU; - } - } - - @Override - protected void drawGuiContainerBackgroundLayer(final float par1, final int par2, final int par3) { - super.drawGuiContainerBackgroundLayer(par1, par2, par3); - // this.maxPower = ((CONTAINER_TreeFarmer)this.mContainer).maxEU; - // this.storedPower = ((CONTAINER_TreeFarmer)this.mContainer).storedEU; - final int x = (this.width - this.xSize) / 2; - final int y = (this.height - this.ySize) / 2; - this.drawTexturedModalRect(x, y, 0, 0, this.xSize, this.ySize); - } -} diff --git a/src/main/java/gtPlusPlus/xmod/gregtech/api/gui/GUI_IndustrialCentrifuge.java b/src/main/java/gtPlusPlus/xmod/gregtech/api/gui/GUI_IndustrialCentrifuge.java deleted file mode 100644 index 007669c8ba..0000000000 --- a/src/main/java/gtPlusPlus/xmod/gregtech/api/gui/GUI_IndustrialCentrifuge.java +++ /dev/null @@ -1,74 +0,0 @@ -package gtPlusPlus.xmod.gregtech.api.gui; - -import gregtech.api.gui.GT_GUIContainerMetaTile_Machine; -import gregtech.api.interfaces.tileentity.IGregTechTileEntity; -import gtPlusPlus.core.lib.CORE; -import net.minecraft.entity.player.InventoryPlayer; - -public class GUI_IndustrialCentrifuge extends GT_GUIContainerMetaTile_Machine { - - String mName = ""; - private short counter = 0; - - public GUI_IndustrialCentrifuge( - final InventoryPlayer aInventoryPlayer, - final IGregTechTileEntity aTileEntity, - final String aName, - final String aTextureFile) { - super( - new CONTAINER_IndustrialCentrifuge(aInventoryPlayer, aTileEntity), - CORE.RES_PATH_GUI + (aTextureFile == null ? "MultiblockDisplay" : aTextureFile)); - this.mName = aName; - } - - @Override - protected void drawGuiContainerForegroundLayer(final int par1, final int par2) { - this.fontRendererObj.drawString(this.mName, 10, 8, 16448255); - if (this.counter >= 100) { - this.counter = 0; - } else { - this.counter++; - } - if (this.mContainer != null) { - if ((((CONTAINER_IndustrialCentrifuge) this.mContainer).mDisplayErrorCode & 1) != 0) { - this.fontRendererObj.drawString("Pipe is loose.", 10, 16, 16448255); - } - if ((((CONTAINER_IndustrialCentrifuge) this.mContainer).mDisplayErrorCode & 2) != 0) { - this.fontRendererObj.drawString("Screws are loose.", 10, 24, 16448255); - } - if ((((CONTAINER_IndustrialCentrifuge) this.mContainer).mDisplayErrorCode & 4) != 0) { - this.fontRendererObj.drawString("Something is stuck.", 10, 32, 16448255); - } - if ((((CONTAINER_IndustrialCentrifuge) this.mContainer).mDisplayErrorCode & 8) != 0) { - this.fontRendererObj.drawString("Platings are dented.", 10, 40, 16448255); - } - if ((((CONTAINER_IndustrialCentrifuge) this.mContainer).mDisplayErrorCode & 32) != 0) { - this.fontRendererObj.drawString("That doesn't belong there.", 10, 56, 16448255); - } - if ((((CONTAINER_IndustrialCentrifuge) this.mContainer).mDisplayErrorCode & 64) != 0) { - this.fontRendererObj.drawString("Incomplete Structure.", 10, 64, 16448255); - } - - if (((CONTAINER_IndustrialCentrifuge) this.mContainer).mDisplayErrorCode == 0) { - if (((CONTAINER_IndustrialCentrifuge) this.mContainer).mActive == 0) { - this.fontRendererObj.drawString("Hit with Soft Mallet", 10, 16, 16448255); - this.fontRendererObj.drawString("to (re-)start the Machine", 10, 24, 16448255); - this.fontRendererObj.drawString("if it doesn't start.", 10, 32, 16448255); - } else { - this.fontRendererObj.drawString("Running perfectly.", 10, 16, 16448255); - /*if (CORE.DEBUG){ - fontRendererObj.drawString("Debug Counter: "+counter, 10, 56, 16448255); - }*/ - } - } - } - } - - @Override - protected void drawGuiContainerBackgroundLayer(final float par1, final int par2, final int par3) { - super.drawGuiContainerBackgroundLayer(par1, par2, par3); - final int x = (this.width - this.xSize) / 2; - final int y = (this.height - this.ySize) / 2; - this.drawTexturedModalRect(x, y, 0, 0, this.xSize, this.ySize); - } -} diff --git a/src/main/java/gtPlusPlus/xmod/gregtech/api/gui/GUI_IronBlastFurnace.java b/src/main/java/gtPlusPlus/xmod/gregtech/api/gui/GUI_IronBlastFurnace.java deleted file mode 100644 index 409e7a29ae..0000000000 --- a/src/main/java/gtPlusPlus/xmod/gregtech/api/gui/GUI_IronBlastFurnace.java +++ /dev/null @@ -1,44 +0,0 @@ -package gtPlusPlus.xmod.gregtech.api.gui; - -import gregtech.api.gui.GT_GUIContainerMetaTile_Machine; -import gregtech.api.interfaces.tileentity.IGregTechTileEntity; -import gtPlusPlus.core.lib.CORE; -import net.minecraft.entity.player.InventoryPlayer; - -public class GUI_IronBlastFurnace extends GT_GUIContainerMetaTile_Machine { - public GUI_IronBlastFurnace(final InventoryPlayer aInventoryPlayer, final IGregTechTileEntity aTileEntity) { - super( - new CONTAINER_IronBlastFurnace(aInventoryPlayer, aTileEntity), - CORE.RES_PATH_GUI + "IronBlastFurnace.png"); - } - - @Override - protected void drawGuiContainerForegroundLayer(final int par1, final int par2) { - this.fontRendererObj.drawString("Iron Blast Furnace", 8, 4, 4210752); - } - - @Override - protected void drawGuiContainerBackgroundLayer(final float par1, final int par2, final int par3) { - super.drawGuiContainerBackgroundLayer(par1, par2, par3); - final int x = (this.width - this.xSize) / 2; - final int y = (this.height - this.ySize) / 2; - this.drawTexturedModalRect(x, y, 0, 0, this.xSize, this.ySize); - if ((this.mContainer != null) && (this.mContainer.mProgressTime > 0)) { - this.drawTexturedModalRect( - x + 58, - y + 28, - 176, - 0, - Math.max( - 0, - Math.min( - 20, - 1 - + ((this.mContainer.mProgressTime * 20) - / (this.mContainer.mMaxProgressTime < 1 - ? 1 - : this.mContainer.mMaxProgressTime)))), - 11); - } - } -} diff --git a/src/main/java/gtPlusPlus/xmod/gregtech/api/gui/GUI_MatterFab.java b/src/main/java/gtPlusPlus/xmod/gregtech/api/gui/GUI_MatterFab.java deleted file mode 100644 index 7a42ea01cd..0000000000 --- a/src/main/java/gtPlusPlus/xmod/gregtech/api/gui/GUI_MatterFab.java +++ /dev/null @@ -1,95 +0,0 @@ -package gtPlusPlus.xmod.gregtech.api.gui; - -import gregtech.api.gui.GT_GUIContainerMetaTile_Machine; -import gregtech.api.interfaces.tileentity.IGregTechTileEntity; -import gtPlusPlus.core.lib.CORE; -import net.minecraft.entity.player.InventoryPlayer; - -/** - * NEVER INCLUDE THIS FILE IN YOUR MOD!!! - * <p/> - * The GUI-Container I use for all my Basic Machines - * <p/> - * As the NEI-RecipeTransferRect Handler can't handle one GUI-Class for all GUIs I needed to produce some dummy-classes which extend this class - */ -public class GUI_MatterFab extends GT_GUIContainerMetaTile_Machine { - - String mName = ""; - public int mMatterProduced = 0; - public int mScrapProduced = 0; - public int mAmplifierProduced = 0; - public int mScrapUsed = 0; - public int mAmplifierUsed = 0; - - public GUI_MatterFab( - final InventoryPlayer aInventoryPlayer, - final IGregTechTileEntity aTileEntity, - final String aName, - final String aTextureFile) { - super( - new CONTAINER_MatterFab(aInventoryPlayer, aTileEntity), - CORE.RES_PATH_GUI + (aTextureFile == null ? "MultiblockDisplay" : aTextureFile)); - this.mName = aName; - } - - @Override - protected void drawGuiContainerForegroundLayer(final int par1, final int par2) { - this.fontRendererObj.drawString(this.mName, 10, 8, 16448255); - - if (this.mContainer != null) { - if ((((CONTAINER_MatterFab) this.mContainer).mDisplayErrorCode & 1) != 0) { - this.fontRendererObj.drawString("Pipe is loose.", 10, 16, 16448255); - } - if ((((CONTAINER_MatterFab) this.mContainer).mDisplayErrorCode & 2) != 0) { - this.fontRendererObj.drawString("Screws are loose.", 10, 24, 16448255); - } - if ((((CONTAINER_MatterFab) this.mContainer).mDisplayErrorCode & 4) != 0) { - this.fontRendererObj.drawString("Something is stuck.", 10, 32, 16448255); - } - if ((((CONTAINER_MatterFab) this.mContainer).mDisplayErrorCode & 8) != 0) { - this.fontRendererObj.drawString("Platings are dented.", 10, 40, 16448255); - } - if ((((CONTAINER_MatterFab) this.mContainer).mDisplayErrorCode & 16) != 0) { - this.fontRendererObj.drawString("Circuitry burned out.", 10, 48, 16448255); - } - if ((((CONTAINER_MatterFab) this.mContainer).mDisplayErrorCode & 32) != 0) { - this.fontRendererObj.drawString("That doesn't belong there.", 10, 56, 16448255); - } - if ((((CONTAINER_MatterFab) this.mContainer).mDisplayErrorCode & 64) != 0) { - this.fontRendererObj.drawString("Incomplete Structure.", 10, 64, 16448255); - } - - if (((CONTAINER_MatterFab) this.mContainer).mDisplayErrorCode == 0) { - if (((CONTAINER_MatterFab) this.mContainer).mActive == 0) { - this.fontRendererObj.drawString("Hit with Soft Mallet", 10, 16, 16448255); - this.fontRendererObj.drawString("to (re-)start the Machine", 10, 24, 16448255); - this.fontRendererObj.drawString("if it doesn't start.", 10, 32, 16448255); - } else { - CONTAINER_MatterFab aContainer = (CONTAINER_MatterFab) this.mContainer; - - this.mMatterProduced = aContainer.mMatterProduced; - this.mAmplifierProduced = aContainer.mAmplifierProduced; - this.mAmplifierUsed = aContainer.mAmplifierUsed; - this.mScrapProduced = aContainer.mScrapProduced; - this.mScrapUsed = aContainer.mScrapUsed; - - this.fontRendererObj.drawString("Running perfectly.", 10, 16, 16448255); - - this.fontRendererObj.drawString("Scrap Made: " + this.mScrapProduced, 10, 32, 16448255); - this.fontRendererObj.drawString("Scrap Used: " + this.mScrapUsed, 10, 40, 16448255); - this.fontRendererObj.drawString("UUA Made: " + this.mAmplifierProduced, 10, 48, 16448255); - this.fontRendererObj.drawString("UUA Used: " + this.mAmplifierUsed, 10, 56, 16448255); - this.fontRendererObj.drawString("UUM Made: " + this.mMatterProduced, 10, 64, 16448255); - } - } - } - } - - @Override - protected void drawGuiContainerBackgroundLayer(final float par1, final int par2, final int par3) { - super.drawGuiContainerBackgroundLayer(par1, par2, par3); - final int x = (this.width - this.xSize) / 2; - final int y = (this.height - this.ySize) / 2; - this.drawTexturedModalRect(x, y, 0, 0, this.xSize, this.ySize); - } -} diff --git a/src/main/java/gtPlusPlus/xmod/gregtech/api/gui/GUI_MultiMachine.java b/src/main/java/gtPlusPlus/xmod/gregtech/api/gui/GUI_MultiMachine.java deleted file mode 100644 index 7322570bab..0000000000 --- a/src/main/java/gtPlusPlus/xmod/gregtech/api/gui/GUI_MultiMachine.java +++ /dev/null @@ -1,358 +0,0 @@ -package gtPlusPlus.xmod.gregtech.api.gui; - -import gregtech.api.enums.GT_Values; -import gregtech.api.enums.Materials; -import gregtech.api.gui.GT_GUIContainerMetaTile_Machine; -import gregtech.api.interfaces.tileentity.IGregTechTileEntity; -import gregtech.api.util.GT_Utility; -import gregtech.common.items.GT_MetaGenerated_Tool_01; -import gtPlusPlus.core.lib.CORE; -import gtPlusPlus.core.util.minecraft.ItemUtils; -import gtPlusPlus.core.util.reflect.ReflectionUtils; -import java.lang.reflect.InvocationTargetException; -import java.lang.reflect.Method; -import java.util.ArrayList; -import java.util.concurrent.ConcurrentHashMap; -import java.util.concurrent.TimeUnit; -import net.minecraft.client.gui.inventory.GuiContainer; -import net.minecraft.entity.player.InventoryPlayer; -import net.minecraft.item.ItemStack; -import net.minecraft.util.EnumChatFormatting; -import net.minecraft.util.StatCollector; - -/** - * NEVER INCLUDE THIS FILE IN YOUR MOD!!! - * <p/> - * The GUI-Container I use for all my Basic Machines - * <p/> - * As the NEI-RecipeTransferRect Handler can't handle one GUI-Class for all GUIs I needed to produce some dummy-classes which extend this class - */ -public class GUI_MultiMachine extends GT_GUIContainerMetaTile_Machine { - - private static final Materials GOOD; - private static final Materials BAD; - private final String mName; - - private static final ConcurrentHashMap<String, ItemStack> mToolStacks = new ConcurrentHashMap<String, ItemStack>(); - - // net.minecraft.client.gui.inventory.GuiContainer.drawItemStack(ItemStack, int, int, String) - private static final Method mDrawItemStack; - - static { - GOOD = Materials.Uranium; - BAD = Materials.Plutonium; - - // net.minecraft.client.gui.inventory.GuiContainer.drawItemStack(ItemStack, int, int, String) - mDrawItemStack = ReflectionUtils.getMethod( - GuiContainer.class, "drawItemStack", new Class[] {ItemStack.class, int.class, int.class, String.class}); - } - - public GUI_MultiMachine( - final InventoryPlayer aInventoryPlayer, - final IGregTechTileEntity aTileEntity, - final String aName, - final String aTextureFile) { - super( - new CONTAINER_MultiMachine_NoPlayerInventory(aInventoryPlayer, aTileEntity), - CORE.RES_PATH_GUI + (aTextureFile == null ? "MultiblockDisplay" : aTextureFile)); - this.mName = aName != null ? aName : ""; - } - - @Override - protected void drawGuiContainerForegroundLayer(final int par1, final int par2) { - if (this.mContainer != null) { - drawGuiInfoTextLayer(par1, par2); - drawGuiRepairStatusLayer(par1, par2); - } - } - - protected void drawGuiInfoTextLayer(final float par1, final int par2) { - - if ((((CONTAINER_MultiMachine) this.mContainer).mDisplayErrorCode & 64) != 0) { - this.fontRendererObj.drawString(mName, 6, 7, 16448255); // Move down 8px - this.fontRendererObj.drawString("Incomplete Structure.", 6, 15, 16448255); // Move down 8px - } else { - int aTotalTickTime = ((CONTAINER_MultiMachine) this.mContainer).aTotalTickTime; - int aMaxParallel = ((CONTAINER_MultiMachine) this.mContainer).aMaxParallel; - int aPollutionTick = ((CONTAINER_MultiMachine) this.mContainer).aPollutionTick; - int aMaxInputVoltage = ((CONTAINER_MultiMachine) this.mContainer).aMaxInputVoltage; - int aInputTier = ((CONTAINER_MultiMachine) this.mContainer).aInputTier; - int aOutputTier = ((CONTAINER_MultiMachine) this.mContainer).aOutputTier; - int aRecipeDuration = ((CONTAINER_MultiMachine) this.mContainer).aRecipeDuration; - int aRecipeEU = ((CONTAINER_MultiMachine) this.mContainer).aRecipeEU; - int aRecipeSpecial = ((CONTAINER_MultiMachine) this.mContainer).aRecipeSpecial; - int aEfficiency = ((CONTAINER_MultiMachine) this.mContainer).aEfficiency; - - int aPollutionReduction = ((CONTAINER_MultiMachine) this.mContainer).aPollutionReduction; - - long aStoredEnergy = ((CONTAINER_MultiMachine) this.mContainer).aStoredEnergy; - long aMaxEnergy = ((CONTAINER_MultiMachine) this.mContainer).aMaxEnergy; - - /* - * Logic Block - */ - - long seconds = (aTotalTickTime / 20); - int weeks = (int) (TimeUnit.SECONDS.toDays(seconds) / 7); - int days = (int) (TimeUnit.SECONDS.toDays(seconds) - 7 * weeks); - long hours = - TimeUnit.SECONDS.toHours(seconds) - TimeUnit.DAYS.toHours(days) - TimeUnit.DAYS.toHours(7 * weeks); - long minutes = TimeUnit.SECONDS.toMinutes(seconds) - (TimeUnit.SECONDS.toHours(seconds) * 60); - long second = TimeUnit.SECONDS.toSeconds(seconds) - (TimeUnit.SECONDS.toMinutes(seconds) * 60); - - ArrayList<String> mInfo = new ArrayList<String>(); - - String EU = StatCollector.translateToLocal("GTPP.info.eu"); - - // GTPP.machines.tier - - mInfo.add(mName); - - if (aInputTier > 0) { - mInfo.add(StatCollector.translateToLocal("GTPP.machines.input") + " " - + StatCollector.translateToLocal("GTPP.machines.tier") + ": " + EnumChatFormatting.GREEN - + GT_Values.VOLTAGE_NAMES[aInputTier]); - } - if (aOutputTier > 0) { - mInfo.add(StatCollector.translateToLocal("GTPP.machines.output") + " " - + StatCollector.translateToLocal("GTPP.machines.tier") + ": " + EnumChatFormatting.GREEN - + GT_Values.VOLTAGE_NAMES[aOutputTier]); - } - - mInfo.add(StatCollector.translateToLocal("GTPP.multiblock.progress") + ": " + EnumChatFormatting.GREEN - + Integer.toString(((CONTAINER_MultiMachine) this.mContainer).mProgressTime / 20) - + EnumChatFormatting.RESET + " s / " + EnumChatFormatting.YELLOW - + Integer.toString(((CONTAINER_MultiMachine) this.mContainer).mMaxProgressTime / 20) - + EnumChatFormatting.RESET + " s"); - - mInfo.add(StatCollector.translateToLocal("GTPP.multiblock.energy") + ":"); - mInfo.add(StatCollector.translateToLocal("" + EnumChatFormatting.GREEN + Long.toString(aStoredEnergy) - + EnumChatFormatting.RESET + " EU / " + EnumChatFormatting.YELLOW + Long.toString(aMaxEnergy) - + EnumChatFormatting.RESET + " EU")); - - if (aRecipeEU != 0 && aRecipeDuration > 0) { - if (aRecipeEU > 0) { - mInfo.add(StatCollector.translateToLocal("GTPP.multiblock.usage") + ":"); - mInfo.add(StatCollector.translateToLocal("" + EnumChatFormatting.RED + Integer.toString(-aRecipeEU) - + EnumChatFormatting.RESET + " EU/t/parallel")); - } else { - mInfo.add(StatCollector.translateToLocal("GTPP.multiblock.generation") + ":"); - mInfo.add(StatCollector.translateToLocal("" + EnumChatFormatting.GREEN + Integer.toString(aRecipeEU) - + EnumChatFormatting.RESET + " EU/t/parallel")); - } - mInfo.add(StatCollector.translateToLocal("GTPP.multiblock.duration") + ": " + EnumChatFormatting.RED - + Integer.toString(aRecipeDuration) + EnumChatFormatting.RESET + " ticks"); - if (aRecipeSpecial > 0) { - mInfo.add(StatCollector.translateToLocal("GTPP.multiblock.specialvalue") + ": " - + EnumChatFormatting.RED + Integer.toString(aRecipeEU) + EnumChatFormatting.RESET + ""); - } - } - - mInfo.add(StatCollector.translateToLocal("GTPP.multiblock.mei") + ":"); - mInfo.add(StatCollector.translateToLocal("" + EnumChatFormatting.YELLOW + Long.toString(aMaxInputVoltage) - + EnumChatFormatting.RESET + " EU/t(*2A) " + StatCollector.translateToLocal("GTPP.machines.tier") - + ": " + EnumChatFormatting.YELLOW + GT_Values.VN[GT_Utility.getTier(aMaxInputVoltage)] - + EnumChatFormatting.RESET)); - - mInfo.add(StatCollector.translateToLocal("GTPP.multiblock.efficiency") + ": " + EnumChatFormatting.YELLOW - + Float.toString(aEfficiency / 100.0F) + EnumChatFormatting.RESET + " %"); - - mInfo.add(StatCollector.translateToLocal("GTPP.multiblock.pollution") + ": " + EnumChatFormatting.RED - + (aPollutionTick * 20) + EnumChatFormatting.RESET + "/sec"); - mInfo.add(StatCollector.translateToLocal("GTPP.multiblock.pollutionreduced") + ": " - + EnumChatFormatting.GREEN + aPollutionReduction + EnumChatFormatting.RESET + " %"); - - // mInfo.add(StatCollector.translateToLocal("GTPP.CC.parallel")+": - // "+EnumChatFormatting.GREEN+(aMaxParallel)+EnumChatFormatting.RESET); - - mInfo.add("Total Time Since Built: "); - mInfo.add("" + EnumChatFormatting.DARK_GREEN + Integer.toString(weeks) + EnumChatFormatting.RESET - + " Weeks,"); - mInfo.add( - "" + EnumChatFormatting.DARK_GREEN + Integer.toString(days) + EnumChatFormatting.RESET + " Days,"); - mInfo.add("" + EnumChatFormatting.DARK_GREEN + Long.toString(hours) + EnumChatFormatting.RESET + " Hours,"); - mInfo.add("" + EnumChatFormatting.DARK_GREEN + Long.toString(minutes) + EnumChatFormatting.RESET - + " Minutes,"); - mInfo.add( - "" + EnumChatFormatting.DARK_GREEN + Long.toString(second) + EnumChatFormatting.RESET + " Seconds"); - - // Machine Name - // fontRendererObj.drawString(this.mName, 6, 7, 16448255); - - for (int i = 0; i < mInfo.size(); i++) { - fontRendererObj.drawString(mInfo.get(i), 6, 7 + (i * 8), 16448255); - } - } - } - - protected void drawGuiRepairStatusLayer(final float par1, final int par2) { - - boolean aWrench = (((CONTAINER_MultiMachine) this.mContainer).mDisplayErrorCode & 1) != 0; - boolean aScrewdriver = (((CONTAINER_MultiMachine) this.mContainer).mDisplayErrorCode & 2) != 0; - boolean aMallet = (((CONTAINER_MultiMachine) this.mContainer).mDisplayErrorCode & 4) != 0; - boolean aHammer = (((CONTAINER_MultiMachine) this.mContainer).mDisplayErrorCode & 8) != 0; - boolean aSoldering = (((CONTAINER_MultiMachine) this.mContainer).mDisplayErrorCode & 16) != 0; - boolean aCrowbar = (((CONTAINER_MultiMachine) this.mContainer).mDisplayErrorCode & 32) != 0; - - if (mToolStacks.isEmpty()) { - // Map Stacks of Repair items - aWrench = false; - aScrewdriver = false; - aMallet = false; - aHammer = false; - aSoldering = false; - aCrowbar = false; - mToolStacks.put( - aWrench + "WRENCH", - GT_MetaGenerated_Tool_01.INSTANCE.getToolWithStats( - GT_MetaGenerated_Tool_01.WRENCH, 1, (aWrench ? BAD : GOOD), Materials.Tungsten, null)); - mToolStacks.put( - aCrowbar + "CROWBAR", - GT_MetaGenerated_Tool_01.INSTANCE.getToolWithStats( - GT_MetaGenerated_Tool_01.CROWBAR, 1, (aCrowbar ? BAD : GOOD), Materials.Tungsten, null)); - mToolStacks.put( - aHammer + "HARDHAMMER", - GT_MetaGenerated_Tool_01.INSTANCE.getToolWithStats( - GT_MetaGenerated_Tool_01.HARDHAMMER, 1, (aHammer ? BAD : GOOD), Materials.Tungsten, null)); - mToolStacks.put( - aMallet + "SOFTHAMMER", - GT_MetaGenerated_Tool_01.INSTANCE.getToolWithStats( - GT_MetaGenerated_Tool_01.SOFTHAMMER, 1, (aMallet ? BAD : GOOD), Materials.Tungsten, null)); - mToolStacks.put( - aScrewdriver + "SCREWDRIVER", - GT_MetaGenerated_Tool_01.INSTANCE.getToolWithStats( - GT_MetaGenerated_Tool_01.SCREWDRIVER, - 1, - (aScrewdriver ? BAD : GOOD), - Materials.Tungsten, - null)); - mToolStacks.put( - aSoldering + "SOLDERING_IRON_LV", - GT_MetaGenerated_Tool_01.INSTANCE.getToolWithStats( - GT_MetaGenerated_Tool_01.SOLDERING_IRON_LV, - 1, - (aSoldering ? BAD : GOOD), - Materials.Tungsten, - null)); - - // Map Stacks of valid items - aWrench = true; - aScrewdriver = true; - aMallet = true; - aHammer = true; - aSoldering = true; - aCrowbar = true; - mToolStacks.put( - aWrench + "WRENCH", - GT_MetaGenerated_Tool_01.INSTANCE.getToolWithStats( - GT_MetaGenerated_Tool_01.WRENCH, 1, (aWrench ? BAD : GOOD), Materials.Tungsten, null)); - mToolStacks.put( - aCrowbar + "CROWBAR", - GT_MetaGenerated_Tool_01.INSTANCE.getToolWithStats( - GT_MetaGenerated_Tool_01.CROWBAR, 1, (aCrowbar ? BAD : GOOD), Materials.Tungsten, null)); - mToolStacks.put( - aHammer + "HARDHAMMER", - GT_MetaGenerated_Tool_01.INSTANCE.getToolWithStats( - GT_MetaGenerated_Tool_01.HARDHAMMER, 1, (aHammer ? BAD : GOOD), Materials.Tungsten, null)); - mToolStacks.put( - aMallet + "SOFTHAMMER", - GT_MetaGenerated_Tool_01.INSTANCE.getToolWithStats( - GT_MetaGenerated_Tool_01.SOFTHAMMER, 1, (aMallet ? BAD : GOOD), Materials.Tungsten, null)); - mToolStacks.put( - aScrewdriver + "SCREWDRIVER", - GT_MetaGenerated_Tool_01.INSTANCE.getToolWithStats( - GT_MetaGenerated_Tool_01.SCREWDRIVER, - 1, - (aScrewdriver ? BAD : GOOD), - Materials.Tungsten, - null)); - mToolStacks.put( - aSoldering + "SOLDERING_IRON_LV", - GT_MetaGenerated_Tool_01.INSTANCE.getToolWithStats( - GT_MetaGenerated_Tool_01.SOLDERING_IRON_LV, - 1, - (aSoldering ? BAD : GOOD), - Materials.Tungsten, - null)); - - ItemStack aGlassPane1 = ItemUtils.getItemStackOfAmountFromOreDict("paneGlassRed", 1); - ItemStack aGlassPane2 = ItemUtils.getItemStackOfAmountFromOreDict("paneGlassLime", 1); - mToolStacks.put("falseGLASS", aGlassPane1); - mToolStacks.put("trueGLASS", aGlassPane2); - - // Reset vars to real state - aWrench = (((CONTAINER_MultiMachine) this.mContainer).mDisplayErrorCode & 1) != 0; - aScrewdriver = (((CONTAINER_MultiMachine) this.mContainer).mDisplayErrorCode & 2) != 0; - aMallet = (((CONTAINER_MultiMachine) this.mContainer).mDisplayErrorCode & 4) != 0; - aHammer = (((CONTAINER_MultiMachine) this.mContainer).mDisplayErrorCode & 8) != 0; - aSoldering = (((CONTAINER_MultiMachine) this.mContainer).mDisplayErrorCode & 16) != 0; - aCrowbar = (((CONTAINER_MultiMachine) this.mContainer).mDisplayErrorCode & 32) != 0; - } - - ItemStack aWrenchStack; - ItemStack aCrowbarStack; - ItemStack aHammerStack; - ItemStack aMalletStack; - ItemStack aScrewdriverStack; - ItemStack aSolderingStack; - if (!mToolStacks.isEmpty() && mDrawItemStack != null) { - - aWrenchStack = mToolStacks.get(aWrench + "WRENCH"); - aCrowbarStack = mToolStacks.get(aCrowbar + "CROWBAR"); - aHammerStack = mToolStacks.get(aHammer + "HARDHAMMER"); - aMalletStack = mToolStacks.get(aMallet + "SOFTHAMMER"); - aScrewdriverStack = mToolStacks.get(aScrewdriver + "SCREWDRIVER"); - aSolderingStack = mToolStacks.get(aSoldering + "SOLDERING_IRON_LV"); - - try { - - ItemStack[] aToolStacks2 = new ItemStack[] { - aWrenchStack, aCrowbarStack, - aHammerStack, aMalletStack, - aScrewdriverStack, aSolderingStack - }; - - int aIndex = 0; - // Draw Repair status tools - for (aIndex = 0; aIndex < 6; aIndex++) { - int x = 156; - int y = 112 - (18 * 3) + (aIndex * 18); - mDrawItemStack.invoke(this, new Object[] { - aToolStacks2[aIndex] != null ? aToolStacks2[aIndex] : ItemUtils.getErrorStack(1, "Bad Times"), - x, - y, - "" + (aIndex == 2 ? "H" : aIndex == 3 ? "M" : "") // Stacksize Overlay - }); - // this.fontRendererObj.drawString("", 10, 64, 16448255); - } - - // Draw Running status - boolean running = ((CONTAINER_MultiMachine) this.mContainer).mActive != 0; - ItemStack aGlassPane = mToolStacks.get(running + "GLASS"); - - if (aGlassPane == null) { - aGlassPane = ItemUtils.getItemStackOfAmountFromOreDict("paneGlass" + (running ? "Lime" : "Red"), 1); - mToolStacks.put(running + "GLASS", aGlassPane); - } - - mDrawItemStack.invoke(this, new Object[] { - aGlassPane != null ? aGlassPane : ItemUtils.getErrorStack(1, "Bad Times"), - 156, - 112 - (18 * 5), - running ? "On" : "Off" - }); // Stacksize Overlay - - } catch (IllegalAccessException | IllegalArgumentException | InvocationTargetException e) { - e.printStackTrace(); - } - } - } - - @Override - protected void drawGuiContainerBackgroundLayer(final float par1, final int par2, final int par3) { - super.drawGuiContainerBackgroundLayer(par1, par2, par3); - final int x = (this.width - this.xSize) / 2; - final int y = (this.height - this.ySize) / 2; - this.drawTexturedModalRect(x, y, 0, 0, this.xSize, this.ySize); - } -} diff --git a/src/main/java/gtPlusPlus/xmod/gregtech/api/gui/GUI_MultiMachine_Default.java b/src/main/java/gtPlusPlus/xmod/gregtech/api/gui/GUI_MultiMachine_Default.java deleted file mode 100644 index e8d7a5e096..0000000000 --- a/src/main/java/gtPlusPlus/xmod/gregtech/api/gui/GUI_MultiMachine_Default.java +++ /dev/null @@ -1,72 +0,0 @@ -package gtPlusPlus.xmod.gregtech.api.gui; - -import gregtech.api.gui.GT_GUIContainerMetaTile_Machine; -import gregtech.api.interfaces.tileentity.IGregTechTileEntity; -import gregtech.api.util.GT_LanguageManager; -import gtPlusPlus.core.lib.CORE; -import net.minecraft.entity.player.InventoryPlayer; - -public class GUI_MultiMachine_Default extends GT_GUIContainerMetaTile_Machine { - String mName; - - public GUI_MultiMachine_Default( - final InventoryPlayer aInventoryPlayer, - final IGregTechTileEntity aTileEntity, - final String aName, - final String aTextureFile) { - super( - new CONTAINER_MultiMachine(aInventoryPlayer, aTileEntity), - CORE.RES_PATH_GUI + ((aTextureFile == null) ? "MultiblockDisplay" : aTextureFile)); - this.mName = ""; - this.mName = aName; - } - - @Override - protected void drawGuiContainerForegroundLayer(final int par1, final int par2) { - this.fontRendererObj.drawString(this.mName, 10, 8, 16448255); - if (this.mContainer != null) { - if ((((CONTAINER_MultiMachine) this.mContainer).mDisplayErrorCode & 0x1) != 0x0) { - this.fontRendererObj.drawString(this.trans("132", "Pipe is loose."), 10, 16, 16448255); - } - if ((((CONTAINER_MultiMachine) this.mContainer).mDisplayErrorCode & 0x2) != 0x0) { - this.fontRendererObj.drawString(this.trans("133", "Screws are loose."), 10, 24, 16448255); - } - if ((((CONTAINER_MultiMachine) this.mContainer).mDisplayErrorCode & 0x4) != 0x0) { - this.fontRendererObj.drawString(this.trans("134", "Something is stuck."), 10, 32, 16448255); - } - if ((((CONTAINER_MultiMachine) this.mContainer).mDisplayErrorCode & 0x8) != 0x0) { - this.fontRendererObj.drawString(this.trans("135", "Platings are dented."), 10, 40, 16448255); - } - if ((((CONTAINER_MultiMachine) this.mContainer).mDisplayErrorCode & 0x10) != 0x0) { - this.fontRendererObj.drawString(this.trans("136", "Circuitry burned out."), 10, 48, 16448255); - } - if ((((CONTAINER_MultiMachine) this.mContainer).mDisplayErrorCode & 0x20) != 0x0) { - this.fontRendererObj.drawString(this.trans("137", "That doesn't belong there."), 10, 56, 16448255); - } - if ((((CONTAINER_MultiMachine) this.mContainer).mDisplayErrorCode & 0x40) != 0x0) { - this.fontRendererObj.drawString(this.trans("138", "Incomplete Structure."), 10, 64, 16448255); - } - if (((CONTAINER_MultiMachine) this.mContainer).mDisplayErrorCode == 0) { - if (((CONTAINER_MultiMachine) this.mContainer).mActive == 0) { - this.fontRendererObj.drawString(this.trans("139", "Hit with Soft Mallet"), 10, 16, 16448255); - this.fontRendererObj.drawString(this.trans("140", "to (re-)start the Machine"), 10, 24, 16448255); - this.fontRendererObj.drawString(this.trans("141", "if it doesn't start."), 10, 32, 16448255); - } else { - this.fontRendererObj.drawString(this.trans("142", "Running perfectly."), 10, 16, 16448255); - } - } - } - } - - public String trans(final String aKey, final String aEnglish) { - return GT_LanguageManager.addStringLocalization("Interaction_DESCRIPTION_Index_" + aKey, aEnglish, false); - } - - @Override - protected void drawGuiContainerBackgroundLayer(final float par1, final int par2, final int par3) { - super.drawGuiContainerBackgroundLayer(par1, par2, par3); - final int x = (this.width - this.xSize) / 2; - final int y = (this.height - this.ySize) / 2; - this.drawTexturedModalRect(x, y, 0, 0, this.xSize, this.ySize); - } -} diff --git a/src/main/java/gtPlusPlus/xmod/gregtech/api/gui/GUI_Multi_Basic_Slotted.java b/src/main/java/gtPlusPlus/xmod/gregtech/api/gui/GUI_Multi_Basic_Slotted.java deleted file mode 100644 index 4050b5958a..0000000000 --- a/src/main/java/gtPlusPlus/xmod/gregtech/api/gui/GUI_Multi_Basic_Slotted.java +++ /dev/null @@ -1,92 +0,0 @@ -package gtPlusPlus.xmod.gregtech.api.gui; - -import gregtech.api.gui.GT_Container_MultiMachine; -import gregtech.api.gui.GT_GUIContainerMetaTile_Machine; -import gregtech.api.interfaces.tileentity.IGregTechTileEntity; -import gregtech.api.util.GT_LanguageManager; -import gregtech.common.items.GT_MetaGenerated_Tool_01; -import gregtech.common.tileentities.machines.multi.GT_MetaTileEntity_LargeTurbine; -import gtPlusPlus.core.lib.CORE; -import net.minecraft.entity.player.InventoryPlayer; -import net.minecraft.item.ItemStack; - -public class GUI_Multi_Basic_Slotted extends GT_GUIContainerMetaTile_Machine { - String mName = ""; - - public GUI_Multi_Basic_Slotted( - InventoryPlayer aInventoryPlayer, IGregTechTileEntity aTileEntity, String aName, String aTextureFile) { - super( - new GT_Container_MultiMachine(aInventoryPlayer, aTileEntity), - CORE.RES_PATH_GUI + (aTextureFile == null ? "MultiblockDisplay" : aTextureFile)); - this.mName = aName; - } - - protected void drawGuiContainerForegroundLayer(int par1, int par2) { - this.fontRendererObj.drawString(this.mName, 10, 8, 16448255); - if (this.mContainer != null) { - if ((((GT_Container_MultiMachine) this.mContainer).mDisplayErrorCode & 1) != 0) { - this.fontRendererObj.drawString(this.trans("132", "Pipe is loose."), 10, 16, 16448255); - } - - if ((((GT_Container_MultiMachine) this.mContainer).mDisplayErrorCode & 2) != 0) { - this.fontRendererObj.drawString(this.trans("133", "Screws are loose."), 10, 24, 16448255); - } - - if ((((GT_Container_MultiMachine) this.mContainer).mDisplayErrorCode & 4) != 0) { - this.fontRendererObj.drawString(this.trans("134", "Something is stuck."), 10, 32, 16448255); - } - - if ((((GT_Container_MultiMachine) this.mContainer).mDisplayErrorCode & 8) != 0) { - this.fontRendererObj.drawString(this.trans("135", "Platings are dented."), 10, 40, 16448255); - } - - if ((((GT_Container_MultiMachine) this.mContainer).mDisplayErrorCode & 16) != 0) { - this.fontRendererObj.drawString(this.trans("136", "Circuitry burned out."), 10, 48, 16448255); - } - - if ((((GT_Container_MultiMachine) this.mContainer).mDisplayErrorCode & 32) != 0) { - this.fontRendererObj.drawString(this.trans("137", "That doesn't belong there."), 10, 56, 16448255); - } - - if ((((GT_Container_MultiMachine) this.mContainer).mDisplayErrorCode & 64) != 0) { - this.fontRendererObj.drawString(this.trans("138", "Incomplete Structure."), 10, 64, 16448255); - } - - if (((GT_Container_MultiMachine) this.mContainer).mDisplayErrorCode == 0) { - if (((GT_Container_MultiMachine) this.mContainer).mActive == 0) { - this.fontRendererObj.drawString(this.trans("139", "Hit with Soft Mallet"), 10, 16, 16448255); - this.fontRendererObj.drawString(this.trans("140", "to (re-)start the Machine"), 10, 24, 16448255); - this.fontRendererObj.drawString(this.trans("141", "if it doesn't start."), 10, 32, 16448255); - } else { - this.fontRendererObj.drawString(this.trans("142", "Running perfectly."), 10, 16, 16448255); - } - - ItemStack tItem; - if (this.mContainer.mTileEntity.getMetaTileEntity() instanceof GT_MetaTileEntity_LargeTurbine) { - tItem = this.mContainer.mTileEntity.getMetaTileEntity().getStackInSlot(1); - if (tItem == null - || tItem.getItem() != GT_MetaGenerated_Tool_01.INSTANCE - || tItem.getItemDamage() < 170 - || tItem.getItemDamage() > 177) { - this.fontRendererObj.drawString( - this.trans("144", "Missing Turbine Rotor"), - 10, - ((GT_Container_MultiMachine) this.mContainer).mActive == 0 ? 40 : 24, - 16448255); - } - } - } - } - } - - public String trans(String aKey, String aEnglish) { - return GT_LanguageManager.addStringLocalization("Interaction_DESCRIPTION_Index_" + aKey, aEnglish, false); - } - - protected void drawGuiContainerBackgroundLayer(float par1, int par2, int par3) { - super.drawGuiContainerBackgroundLayer(par1, par2, par3); - int x = (this.width - this.xSize) / 2; - int y = (this.height - this.ySize) / 2; - this.drawTexturedModalRect(x, y, 0, 0, this.xSize, this.ySize); - } -} diff --git a/src/main/java/gtPlusPlus/xmod/gregtech/api/gui/GUI_PowerSubStation.java b/src/main/java/gtPlusPlus/xmod/gregtech/api/gui/GUI_PowerSubStation.java deleted file mode 100644 index beb6c1dc3e..0000000000 --- a/src/main/java/gtPlusPlus/xmod/gregtech/api/gui/GUI_PowerSubStation.java +++ /dev/null @@ -1,134 +0,0 @@ -package gtPlusPlus.xmod.gregtech.api.gui; - -import gregtech.api.gui.GT_GUIContainerMetaTile_Machine; -import gregtech.api.interfaces.tileentity.IGregTechTileEntity; -import gregtech.api.util.GT_Utility; -import gtPlusPlus.core.lib.CORE; -import gtPlusPlus.core.util.Utils; -import gtPlusPlus.core.util.math.MathUtils; -import net.minecraft.entity.player.InventoryPlayer; - -public class GUI_PowerSubStation extends GT_GUIContainerMetaTile_Machine { - public String mNEI; - String mName; - boolean[] mRepairStatus = new boolean[6]; - - public final CONTAINER_PowerSubStation mPowerContainer; - - public GUI_PowerSubStation( - final InventoryPlayer aInventoryPlayer, - final IGregTechTileEntity aTileEntity, - final String aName, - final String aNEI) { - super( - new CONTAINER_PowerSubStation(aInventoryPlayer, aTileEntity, false), - CORE.RES_PATH_GUI + "PowerSubStation.png"); - this.mName = aName; - this.mNEI = aNEI; - mPowerContainer = (CONTAINER_PowerSubStation) mContainer; - /** The X size of the inventory window in pixels. */ - this.xSize = 196; - /** The Y size of the inventory window in pixels. */ - this.ySize = 191; - } - - protected void drawGuiContainerForegroundLayer(final int par1, final int par2) { - this.fontRendererObj.drawString(this.mName, 8, -10, 16448255); - if (this.mPowerContainer != null) { - - // this.fontRendererObj.drawString("Error Code: " + mPowerContainer.mDisplayErrorCode, 10, 142, 16448255); - - if (((this.mContainer).mDisplayErrorCode & 1) != 0) { - mRepairStatus[0] = false; - } else { - mRepairStatus[0] = true; - } - if ((mPowerContainer.mDisplayErrorCode & 2) != 0) { - mRepairStatus[1] = false; - } else { - mRepairStatus[1] = true; - } - if ((mPowerContainer.mDisplayErrorCode & 4) != 0) { - mRepairStatus[2] = false; - } else { - mRepairStatus[2] = true; - } - if ((mPowerContainer.mDisplayErrorCode & 8) != 0) { - mRepairStatus[3] = false; - } else { - mRepairStatus[3] = true; - } - if ((mPowerContainer.mDisplayErrorCode & 16) != 0) { - mRepairStatus[4] = false; - } else { - mRepairStatus[4] = true; - } - if ((mPowerContainer.mDisplayErrorCode & 32) != 0) { - mRepairStatus[5] = false; - } else { - mRepairStatus[5] = true; - } - if (mPowerContainer.mDisplayErrorCode == 0) { - if (mPowerContainer.mActive == 0) { - this.fontRendererObj.drawString("Turn on with Mallet", 10, 8, 16448255); - } else { - this.fontRendererObj.drawString("Running perfectly", 10, 8, 16448255); - } - } - - this.fontRendererObj.drawString("In", 178, 10, 16448255); - this.fontRendererObj.drawString("Out", 176, 28, 16448255); - this.fontRendererObj.drawString( - "Avg In: " + GT_Utility.formatNumbers(this.mPowerContainer.mAverageEuAdded.getValue()) + " EU", - 10, - 20, - 16448255); - this.fontRendererObj.drawString( - "Avg Out: " + GT_Utility.formatNumbers(this.mPowerContainer.mAverageEuConsumed.getValue()) + " EU", - 10, - 30, - 16448255); - - final double tScale2 = MathUtils.findPercentage( - this.mPowerContainer.mStoredEU.getValue(), this.mPowerContainer.mMaxStoredEU.getValue()); - final int tScale = (int) (tScale2 * 2.55); - this.fontRendererObj.drawString("Stored:", 10, 132, 16448255); - this.fontRendererObj.drawString( - GT_Utility.formatNumbers(this.mPowerContainer.mStoredEU.getValue()) + " EU", - 10, - 142, - Utils.rgbtoHexValue((255 - tScale), (0 + tScale), 0)); - this.fontRendererObj.drawString(GT_Utility.formatNumbers(tScale2) + "%", 70, 155, 16448255); - } - } - - protected void drawGuiContainerBackgroundLayer(final float par1, final int par2, final int par3) { - /** The X size of the inventory window in pixels. */ - if (this.xSize != 196) this.xSize = 196; - /** The Y size of the inventory window in pixels. */ - if (this.ySize != 191) this.ySize = 191; - super.drawGuiContainerBackgroundLayer(par1, par2, par3); - final int x = (this.width - this.xSize) / 2; - final int y = (this.height - this.ySize) / 2; - this.drawTexturedModalRect(x, y, 0, 0, this.xSize, this.ySize); - if (this.mPowerContainer != null) { - final double tScale = MathUtils.findPercentage( - this.mPowerContainer.mStoredEU.getValue(), this.mPowerContainer.mMaxStoredEU.getValue()) - / 100; - this.drawTexturedModalRect(x + 5, y + 156, 0, 251, Math.min(147, (int) (tScale * 148.0)), 5); - - // A1 - this.drawTexturedModalRect(x + 154, y + 76, 238, (!mRepairStatus[0] ? 0 : 18), 18, 18); - // A2 - this.drawTexturedModalRect(x + 154 + 20, y + 76, 238, (!mRepairStatus[1] ? 0 : 18), 18, 18); - // B1 - this.drawTexturedModalRect(x + 154, y + 76 + 18, 238, (!mRepairStatus[2] ? 0 : 18), 18, 18); - // B2 - this.drawTexturedModalRect(x + 154 + 20, y + 76 + 18, 238, (!mRepairStatus[3] ? 0 : 18), 18, 18); - // C1 - this.drawTexturedModalRect(x + 154, y + 76 + 36, 238, (!mRepairStatus[4] ? 0 : 18), 18, 18); - // C2 - this.drawTexturedModalRect(x + 154 + 20, y + 76 + 36, 238, (!mRepairStatus[5] ? 0 : 18), 18, 18); - } - } -} diff --git a/src/main/java/gtPlusPlus/xmod/gregtech/api/gui/GUI_SafeBlock.java b/src/main/java/gtPlusPlus/xmod/gregtech/api/gui/GUI_SafeBlock.java deleted file mode 100644 index c44dbd0e1f..0000000000 --- a/src/main/java/gtPlusPlus/xmod/gregtech/api/gui/GUI_SafeBlock.java +++ /dev/null @@ -1,46 +0,0 @@ -package gtPlusPlus.xmod.gregtech.api.gui; - -import gregtech.api.gui.GT_GUIContainerMetaTile_Machine; -import gregtech.api.interfaces.tileentity.IGregTechTileEntity; -import gtPlusPlus.core.lib.CORE; -import net.minecraft.entity.player.InventoryPlayer; - -public class GUI_SafeBlock extends GT_GUIContainerMetaTile_Machine { - public GUI_SafeBlock(final InventoryPlayer aInventoryPlayer, final IGregTechTileEntity aTileEntity) { - super(new CONTAINER_SafeBlock(aInventoryPlayer, aTileEntity), CORE.RES_PATH_GUI + "SafeBlock.png"); - } - - // String UUID = ((CONTAINER_SafeBlock)this.mContainer).ownerUUID.toString(); - boolean blockStatus = ((CONTAINER_SafeBlock) this.mContainer).blockStatus; - // String tempPlayer; - - private void updateVars() { - // UUID = ((CONTAINER_SafeBlock)this.mContainer).ownerUUID; - this.blockStatus = ((CONTAINER_SafeBlock) this.mContainer).blockStatus; - // tempPlayer = PlayerCache.lookupPlayerByUUID(UUID); - } - - @Override - protected void drawGuiContainerForegroundLayer(final int par1, final int par2) { - this.updateVars(); - // this.fontRendererObj.drawString("Owner: "+ tempPlayer, 64, 72, 4210752); - // this.fontRendererObj.drawString(": "+ UUID.toLowerCase(), 44, 82, 4210752); - this.fontRendererObj.drawString("Safe Status", 76, 61, 4210752); - if (this.blockStatus) { - this.fontRendererObj.drawString("Locked", 88, 73, 4210752); - } else { - this.fontRendererObj.drawString("Unlocked", 82, 73, 4210752); - } - } - - @Override - protected void drawGuiContainerBackgroundLayer(final float par1, final int par2, final int par3) { - super.drawGuiContainerBackgroundLayer(par1, par2, par3); - final int x = (this.width - this.xSize) / 2; - final int y = (this.height - this.ySize) / 2; - this.drawTexturedModalRect(x, y, 0, 0, this.xSize, this.ySize); - /*String UUID = ((CONTAINER_SafeBlock)this.mContainer).UUID; - this.fontRendererObj.drawString("Owner UUID: "+ UUID, 8, 12, 4210752);*/ - - } -} diff --git a/src/main/java/gtPlusPlus/xmod/gregtech/api/gui/GUI_SolarGenerator.java b/src/main/java/gtPlusPlus/xmod/gregtech/api/gui/GUI_SolarGenerator.java deleted file mode 100644 index 8fb63fe148..0000000000 --- a/src/main/java/gtPlusPlus/xmod/gregtech/api/gui/GUI_SolarGenerator.java +++ /dev/null @@ -1,43 +0,0 @@ -package gtPlusPlus.xmod.gregtech.api.gui; - -import gregtech.api.gui.GT_GUIContainerMetaTile_Machine; -import gregtech.api.interfaces.tileentity.IGregTechTileEntity; -import net.minecraft.entity.player.InventoryPlayer; - -public class GUI_SolarGenerator extends GT_GUIContainerMetaTile_Machine { - public GUI_SolarGenerator( - final InventoryPlayer aInventoryPlayer, final IGregTechTileEntity aTileEntity, final String aTextureName) { - super(new CONTAINER_SolarGenerator(aInventoryPlayer, aTileEntity), "gregtech:textures/gui/" + aTextureName); - } - - @Override - protected void drawGuiContainerForegroundLayer(final int par1, final int par2) { - this.fontRendererObj.drawString("Solar Generator", 8, 4, 4210752); - } - - @Override - protected void drawGuiContainerBackgroundLayer(final float par1, final int par2, final int par3) { - super.drawGuiContainerBackgroundLayer(par1, par2, par3); - final int x = (this.width - this.xSize) / 2; - final int y = (this.height - this.ySize) / 2; - this.drawTexturedModalRect(x, y, 0, 0, this.xSize, this.ySize); - if (this.mContainer != null) { - int tScale = ((CONTAINER_SolarGenerator) this.mContainer).mProcessingEnergy; - if (tScale > 0) { - this.drawTexturedModalRect(x + 70, (y + 25 + 54) - tScale, 194, 54 - tScale, 10, tScale); - } - tScale = ((CONTAINER_SolarGenerator) this.mContainer).mEnergy; - if (tScale > 0) { - this.drawTexturedModalRect(x + 83, (y + 25 + 54) - tScale, 204, 54 - tScale, 10, tScale); - } - tScale = ((CONTAINER_SolarGenerator) this.mContainer).mTemperature; - if (tScale > 0) { - this.drawTexturedModalRect(x + 96, (y + 25 + 54) - tScale, 214, 54 - tScale, 10, tScale); - } - tScale = ((CONTAINER_SolarGenerator) this.mContainer).mProcessingEnergy; - if (tScale > 0) { - this.drawTexturedModalRect(x + 117, (y + 44 + 14) - tScale, 177, 14 - tScale, 15, tScale + 1); - } - } - } -} diff --git a/src/main/java/gtPlusPlus/xmod/gregtech/api/gui/GUI_SteamCondenser.java b/src/main/java/gtPlusPlus/xmod/gregtech/api/gui/GUI_SteamCondenser.java deleted file mode 100644 index de3d56bdac..0000000000 --- a/src/main/java/gtPlusPlus/xmod/gregtech/api/gui/GUI_SteamCondenser.java +++ /dev/null @@ -1,52 +0,0 @@ -package gtPlusPlus.xmod.gregtech.api.gui; - -import gregtech.api.gui.GT_GUIContainerMetaTile_Machine; -import gregtech.api.interfaces.tileentity.IGregTechTileEntity; -import gtPlusPlus.core.lib.CORE; -import gtPlusPlus.preloader.CORE_Preloader; -import net.minecraft.entity.player.InventoryPlayer; - -public class GUI_SteamCondenser extends GT_GUIContainerMetaTile_Machine { - long tickTime = 0; - - public GUI_SteamCondenser( - final InventoryPlayer aInventoryPlayer, final IGregTechTileEntity aTileEntity, final String aTextureName) { - super(new CONTAINER_SteamCondenser(aInventoryPlayer, aTileEntity), CORE.RES_PATH_GUI + aTextureName); - } - - @Override - protected void drawGuiContainerForegroundLayer(final int par1, final int par2) { - this.fontRendererObj.drawString("Condenser", 8, 4, 4210752); - if (CORE_Preloader.DEBUG_MODE) { - this.tickTime = ((CONTAINER_SteamCondenser) this.mContainer).mTickingTime; - this.fontRendererObj.drawString("Tick Time: " + this.tickTime, 8, 12, 4210752); - } - } - - @Override - protected void drawGuiContainerBackgroundLayer(final float par1, final int par2, final int par3) { - super.drawGuiContainerBackgroundLayer(par1, par2, par3); - final int x = (this.width - this.xSize) / 2; - final int y = (this.height - this.ySize) / 2; - this.drawTexturedModalRect(x, y, 0, 0, this.xSize, this.ySize); - if (this.mContainer != null) { - - int tScale = ((CONTAINER_SteamCondenser) this.mContainer).mSteamAmount; - if (tScale > 0) { - this.drawTexturedModalRect(x + 70, (y + 25 + 54) - tScale, 194, 54 - tScale, 10, tScale); - } - tScale = ((CONTAINER_SteamCondenser) this.mContainer).mWaterAmount; - if (tScale > 0) { - this.drawTexturedModalRect(x + 83, (y + 25 + 54) - tScale, 204, 54 - tScale, 10, tScale); - } - tScale = ((CONTAINER_SteamCondenser) this.mContainer).mTemperature; - if (tScale > 0) { - this.drawTexturedModalRect(x + 96, (y + 25 + 54) - tScale, 214, 54 - tScale, 10, tScale); - } - tScale = ((CONTAINER_SteamCondenser) this.mContainer).mProcessingEnergy; - if (tScale > 0) { - this.drawTexturedModalRect(x + 115, y + 44 + 2 /* - tScale*/, 177, 14 - tScale, 15, 1 + tScale); - } - } - } -} diff --git a/src/main/java/gtPlusPlus/xmod/gregtech/api/gui/GUI_SuperChest.java b/src/main/java/gtPlusPlus/xmod/gregtech/api/gui/GUI_SuperChest.java deleted file mode 100644 index b65ac110c3..0000000000 --- a/src/main/java/gtPlusPlus/xmod/gregtech/api/gui/GUI_SuperChest.java +++ /dev/null @@ -1,37 +0,0 @@ -package gtPlusPlus.xmod.gregtech.api.gui; - -import gregtech.api.gui.GT_GUIContainerMetaTile_Machine; -import gregtech.api.interfaces.tileentity.IGregTechTileEntity; -import gregtech.api.util.GT_Utility; -import net.minecraft.entity.player.InventoryPlayer; -import net.minecraft.util.StatCollector; - -public class GUI_SuperChest extends GT_GUIContainerMetaTile_Machine { - private final String mName; - - public GUI_SuperChest(InventoryPlayer aInventoryPlayer, IGregTechTileEntity aTileEntity, String aName) { - super(new CONTAINER_SuperChest(aInventoryPlayer, aTileEntity), "gregtech:textures/gui/BasicTank.png"); - this.mName = aName; - } - - protected void drawGuiContainerForegroundLayer(int par1, int par2) { - this.fontRendererObj.drawString( - StatCollector.translateToLocal("container.inventory"), 8, this.ySize - 96 + 2, 4210752); - this.fontRendererObj.drawString(this.mName, 8, 6, 4210752); - if (this.mContainer != null) { - this.fontRendererObj.drawString("Item Amount", 10, 20, 16448255); - this.fontRendererObj.drawString( - GT_Utility.parseNumberToString(((CONTAINER_SuperChest) this.mContainer).mContent), - 10, - 30, - 16448255); - } - } - - protected void drawGuiContainerBackgroundLayer(float par1, int par2, int par3) { - super.drawGuiContainerBackgroundLayer(par1, par2, par3); - int x = (this.width - this.xSize) / 2; - int y = (this.height - this.ySize) / 2; - this.drawTexturedModalRect(x, y, 0, 0, this.xSize, this.ySize); - } -} diff --git a/src/main/java/gtPlusPlus/xmod/gregtech/api/gui/GUI_TreeFarmer.java b/src/main/java/gtPlusPlus/xmod/gregtech/api/gui/GUI_TreeFarmer.java deleted file mode 100644 index af6c212fdf..0000000000 --- a/src/main/java/gtPlusPlus/xmod/gregtech/api/gui/GUI_TreeFarmer.java +++ /dev/null @@ -1,48 +0,0 @@ -package gtPlusPlus.xmod.gregtech.api.gui; - -import gregtech.api.gui.GT_GUIContainerMetaTile_Machine; -import gregtech.api.interfaces.tileentity.IGregTechTileEntity; -import gtPlusPlus.core.lib.CORE; -import net.minecraft.entity.player.InventoryPlayer; - -public class GUI_TreeFarmer extends GT_GUIContainerMetaTile_Machine { - - String mName = ""; - long maxPower = 0; - long storedPower = 0; - - public GUI_TreeFarmer( - final InventoryPlayer aInventoryPlayer, - final IGregTechTileEntity aTileEntity, - final String aName, - final String aTextureFile) { - super( - new CONTAINER_TreeFarmer(aInventoryPlayer, aTileEntity), - CORE.RES_PATH_GUI + (aTextureFile == null ? "MultiblockDisplay" : aTextureFile)); - this.mName = aName; - } - - @Override - protected void drawGuiContainerForegroundLayer(final int par1, final int par2) { - this.fontRendererObj.drawString(this.mName, 64, 6, 16448255); - if (this.mContainer != null) { - this.maxPower = ((CONTAINER_TreeFarmer) this.mContainer).maxEU; - this.storedPower = ((CONTAINER_TreeFarmer) this.mContainer).storedEU; - if (((CONTAINER_TreeFarmer) this.mContainer).mDisplayErrorCode == 0) { - this.fontRendererObj.drawString("Current Power: " + this.storedPower + "EU", 8, 52, 16448255); - this.fontRendererObj.drawString("Max Power: " + this.maxPower + "EU", 8, 60, 16448255); - this.fontRendererObj.drawString("Current operations left: " + (this.storedPower / 32), 8, 68, 16448255); - } - } - } - - @Override - protected void drawGuiContainerBackgroundLayer(final float par1, final int par2, final int par3) { - super.drawGuiContainerBackgroundLayer(par1, par2, par3); - this.maxPower = ((CONTAINER_TreeFarmer) this.mContainer).maxEU; - this.storedPower = ((CONTAINER_TreeFarmer) this.mContainer).storedEU; - final int x = (this.width - this.xSize) / 2; - final int y = (this.height - this.ySize) / 2; - this.drawTexturedModalRect(x, y, 0, 0, this.xSize, this.ySize); - } -} diff --git a/src/main/java/gtPlusPlus/xmod/gregtech/api/gui/SyncedLong.java b/src/main/java/gtPlusPlus/xmod/gregtech/api/gui/SyncedLong.java deleted file mode 100644 index c738d41422..0000000000 --- a/src/main/java/gtPlusPlus/xmod/gregtech/api/gui/SyncedLong.java +++ /dev/null @@ -1,59 +0,0 @@ -package gtPlusPlus.xmod.gregtech.api.gui; - -import gtPlusPlus.xmod.gregtech.api.gui.SyncedValueManager.SendChanges; - -/** - * A variable of long type that is automatically synchronized between client and server correctly. - * - * @author glee8e - */ -class SyncedLong { - private final int index; - private long value; - private final short[] pieces = new short[4]; - private int received; - - private boolean dirty = true; - - SyncedLong(int index) { - this.index = index; - } - - public long getValue() { - return value; - } - - public void setValue(long value) { - if (this.value != value) { - dirty = true; - this.value = value; - } - } - - void detectAndSendChanges(SendChanges func, int timer) { - if (dirty || (timer & 0xff) == 0) { - for (int i = 0; i < 4; i++) { - func.sendProgressBarUpdate(index + i, (int) ((value >> (16 * i)) & 0xffff)); - } - dirty = false; - } - } - - private long getPiece(int index) { - return ((long) pieces[index]) & 0xffff; - } - - boolean updateProgressBar(int short1, int short2) { - int offset = short1 - index; - if (offset >= 0 && offset < 4) { - pieces[offset] = (short) short2; - received |= (1 << offset); - if (received == 0b1111) { - value = (getPiece(0)) | (getPiece(1) << 16) | (getPiece(2) << 32) | (getPiece(3) << 48); - received = 0; - } - return true; - } - return false; - } -} diff --git a/src/main/java/gtPlusPlus/xmod/gregtech/api/gui/SyncedValueManager.java b/src/main/java/gtPlusPlus/xmod/gregtech/api/gui/SyncedValueManager.java deleted file mode 100644 index 219e503a99..0000000000 --- a/src/main/java/gtPlusPlus/xmod/gregtech/api/gui/SyncedValueManager.java +++ /dev/null @@ -1,42 +0,0 @@ -package gtPlusPlus.xmod.gregtech.api.gui; - -import java.util.ArrayList; -import java.util.List; - -/** - * A manager for managing synchronized variables. Handles large data type splitting and merging for you <b>correctly</b>. - * - * @author glee8e - */ -class SyncedValueManager { - private int offset; - private final List<SyncedLong> longs = new ArrayList<>(); - - SyncedValueManager(int offset) { - this.offset = offset; - } - - public SyncedLong allocateLong() { - SyncedLong ret = new SyncedLong(offset); - offset += 4; - longs.add(ret); - return ret; - } - - public void detectAndSendChanges(SendChanges func, int timer) { - for (SyncedLong val : longs) { - val.detectAndSendChanges(func, timer); - } - } - - public void updateProgressBar(int short1, int short2) { - for (SyncedLong val : longs) { - if (val.updateProgressBar(short1, short2)) return; - } - } - - @FunctionalInterface - public interface SendChanges { - void sendProgressBarUpdate(int short1, int short2); - } -} diff --git a/src/main/java/gtPlusPlus/xmod/gregtech/api/gui/automation/GT_Container_ElectricAutoWorkbench.java b/src/main/java/gtPlusPlus/xmod/gregtech/api/gui/automation/GT_Container_ElectricAutoWorkbench.java deleted file mode 100644 index 4efc08dad0..0000000000 --- a/src/main/java/gtPlusPlus/xmod/gregtech/api/gui/automation/GT_Container_ElectricAutoWorkbench.java +++ /dev/null @@ -1,137 +0,0 @@ -package gtPlusPlus.xmod.gregtech.api.gui.automation; - -import cpw.mods.fml.relauncher.Side; -import cpw.mods.fml.relauncher.SideOnly; -import gregtech.api.gui.GT_ContainerMetaTile_Machine; -import gregtech.api.gui.GT_Slot_Holo; -import gregtech.api.gui.GT_Slot_Output; -import gregtech.api.interfaces.tileentity.IGregTechTileEntity; -import gregtech.api.util.GT_Utility; -import gtPlusPlus.xmod.gregtech.common.tileentities.automation.GT_MetaTileEntity_ElectricAutoWorkbench; -import net.minecraft.entity.player.EntityPlayer; -import net.minecraft.entity.player.InventoryPlayer; -import net.minecraft.inventory.ICrafting; -import net.minecraft.inventory.Slot; -import net.minecraft.item.ItemStack; - -public class GT_Container_ElectricAutoWorkbench extends GT_ContainerMetaTile_Machine { - - public int mMode; - public int mThroughPut; - - public GT_Container_ElectricAutoWorkbench(InventoryPlayer aInventoryPlayer, IGregTechTileEntity aTileEntity) { - super(aInventoryPlayer, aTileEntity); - } - - public void addSlots(InventoryPlayer aInventoryPlayer) { - addSlotToContainer(new Slot(mTileEntity, 0, 8, 5)); - addSlotToContainer(new Slot(mTileEntity, 1, 26, 5)); - addSlotToContainer(new Slot(mTileEntity, 2, 44, 5)); - addSlotToContainer(new Slot(mTileEntity, 3, 8, 23)); - addSlotToContainer(new Slot(mTileEntity, 4, 26, 23)); - addSlotToContainer(new Slot(mTileEntity, 5, 44, 23)); - addSlotToContainer(new Slot(mTileEntity, 6, 8, 41)); - addSlotToContainer(new Slot(mTileEntity, 7, 26, 41)); - addSlotToContainer(new Slot(mTileEntity, 8, 44, 41)); - - addSlotToContainer(new GT_Slot_Output(mTileEntity, 9, 8, 60)); - addSlotToContainer(new GT_Slot_Output(mTileEntity, 10, 26, 60)); - addSlotToContainer(new GT_Slot_Output(mTileEntity, 11, 44, 60)); - addSlotToContainer(new GT_Slot_Output(mTileEntity, 12, 62, 60)); - addSlotToContainer(new GT_Slot_Output(mTileEntity, 13, 80, 60)); - addSlotToContainer(new GT_Slot_Output(mTileEntity, 14, 98, 60)); - addSlotToContainer(new GT_Slot_Output(mTileEntity, 15, 116, 60)); - addSlotToContainer(new GT_Slot_Output(mTileEntity, 16, 134, 60)); - addSlotToContainer(new GT_Slot_Output(mTileEntity, 17, 152, 60)); - - addSlotToContainer(new GT_Slot_Output(mTileEntity, 18, 152, 41)); - - addSlotToContainer(new GT_Slot_Holo(mTileEntity, 19, 64, 6, false, false, 1)); - addSlotToContainer(new GT_Slot_Holo(mTileEntity, 20, 81, 6, false, false, 1)); - addSlotToContainer(new GT_Slot_Holo(mTileEntity, 21, 98, 6, false, false, 1)); - addSlotToContainer(new GT_Slot_Holo(mTileEntity, 22, 64, 23, false, false, 1)); - addSlotToContainer(new GT_Slot_Holo(mTileEntity, 23, 81, 23, false, false, 1)); - addSlotToContainer(new GT_Slot_Holo(mTileEntity, 24, 98, 23, false, false, 1)); - addSlotToContainer(new GT_Slot_Holo(mTileEntity, 25, 64, 40, false, false, 1)); - addSlotToContainer(new GT_Slot_Holo(mTileEntity, 26, 81, 40, false, false, 1)); - addSlotToContainer(new GT_Slot_Holo(mTileEntity, 27, 98, 40, false, false, 1)); - - addSlotToContainer(new GT_Slot_Holo(mTileEntity, 28, 152, 5, false, false, 1)); - addSlotToContainer(new GT_Slot_Holo(mTileEntity, 29, 121, 41, false, false, 1)); - addSlotToContainer(new GT_Slot_Holo(mTileEntity, 29, 121, 5, false, false, 1)); - } - - public ItemStack slotClick(int aSlotIndex, int aMouseclick, int aShifthold, EntityPlayer aPlayer) { - if (aSlotIndex < 18) return super.slotClick(aSlotIndex, aMouseclick, aShifthold, aPlayer); - - Slot tSlot = (Slot) inventorySlots.get(aSlotIndex); - if (tSlot != null) { - if (mTileEntity.getMetaTileEntity() == null) return null; - if (aSlotIndex > 18 && aSlotIndex < 28) { - ItemStack tStack = aPlayer.inventory.getItemStack(); - if (tStack != null) { - tStack = GT_Utility.copy(1, tStack); - } - tSlot.putStack(tStack); - return null; - } - if (aSlotIndex == 28) return null; - if (aSlotIndex == 29) { - if (aMouseclick == 0) { - ((GT_MetaTileEntity_ElectricAutoWorkbench) mTileEntity.getMetaTileEntity()).switchModeForward(); - } else { - ((GT_MetaTileEntity_ElectricAutoWorkbench) mTileEntity.getMetaTileEntity()).switchModeBackward(); - } - return null; - } - if (aSlotIndex == 30) { - ((GT_MetaTileEntity_ElectricAutoWorkbench) mTileEntity.getMetaTileEntity()).switchThrough(); - return null; - } - } - - return super.slotClick(aSlotIndex, aMouseclick, aShifthold, aPlayer); - } - - public int getSlotCount() { - return 19; - } - - public int getShiftClickSlotCount() { - return 9; - } - - @Override - public void detectAndSendChanges() { - super.detectAndSendChanges(); - if (mTileEntity.isClientSide() || mTileEntity.getMetaTileEntity() == null) { - return; - } - mMode = ((GT_MetaTileEntity_ElectricAutoWorkbench) mTileEntity.getMetaTileEntity()).mMode; - mThroughPut = ((GT_MetaTileEntity_ElectricAutoWorkbench) mTileEntity.getMetaTileEntity()).mThroughPut; - for (Object crafter : this.crafters) { - ICrafting var1 = (ICrafting) crafter; - var1.sendProgressBarUpdate(this, 103, this.mMode); - var1.sendProgressBarUpdate(this, 104, this.mThroughPut); - } - } - - @Override - public void addCraftingToCrafters(ICrafting par1ICrafting) { - super.addCraftingToCrafters(par1ICrafting); - } - - @Override - @SideOnly(Side.CLIENT) - public void updateProgressBar(int par1, int par2) { - super.updateProgressBar(par1, par2); - switch (par1) { - case 103: - this.mMode = par2; - break; - case 104: - this.mThroughPut = par2; - break; - } - } -} diff --git a/src/main/java/gtPlusPlus/xmod/gregtech/api/gui/automation/GT_Container_ElectricInventoryManager.java b/src/main/java/gtPlusPlus/xmod/gregtech/api/gui/automation/GT_Container_ElectricInventoryManager.java deleted file mode 100644 index 0796c28a79..0000000000 --- a/src/main/java/gtPlusPlus/xmod/gregtech/api/gui/automation/GT_Container_ElectricInventoryManager.java +++ /dev/null @@ -1,316 +0,0 @@ -package gtPlusPlus.xmod.gregtech.api.gui.automation; - -import cpw.mods.fml.relauncher.Side; -import cpw.mods.fml.relauncher.SideOnly; -import gregtech.api.gui.GT_ContainerMetaTile_Machine; -import gregtech.api.gui.GT_Slot_Holo; -import gregtech.api.interfaces.tileentity.IGregTechTileEntity; -import gregtech.api.util.GT_Utility; -import gtPlusPlus.xmod.gregtech.common.tileentities.automation.GT_MetaTileEntity_ElectricInventoryManager; -import java.util.Iterator; -import net.minecraft.entity.player.EntityPlayer; -import net.minecraft.entity.player.InventoryPlayer; -import net.minecraft.inventory.ICrafting; -import net.minecraft.inventory.Slot; -import net.minecraft.item.ItemStack; -import net.minecraftforge.oredict.OreDictionary; - -public class GT_Container_ElectricInventoryManager extends GT_ContainerMetaTile_Machine { - - public int[] mTargetDirections = new int[] {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}; - public int[] mRangeDirections = new int[] {0, 0, 0, 0}; - public int mTargetInOut; - public int mTargetEnergy; - - public GT_Container_ElectricInventoryManager(InventoryPlayer aInventoryPlayer, IGregTechTileEntity aTileEntity) { - super(aInventoryPlayer, aTileEntity); - } - - public void addSlots(InventoryPlayer aInventoryPlayer) { - addSlotToContainer(new Slot(mTileEntity, 0, 155, 5)); - addSlotToContainer(new Slot(mTileEntity, 1, 155, 23)); - addSlotToContainer(new Slot(mTileEntity, 2, 155, 41)); - - addSlotToContainer(new GT_Slot_Holo(mTileEntity, 3, 5, 5, false, true, 1)); - addSlotToContainer(new GT_Slot_Holo(mTileEntity, 4, 5, 23, false, true, 1)); - addSlotToContainer(new GT_Slot_Holo(mTileEntity, 5, 5, 41, false, true, 1)); - addSlotToContainer(new GT_Slot_Holo(mTileEntity, 6, 61, 5, false, true, 1)); - addSlotToContainer(new GT_Slot_Holo(mTileEntity, 7, 61, 23, false, true, 1)); - addSlotToContainer(new GT_Slot_Holo(mTileEntity, 8, 61, 41, false, true, 1)); - addSlotToContainer(new GT_Slot_Holo(mTileEntity, 9, 80, 5, false, true, 1)); - addSlotToContainer(new GT_Slot_Holo(mTileEntity, 10, 80, 23, false, true, 1)); - addSlotToContainer(new GT_Slot_Holo(mTileEntity, 11, 80, 41, false, true, 1)); - addSlotToContainer(new GT_Slot_Holo(mTileEntity, 12, 136, 5, false, true, 1)); - addSlotToContainer(new GT_Slot_Holo(mTileEntity, 13, 136, 23, false, true, 1)); - addSlotToContainer(new GT_Slot_Holo(mTileEntity, 14, 136, 41, false, true, 1)); - - addSlotToContainer(new GT_Slot_Holo(mTileEntity, 15, 24, 5, false, true, 1)); - addSlotToContainer(new GT_Slot_Holo(mTileEntity, 15, 24, 23, false, true, 1)); - addSlotToContainer(new GT_Slot_Holo(mTileEntity, 15, 24, 41, false, true, 1)); - addSlotToContainer(new GT_Slot_Holo(mTileEntity, 15, 42, 5, false, true, 1)); - addSlotToContainer(new GT_Slot_Holo(mTileEntity, 15, 42, 23, false, true, 1)); - addSlotToContainer(new GT_Slot_Holo(mTileEntity, 15, 42, 41, false, true, 1)); - addSlotToContainer(new GT_Slot_Holo(mTileEntity, 15, 99, 5, false, true, 1)); - addSlotToContainer(new GT_Slot_Holo(mTileEntity, 15, 99, 23, false, true, 1)); - addSlotToContainer(new GT_Slot_Holo(mTileEntity, 15, 99, 41, false, true, 1)); - addSlotToContainer(new GT_Slot_Holo(mTileEntity, 15, 117, 5, false, true, 1)); - addSlotToContainer(new GT_Slot_Holo(mTileEntity, 15, 117, 23, false, true, 1)); - addSlotToContainer(new GT_Slot_Holo(mTileEntity, 15, 117, 41, false, true, 1)); - - addSlotToContainer(new GT_Slot_Holo(mTileEntity, 15, 24, 60, false, true, 1)); - addSlotToContainer(new GT_Slot_Holo(mTileEntity, 15, 42, 60, false, true, 1)); - addSlotToContainer(new GT_Slot_Holo(mTileEntity, 15, 99, 60, false, true, 1)); - addSlotToContainer(new GT_Slot_Holo(mTileEntity, 15, 117, 60, false, true, 1)); - - addSlotToContainer(new GT_Slot_Holo(mTileEntity, 15, 5, 60, false, true, 1)); - addSlotToContainer(new GT_Slot_Holo(mTileEntity, 15, 61, 60, false, true, 1)); - addSlotToContainer(new GT_Slot_Holo(mTileEntity, 15, 80, 60, false, true, 1)); - addSlotToContainer(new GT_Slot_Holo(mTileEntity, 15, 136, 60, false, true, 1)); - } - - public ItemStack slotClick(int aSlotIndex, int aMouseclick, int aShifthold, EntityPlayer aPlayer) { - if (aSlotIndex < 3 || aSlotIndex >= getAllSlotCount()) - return super.slotClick(aSlotIndex, aMouseclick, aShifthold, aPlayer); - Slot tSlot = (Slot) inventorySlots.get(aSlotIndex); - if (tSlot != null) { - if (mTileEntity.getMetaTileEntity() == null) return null; - if (aSlotIndex < 15) { - ItemStack tStack = aPlayer.inventory.getItemStack(); - if (tStack != null) { - tStack = GT_Utility.copy(tStack); - if (aMouseclick != 0) { - tStack.setItemDamage(OreDictionary.WILDCARD_VALUE); - } - tSlot.putStack(tStack); - } else { - if (tSlot.getStack() != null) { - if (aMouseclick == 0) { - tSlot.getStack().stackSize -= (aShifthold == 1 ? 8 : 1); - if (tSlot.getStack().stackSize <= 0) { - tSlot.putStack(null); - } - } else { - tSlot.getStack().stackSize += (aShifthold == 1 ? 8 : 1); - if (tSlot.getStack().stackSize > tSlot.getStack().getMaxStackSize()) { - tSlot.getStack().stackSize = tSlot.getStack().getMaxStackSize(); - } - } - } - } - return null; - } else if (aSlotIndex >= 27 && aSlotIndex <= 30) { - ((GT_MetaTileEntity_ElectricInventoryManager) mTileEntity.getMetaTileEntity()) - .iterateRangeDirection(aSlotIndex - 27); - } else if (aSlotIndex >= 31 && aSlotIndex <= 34) { - ((GT_MetaTileEntity_ElectricInventoryManager) mTileEntity.getMetaTileEntity()) - .switchRangeEnergy(aSlotIndex - 31); - } else if (aSlotIndex % 3 == 0) { - if (aMouseclick != 0) - ((GT_MetaTileEntity_ElectricInventoryManager) mTileEntity.getMetaTileEntity()) - .switchSlot1InOut((aSlotIndex - 15) / 3); - else - ((GT_MetaTileEntity_ElectricInventoryManager) mTileEntity.getMetaTileEntity()) - .iterateSlot1Direction((aSlotIndex - 15) / 3); - } else if (aSlotIndex % 3 == 1) { - if (aMouseclick != 0) - ((GT_MetaTileEntity_ElectricInventoryManager) mTileEntity.getMetaTileEntity()) - .switchSlot2InOut((aSlotIndex - 16) / 3); - else - ((GT_MetaTileEntity_ElectricInventoryManager) mTileEntity.getMetaTileEntity()) - .iterateSlot2Direction((aSlotIndex - 16) / 3); - } else if (aSlotIndex % 3 == 2) { - if (aMouseclick != 0) - ((GT_MetaTileEntity_ElectricInventoryManager) mTileEntity.getMetaTileEntity()) - .switchSlot3InOut((aSlotIndex - 17) / 3); - else - ((GT_MetaTileEntity_ElectricInventoryManager) mTileEntity.getMetaTileEntity()) - .iterateSlot3Direction((aSlotIndex - 17) / 3); - } - } - return null; - } - - public void detectAndSendChanges() { - super.detectAndSendChanges(); - if (mTileEntity.isClientSide() || mTileEntity.getMetaTileEntity() == null) { - return; - } - mTargetDirections = new int[] {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}; - mRangeDirections = new int[] {0, 0, 0, 0}; - - mRangeDirections[0] = - ((GT_MetaTileEntity_ElectricInventoryManager) mTileEntity.getMetaTileEntity()).getRangeDirection(0); - mRangeDirections[1] = - ((GT_MetaTileEntity_ElectricInventoryManager) mTileEntity.getMetaTileEntity()).getRangeDirection(1); - mRangeDirections[2] = - ((GT_MetaTileEntity_ElectricInventoryManager) mTileEntity.getMetaTileEntity()).getRangeDirection(2); - mRangeDirections[3] = - ((GT_MetaTileEntity_ElectricInventoryManager) mTileEntity.getMetaTileEntity()).getRangeDirection(3); - - mTargetDirections[0] = - ((GT_MetaTileEntity_ElectricInventoryManager) mTileEntity.getMetaTileEntity()).getSlot1Direction(0); - mTargetDirections[1] = - ((GT_MetaTileEntity_ElectricInventoryManager) mTileEntity.getMetaTileEntity()).getSlot2Direction(0); - mTargetDirections[2] = - ((GT_MetaTileEntity_ElectricInventoryManager) mTileEntity.getMetaTileEntity()).getSlot3Direction(0); - mTargetDirections[3] = - ((GT_MetaTileEntity_ElectricInventoryManager) mTileEntity.getMetaTileEntity()).getSlot1Direction(1); - mTargetDirections[4] = - ((GT_MetaTileEntity_ElectricInventoryManager) mTileEntity.getMetaTileEntity()).getSlot2Direction(1); - mTargetDirections[5] = - ((GT_MetaTileEntity_ElectricInventoryManager) mTileEntity.getMetaTileEntity()).getSlot3Direction(1); - mTargetDirections[6] = - ((GT_MetaTileEntity_ElectricInventoryManager) mTileEntity.getMetaTileEntity()).getSlot1Direction(2); - mTargetDirections[7] = - ((GT_MetaTileEntity_ElectricInventoryManager) mTileEntity.getMetaTileEntity()).getSlot2Direction(2); - mTargetDirections[8] = - ((GT_MetaTileEntity_ElectricInventoryManager) mTileEntity.getMetaTileEntity()).getSlot3Direction(2); - mTargetDirections[9] = - ((GT_MetaTileEntity_ElectricInventoryManager) mTileEntity.getMetaTileEntity()).getSlot1Direction(3); - mTargetDirections[10] = - ((GT_MetaTileEntity_ElectricInventoryManager) mTileEntity.getMetaTileEntity()).getSlot2Direction(3); - mTargetDirections[11] = - ((GT_MetaTileEntity_ElectricInventoryManager) mTileEntity.getMetaTileEntity()).getSlot3Direction(3); - - mTargetInOut = 0; - mTargetInOut |= ((GT_MetaTileEntity_ElectricInventoryManager) mTileEntity.getMetaTileEntity()).getSlot1InOut(0) - ? 1 << 0 - : 0; - mTargetInOut |= ((GT_MetaTileEntity_ElectricInventoryManager) mTileEntity.getMetaTileEntity()).getSlot2InOut(0) - ? 1 << 1 - : 0; - mTargetInOut |= ((GT_MetaTileEntity_ElectricInventoryManager) mTileEntity.getMetaTileEntity()).getSlot3InOut(0) - ? 1 << 2 - : 0; - mTargetInOut |= ((GT_MetaTileEntity_ElectricInventoryManager) mTileEntity.getMetaTileEntity()).getSlot1InOut(1) - ? 1 << 3 - : 0; - mTargetInOut |= ((GT_MetaTileEntity_ElectricInventoryManager) mTileEntity.getMetaTileEntity()).getSlot2InOut(1) - ? 1 << 4 - : 0; - mTargetInOut |= ((GT_MetaTileEntity_ElectricInventoryManager) mTileEntity.getMetaTileEntity()).getSlot3InOut(1) - ? 1 << 5 - : 0; - mTargetInOut |= ((GT_MetaTileEntity_ElectricInventoryManager) mTileEntity.getMetaTileEntity()).getSlot1InOut(2) - ? 1 << 6 - : 0; - mTargetInOut |= ((GT_MetaTileEntity_ElectricInventoryManager) mTileEntity.getMetaTileEntity()).getSlot2InOut(2) - ? 1 << 7 - : 0; - mTargetInOut |= ((GT_MetaTileEntity_ElectricInventoryManager) mTileEntity.getMetaTileEntity()).getSlot3InOut(2) - ? 1 << 8 - : 0; - mTargetInOut |= ((GT_MetaTileEntity_ElectricInventoryManager) mTileEntity.getMetaTileEntity()).getSlot1InOut(3) - ? 1 << 9 - : 0; - mTargetInOut |= ((GT_MetaTileEntity_ElectricInventoryManager) mTileEntity.getMetaTileEntity()).getSlot2InOut(3) - ? 1 << 10 - : 0; - mTargetInOut |= ((GT_MetaTileEntity_ElectricInventoryManager) mTileEntity.getMetaTileEntity()).getSlot3InOut(3) - ? 1 << 11 - : 0; - - mTargetEnergy = 0; - mTargetEnergy |= - ((GT_MetaTileEntity_ElectricInventoryManager) mTileEntity.getMetaTileEntity()).getRangeEnergy(0) - ? 1 << 0 - : 0; - mTargetEnergy |= - ((GT_MetaTileEntity_ElectricInventoryManager) mTileEntity.getMetaTileEntity()).getRangeEnergy(1) - ? 1 << 1 - : 0; - mTargetEnergy |= - ((GT_MetaTileEntity_ElectricInventoryManager) mTileEntity.getMetaTileEntity()).getRangeEnergy(2) - ? 1 << 2 - : 0; - mTargetEnergy |= - ((GT_MetaTileEntity_ElectricInventoryManager) mTileEntity.getMetaTileEntity()).getRangeEnergy(3) - ? 1 << 3 - : 0; - - Iterator var2 = this.crafters.iterator(); - while (var2.hasNext()) { - ICrafting var1 = (ICrafting) var2.next(); - for (int i = 0; i < 12; i++) var1.sendProgressBarUpdate(this, 100 + i, mTargetDirections[i]); - var1.sendProgressBarUpdate(this, 113, mTargetInOut); - var1.sendProgressBarUpdate(this, 114, mTargetEnergy); - for (int i = 0; i < 4; i++) var1.sendProgressBarUpdate(this, 115 + i, mRangeDirections[i]); - } - } - - @Override - public void addCraftingToCrafters(ICrafting par1ICrafting) { - super.addCraftingToCrafters(par1ICrafting); - } - - @Override - @SideOnly(Side.CLIENT) - public void updateProgressBar(int par1, int par2) { - super.updateProgressBar(par1, par2); - switch (par1) { - case 100: - mTargetDirections[0] = par2; - break; - case 101: - mTargetDirections[1] = par2; - break; - case 102: - mTargetDirections[2] = par2; - break; - case 103: - mTargetDirections[3] = par2; - break; - case 104: - mTargetDirections[4] = par2; - break; - case 105: - mTargetDirections[5] = par2; - break; - case 106: - mTargetDirections[6] = par2; - break; - case 107: - mTargetDirections[7] = par2; - break; - case 108: - mTargetDirections[8] = par2; - break; - case 109: - mTargetDirections[9] = par2; - break; - case 110: - mTargetDirections[10] = par2; - break; - case 111: - mTargetDirections[11] = par2; - break; - - case 113: - mTargetInOut = par2; - break; - case 114: - mTargetEnergy = par2; - break; - case 115: - mRangeDirections[0] = par2; - break; - case 116: - mRangeDirections[1] = par2; - break; - case 117: - mRangeDirections[2] = par2; - break; - case 118: - mRangeDirections[3] = par2; - break; - } - } - - public int getSlotCount() { - return 3; - } - - public int getShiftClickSlotCount() { - return 3; - } -} diff --git a/src/main/java/gtPlusPlus/xmod/gregtech/api/gui/automation/GT_GUIContainer_ElectricAutoWorkbench.java b/src/main/java/gtPlusPlus/xmod/gregtech/api/gui/automation/GT_GUIContainer_ElectricAutoWorkbench.java deleted file mode 100644 index 6be7eb042e..0000000000 --- a/src/main/java/gtPlusPlus/xmod/gregtech/api/gui/automation/GT_GUIContainer_ElectricAutoWorkbench.java +++ /dev/null @@ -1,66 +0,0 @@ -package gtPlusPlus.xmod.gregtech.api.gui.automation; - -import gregtech.api.gui.GT_GUIContainerMetaTile_Machine; -import gregtech.api.interfaces.tileentity.IGregTechTileEntity; -import gtPlusPlus.core.lib.CORE; -import java.util.ArrayList; -import java.util.List; -import net.minecraft.client.renderer.RenderHelper; -import net.minecraft.entity.player.InventoryPlayer; - -public class GT_GUIContainer_ElectricAutoWorkbench extends GT_GUIContainerMetaTile_Machine { - - private static final String[] mModeText = new String[] { - "Normal Crafting Table", "???", "1x1", "2x2", "3x3", "Unifier", "Dust", "???", "Hammer?", "Circle" - }; - - public GT_GUIContainer_ElectricAutoWorkbench(InventoryPlayer aInventoryPlayer, IGregTechTileEntity aTileEntity) { - super( - new GT_Container_ElectricAutoWorkbench(aInventoryPlayer, aTileEntity), - CORE.RES_PATH_GUI + "ElectricAutoWorkbench.png"); - } - - @Override - protected void drawGuiContainerForegroundLayer(int par1, int par2) { - drawTooltip(par1, par2); - } - - @Override - protected void drawGuiContainerBackgroundLayer(float par1, int par2, int par3) { - super.drawGuiContainerBackgroundLayer(par1, par2, par3); - int x = (width - xSize) / 2; - int y = (height - ySize) / 2; - drawTexturedModalRect(x, y, 0, 0, xSize, ySize); - - if (mContainer != null) { - int tMode = ((GT_Container_ElectricAutoWorkbench) mContainer).mMode; - if (tMode != 0) drawTexturedModalRect(x + 120, y + 40, tMode * 18, 166, 18, 18); - tMode = ((GT_Container_ElectricAutoWorkbench) mContainer).mThroughPut; - drawTexturedModalRect(x + 120, y + 4, tMode * 18, 184, 18, 18); - } - } - - private void drawTooltip(final int x2, final int y2) { - final int xStart = (this.width - this.xSize) / 2; - final int yStart = (this.height - this.ySize) / 2; - final int x3 = x2 - xStart; - final int y3 = y2 - yStart + 5; - List<String> list = new ArrayList<>(); - String[] mModeText = new String[] { - "Normal Crafting Table", "???", "1x1", "2x2", "3x3", "Unifier", "Dust", "???", "Hammer?", "Circle" - }; - if (y3 >= 45 && y3 <= 62) { - if (x3 >= 120 && x3 <= 137) { - list.add("Mode: " + mModeText[((GT_Container_ElectricAutoWorkbench) mContainer).mMode]); - /*switch (((GT_Container_ElectricAutoWorkbench) mContainer).mMode) { - case 0: - list.add("Mode: "); - }*/ - } - } - if (!list.isEmpty()) { - drawHoveringText(list, x3, y3, fontRendererObj); - RenderHelper.enableGUIStandardItemLighting(); - } - } -} diff --git a/src/main/java/gtPlusPlus/xmod/gregtech/api/gui/automation/GT_GUIContainer_ElectricInventoryManager.java b/src/main/java/gtPlusPlus/xmod/gregtech/api/gui/automation/GT_GUIContainer_ElectricInventoryManager.java deleted file mode 100644 index 77357056ba..0000000000 --- a/src/main/java/gtPlusPlus/xmod/gregtech/api/gui/automation/GT_GUIContainer_ElectricInventoryManager.java +++ /dev/null @@ -1,202 +0,0 @@ -package gtPlusPlus.xmod.gregtech.api.gui.automation; - -import gregtech.api.gui.GT_GUIContainerMetaTile_Machine; -import gregtech.api.interfaces.tileentity.IGregTechTileEntity; -import gtPlusPlus.core.lib.CORE; -import net.minecraft.entity.player.InventoryPlayer; - -public class GT_GUIContainer_ElectricInventoryManager extends GT_GUIContainerMetaTile_Machine { - - public GT_GUIContainer_ElectricInventoryManager(InventoryPlayer aInventoryPlayer, IGregTechTileEntity aTileEntity) { - super( - new GT_Container_ElectricInventoryManager(aInventoryPlayer, aTileEntity), - CORE.RES_PATH_GUI + "InventoryManager.png"); - } - - @Override - protected void drawGuiContainerForegroundLayer(int par1, int par2) {} - - @Override - protected void drawGuiContainerBackgroundLayer(float par1, int par2, int par3) { - super.drawGuiContainerBackgroundLayer(par1, par2, par3); - int x = (width - xSize) / 2; - int y = (height - ySize) / 2; - drawTexturedModalRect(x, y, 0, 0, xSize, ySize); - - if (mContainer != null) { - drawTexturedModalRect( - x + 4, - y + 4, - ((GT_Container_ElectricInventoryManager) mContainer).mRangeDirections[0] * 18, - 202, - 18, - 54); - drawTexturedModalRect( - x + 60, - y + 4, - ((GT_Container_ElectricInventoryManager) mContainer).mRangeDirections[1] * 18, - 202, - 18, - 54); - drawTexturedModalRect( - x + 79, - y + 4, - ((GT_Container_ElectricInventoryManager) mContainer).mRangeDirections[2] * 18, - 202, - 18, - 54); - drawTexturedModalRect( - x + 135, - y + 4, - ((GT_Container_ElectricInventoryManager) mContainer).mRangeDirections[3] * 18, - 202, - 18, - 54); - - drawTexturedModalRect( - x + 23, - y + 59, - ((GT_Container_ElectricInventoryManager) mContainer).mRangeDirections[0] * 18 + 126, - 166, - 18, - 18); - drawTexturedModalRect( - x + 41, - y + 59, - ((GT_Container_ElectricInventoryManager) mContainer).mRangeDirections[1] * 18 + 126, - 166, - 18, - 18); - drawTexturedModalRect( - x + 98, - y + 59, - ((GT_Container_ElectricInventoryManager) mContainer).mRangeDirections[2] * 18 + 126, - 166, - 18, - 18); - drawTexturedModalRect( - x + 116, - y + 59, - ((GT_Container_ElectricInventoryManager) mContainer).mRangeDirections[3] * 18 + 126, - 166, - 18, - 18); - - drawTexturedModalRect( - x + 4, - y + 59, - 108, - (((GT_Container_ElectricInventoryManager) mContainer).mTargetEnergy & 1) != 0 ? 184 : 166, - 18, - 18); - drawTexturedModalRect( - x + 60, - y + 59, - 108, - (((GT_Container_ElectricInventoryManager) mContainer).mTargetEnergy & 2) != 0 ? 184 : 166, - 18, - 18); - drawTexturedModalRect( - x + 79, - y + 59, - 108, - (((GT_Container_ElectricInventoryManager) mContainer).mTargetEnergy & 4) != 0 ? 184 : 166, - 18, - 18); - drawTexturedModalRect( - x + 135, - y + 59, - 108, - (((GT_Container_ElectricInventoryManager) mContainer).mTargetEnergy & 8) != 0 ? 184 : 166, - 18, - 18); - - int i = -1; - - drawTexturedModalRect( - x + 23, - y + 4, - ((GT_Container_ElectricInventoryManager) mContainer).mTargetDirections[++i] * 18, - (((GT_Container_ElectricInventoryManager) mContainer).mTargetInOut & (1 << i)) != 0 ? 184 : 166, - 18, - 18); - drawTexturedModalRect( - x + 23, - y + 22, - ((GT_Container_ElectricInventoryManager) mContainer).mTargetDirections[++i] * 18, - (((GT_Container_ElectricInventoryManager) mContainer).mTargetInOut & (1 << i)) != 0 ? 184 : 166, - 18, - 18); - drawTexturedModalRect( - x + 23, - y + 40, - ((GT_Container_ElectricInventoryManager) mContainer).mTargetDirections[++i] * 18, - (((GT_Container_ElectricInventoryManager) mContainer).mTargetInOut & (1 << i)) != 0 ? 184 : 166, - 18, - 18); - drawTexturedModalRect( - x + 41, - y + 4, - ((GT_Container_ElectricInventoryManager) mContainer).mTargetDirections[++i] * 18, - (((GT_Container_ElectricInventoryManager) mContainer).mTargetInOut & (1 << i)) != 0 ? 184 : 166, - 18, - 18); - drawTexturedModalRect( - x + 41, - y + 22, - ((GT_Container_ElectricInventoryManager) mContainer).mTargetDirections[++i] * 18, - (((GT_Container_ElectricInventoryManager) mContainer).mTargetInOut & (1 << i)) != 0 ? 184 : 166, - 18, - 18); - drawTexturedModalRect( - x + 41, - y + 40, - ((GT_Container_ElectricInventoryManager) mContainer).mTargetDirections[++i] * 18, - (((GT_Container_ElectricInventoryManager) mContainer).mTargetInOut & (1 << i)) != 0 ? 184 : 166, - 18, - 18); - drawTexturedModalRect( - x + 98, - y + 4, - ((GT_Container_ElectricInventoryManager) mContainer).mTargetDirections[++i] * 18, - (((GT_Container_ElectricInventoryManager) mContainer).mTargetInOut & (1 << i)) != 0 ? 184 : 166, - 18, - 18); - drawTexturedModalRect( - x + 98, - y + 22, - ((GT_Container_ElectricInventoryManager) mContainer).mTargetDirections[++i] * 18, - (((GT_Container_ElectricInventoryManager) mContainer).mTargetInOut & (1 << i)) != 0 ? 184 : 166, - 18, - 18); - drawTexturedModalRect( - x + 98, - y + 40, - ((GT_Container_ElectricInventoryManager) mContainer).mTargetDirections[++i] * 18, - (((GT_Container_ElectricInventoryManager) mContainer).mTargetInOut & (1 << i)) != 0 ? 184 : 166, - 18, - 18); - drawTexturedModalRect( - x + 116, - y + 4, - ((GT_Container_ElectricInventoryManager) mContainer).mTargetDirections[++i] * 18, - (((GT_Container_ElectricInventoryManager) mContainer).mTargetInOut & (1 << i)) != 0 ? 184 : 166, - 18, - 18); - drawTexturedModalRect( - x + 116, - y + 22, - ((GT_Container_ElectricInventoryManager) mContainer).mTargetDirections[++i] * 18, - (((GT_Container_ElectricInventoryManager) mContainer).mTargetInOut & (1 << i)) != 0 ? 184 : 166, - 18, - 18); - drawTexturedModalRect( - x + 116, - y + 40, - ((GT_Container_ElectricInventoryManager) mContainer).mTargetDirections[++i] * 18, - (((GT_Container_ElectricInventoryManager) mContainer).mTargetInOut & (1 << i)) != 0 ? 184 : 166, - 18, - 18); - } - } -} diff --git a/src/main/java/gtPlusPlus/xmod/gregtech/api/gui/basic/CONTAINER_PollutionCleaner.java b/src/main/java/gtPlusPlus/xmod/gregtech/api/gui/basic/CONTAINER_PollutionCleaner.java deleted file mode 100644 index 373ba8ae08..0000000000 --- a/src/main/java/gtPlusPlus/xmod/gregtech/api/gui/basic/CONTAINER_PollutionCleaner.java +++ /dev/null @@ -1,100 +0,0 @@ -package gtPlusPlus.xmod.gregtech.api.gui.basic; - -import cpw.mods.fml.relauncher.Side; -import cpw.mods.fml.relauncher.SideOnly; -import gregtech.api.gui.*; -import gregtech.api.interfaces.tileentity.IGregTechTileEntity; -import gregtech.api.metatileentity.implementations.GT_MetaTileEntity_BasicMachine; -import gtPlusPlus.api.objects.Logger; -import gtPlusPlus.core.slots.SlotPollutionScrubber; -import gtPlusPlus.xmod.gregtech.common.tileentities.machines.basic.GregtechMetaAtmosphericReconditioner; -import java.util.Iterator; -import net.minecraft.entity.player.EntityPlayer; -import net.minecraft.entity.player.InventoryPlayer; -import net.minecraft.inventory.ICrafting; -import net.minecraft.item.ItemStack; - -/** - * NEVER INCLUDE THIS FILE IN YOUR MOD!!! - * <p/> - * The Container I use for all my Basic Machines - */ -public class CONTAINER_PollutionCleaner extends GT_Container_BasicTank { - - public boolean mFluidTransfer = false, mItemTransfer = false, mStuttering = false; - public int mReduction = 0; - - public CONTAINER_PollutionCleaner(InventoryPlayer aInventoryPlayer, IGregTechTileEntity aTileEntity) { - super(aInventoryPlayer, aTileEntity); - } - - @Override - public void addSlots(InventoryPlayer aInventoryPlayer) { - - int tStartIndex = ((GT_MetaTileEntity_BasicMachine) mTileEntity.getMetaTileEntity()).getInputSlot(); - int aTier = ((GT_MetaTileEntity_BasicMachine) mTileEntity.getMetaTileEntity()).mTier; - - // Add 2 Item Slots - addSlotToContainer(new SlotPollutionScrubber(0, aTier, mTileEntity, tStartIndex++, 53, 25)); - addSlotToContainer(new SlotPollutionScrubber(1, aTier, mTileEntity, tStartIndex++, 107, 25)); - // Upgrade Slot - addSlotToContainer(new SlotPollutionScrubber(2, aTier, mTileEntity, tStartIndex++, 125, 63)); - } - - @Override - public ItemStack slotClick(int aSlotIndex, int aMouseclick, int aShifthold, EntityPlayer aPlayer) { - Logger.INFO("Clicked on slot " + aSlotIndex); - return super.slotClick(aSlotIndex, aMouseclick, aShifthold, aPlayer); - } - - @Override - public void detectAndSendChanges() { - super.detectAndSendChanges(); - if (mTileEntity.isClientSide() || mTileEntity.getMetaTileEntity() == null) return; - - Logger.INFO("TEST"); - mReduction = ((GregtechMetaAtmosphericReconditioner) mTileEntity.getMetaTileEntity()).mPollutionReduction; - - Iterator var2 = this.crafters.iterator(); - while (var2.hasNext()) { - ICrafting var1 = (ICrafting) var2.next(); - var1.sendProgressBarUpdate(this, 105, mReduction); - } - } - - @Override - public void addCraftingToCrafters(ICrafting par1ICrafting) { - super.addCraftingToCrafters(par1ICrafting); - } - - @Override - @SideOnly(Side.CLIENT) - public void updateProgressBar(int par1, int par2) { - super.updateProgressBar(par1, par2); - switch (par1) { - case 105: - mReduction = (par2); - break; - } - } - - @Override - public int getSlotStartIndex() { - return 0; - } - - @Override - public int getShiftClickStartIndex() { - return 0; - } - - @Override - public int getSlotCount() { - return getShiftClickSlotCount(); - } - - @Override - public int getShiftClickSlotCount() { - return 3; - } -} diff --git a/src/main/java/gtPlusPlus/xmod/gregtech/api/gui/basic/GT_Container_CropHarvestor.java b/src/main/java/gtPlusPlus/xmod/gregtech/api/gui/basic/GT_Container_CropHarvestor.java deleted file mode 100644 index 8380b2958f..0000000000 --- a/src/main/java/gtPlusPlus/xmod/gregtech/api/gui/basic/GT_Container_CropHarvestor.java +++ /dev/null @@ -1,179 +0,0 @@ -package gtPlusPlus.xmod.gregtech.api.gui.basic; - -import cpw.mods.fml.relauncher.Side; -import cpw.mods.fml.relauncher.SideOnly; -import gregtech.api.gui.GT_ContainerMetaTile_Machine; -import gregtech.api.gui.GT_Slot_Holo; -import gregtech.api.interfaces.tileentity.IGregTechTileEntity; -import gtPlusPlus.core.slots.SlotNoInput; -import gtPlusPlus.xmod.gregtech.common.tileentities.machines.basic.GT_MetaTileEntity_CropHarvestor; -import ic2.core.item.ItemIC2; -import net.minecraft.entity.player.EntityPlayer; -import net.minecraft.entity.player.InventoryPlayer; -import net.minecraft.inventory.ICrafting; -import net.minecraft.inventory.IInventory; -import net.minecraft.inventory.Slot; -import net.minecraft.item.ItemStack; - -public class GT_Container_CropHarvestor extends GT_ContainerMetaTile_Machine { - - public boolean mModeAlternative = false; - public int mWaterAmount = 0; - public int mWaterRealAmount = 0; - - public GT_Container_CropHarvestor(InventoryPlayer aInventoryPlayer, IGregTechTileEntity aTileEntity) { - super(aInventoryPlayer, aTileEntity); - } - - public void addSlots(InventoryPlayer aInventoryPlayer) { - - int aSlot = 1; - - addSlotToContainer(new GT_Slot_Holo(mTileEntity, 0, 48, 64, false, true, 1)); - addSlotToContainer(new SlotWeedEx(mTileEntity, aSlot++, 8, 14)); - addSlotToContainer(new SlotWeedEx(mTileEntity, aSlot++, 26, 14)); - addSlotToContainer(new SlotFertilizer(mTileEntity, aSlot++, 8, 32)); - addSlotToContainer(new SlotFertilizer(mTileEntity, aSlot++, 26, 32)); - addSlotToContainer(new SlotFertilizer(mTileEntity, aSlot++, 8, 50)); - addSlotToContainer(new SlotFertilizer(mTileEntity, aSlot++, 26, 50)); - - addSlotToContainer(new SlotNoInput(mTileEntity, aSlot++, 61, 7)); - addSlotToContainer(new SlotNoInput(mTileEntity, aSlot++, 79, 7)); - addSlotToContainer(new SlotNoInput(mTileEntity, aSlot++, 97, 7)); - addSlotToContainer(new SlotNoInput(mTileEntity, aSlot++, 115, 7)); - addSlotToContainer(new SlotNoInput(mTileEntity, aSlot++, 133, 7)); - addSlotToContainer(new SlotNoInput(mTileEntity, aSlot++, 151, 7)); - - addSlotToContainer(new SlotNoInput(mTileEntity, aSlot++, 61, 25)); - addSlotToContainer(new SlotNoInput(mTileEntity, aSlot++, 79, 25)); - addSlotToContainer(new SlotNoInput(mTileEntity, aSlot++, 97, 25)); - addSlotToContainer(new SlotNoInput(mTileEntity, aSlot++, 115, 25)); - addSlotToContainer(new SlotNoInput(mTileEntity, aSlot++, 133, 25)); - addSlotToContainer(new SlotNoInput(mTileEntity, aSlot++, 151, 25)); - - addSlotToContainer(new SlotNoInput(mTileEntity, aSlot++, 61, 43)); - addSlotToContainer(new SlotNoInput(mTileEntity, aSlot++, 79, 43)); - addSlotToContainer(new SlotNoInput(mTileEntity, aSlot++, 97, 43)); - addSlotToContainer(new SlotNoInput(mTileEntity, aSlot++, 115, 43)); - addSlotToContainer(new SlotNoInput(mTileEntity, aSlot++, 133, 43)); - addSlotToContainer(new SlotNoInput(mTileEntity, aSlot++, 151, 43)); - } - - public ItemStack slotClick(int aSlotIndex, int aMouseclick, int aShifthold, EntityPlayer aPlayer) { - - GT_MetaTileEntity_CropHarvestor machine = (GT_MetaTileEntity_CropHarvestor) mTileEntity.getMetaTileEntity(); - - if (aSlotIndex == 0) { - machine.mModeAlternative = !machine.mModeAlternative; - return null; - } - - return super.slotClick(aSlotIndex, aMouseclick, aShifthold, aPlayer); - } - - @Override - public int getSlotCount() { - return 24; - } - - @Override - public int getSlotStartIndex() { - return 1; - } - - @Override - public int getShiftClickSlotCount() { - return 6; - } - - @Override - public void detectAndSendChanges() { - super.detectAndSendChanges(); - if (mTileEntity.isClientSide() || mTileEntity.getMetaTileEntity() == null) { - return; - } - - // GT_MetaTileEntity_Boiler.getCapacity() is used for both water and steam capacity. - int capacity = ((GT_MetaTileEntity_CropHarvestor) this.mTileEntity.getMetaTileEntity()).getCapacity(); - - mModeAlternative = ((GT_MetaTileEntity_CropHarvestor) mTileEntity.getMetaTileEntity()).mModeAlternative; - mWaterRealAmount = ((GT_MetaTileEntity_CropHarvestor) mTileEntity.getMetaTileEntity()).getFluidAmount(); - this.mWaterAmount = Math.min(54, Math.max(0, this.mWaterRealAmount * 54 / (capacity - 100))); - for (Object crafter : this.crafters) { - ICrafting var1 = (ICrafting) crafter; - var1.sendProgressBarUpdate(this, 102, mModeAlternative ? 1 : 0); - var1.sendProgressBarUpdate(this, 103, this.mWaterAmount); - var1.sendProgressBarUpdate(this, 104, this.mWaterRealAmount); - } - } - - @Override - public void addCraftingToCrafters(ICrafting par1ICrafting) { - super.addCraftingToCrafters(par1ICrafting); - } - - @Override - @SideOnly(Side.CLIENT) - public void updateProgressBar(int par1, int par2) { - super.updateProgressBar(par1, par2); - switch (par1) { - case 102: - mModeAlternative = (par2 != 0); - break; - case 103: - this.mWaterAmount = par2; - break; - case 104: - this.mWaterRealAmount = par2; - break; - } - } - - public static class SlotWeedEx extends Slot { - - public SlotWeedEx(final IInventory inventory, final int slot, final int x, final int y) { - super(inventory, slot, x, y); - } - - @Override - public synchronized boolean isItemValid(final ItemStack itemstack) { - return isWeedEx(itemstack); - } - - @Override - public int getSlotStackLimit() { - return 1; - } - - private static boolean isWeedEx(ItemStack aStack) { - if (aStack != null && aStack.getItem() instanceof ItemIC2) { - if (aStack.getItem().getUnlocalizedName().equals("ic2.itemWeedEx")) { - return true; - } - } - return false; - } - } - - public class SlotFertilizer extends Slot { - - public SlotFertilizer(final IInventory inventory, final int slot, final int x, final int y) { - super(inventory, slot, x, y); - } - - @Override - public synchronized boolean isItemValid(final ItemStack aStack) { - if (aStack != null && aStack.getItem() instanceof ItemIC2) { - if (aStack.getItem().getUnlocalizedName().equals("ic2.itemFertilizer")) { - return true; - } - } - return false; - } - - @Override - public int getSlotStackLimit() { - return 64; - } - } -} diff --git a/src/main/java/gtPlusPlus/xmod/gregtech/api/gui/basic/GT_GUIContainer_CropHarvestor.java b/src/main/java/gtPlusPlus/xmod/gregtech/api/gui/basic/GT_GUIContainer_CropHarvestor.java deleted file mode 100644 index 1b04ab15fe..0000000000 --- a/src/main/java/gtPlusPlus/xmod/gregtech/api/gui/basic/GT_GUIContainer_CropHarvestor.java +++ /dev/null @@ -1,77 +0,0 @@ -package gtPlusPlus.xmod.gregtech.api.gui.basic; - -import gregtech.api.gui.GT_GUIContainerMetaTile_Machine; -import gregtech.api.interfaces.tileentity.IGregTechTileEntity; -import gtPlusPlus.core.lib.CORE; -import java.util.ArrayList; -import java.util.List; -import net.minecraft.client.renderer.RenderHelper; -import net.minecraft.entity.player.InventoryPlayer; - -public class GT_GUIContainer_CropHarvestor extends GT_GUIContainerMetaTile_Machine { - - private final String mLocalName; - - public GT_GUIContainer_CropHarvestor( - InventoryPlayer aInventoryPlayer, IGregTechTileEntity aTileEntity, String aLocalName) { - super(new GT_Container_CropHarvestor(aInventoryPlayer, aTileEntity), CORE.RES_PATH_GUI + "CropHarvestor.png"); - mLocalName = aLocalName; - } - - @Override - protected void drawGuiContainerForegroundLayer(int par1, int par2) { - drawTooltip(par1, par2); - // fontRendererObj.drawString("Crop Manager ("+this.mContainer.mTileEntity.getInputVoltage()+"v)", 8, 4, - // 4210752); - // fontRendererObj.drawString(mLocalName, 70, 69, 4210752); - } - - @Override - protected void drawGuiContainerBackgroundLayer(float par1, int par2, int par3) { - super.drawGuiContainerBackgroundLayer(par1, par2, par3); - int x = (width - xSize) / 2; - int y = (height - ySize) / 2; - drawTexturedModalRect(x, y, 0, 0, xSize, ySize); - - if (((GT_Container_CropHarvestor) mContainer).mModeAlternative) { - drawTexturedModalRect(x + 48, y + 64, 177, 37, 16, 16); - } - - int tScale = ((GT_Container_CropHarvestor) this.mContainer).mWaterAmount; - if (tScale > 0) { - drawTexturedModalRect(x + 47, y + 61 - tScale, 204, 54 - tScale, 10, tScale); - } - ; - } - - private void drawTooltip(int x2, int y2) { - int xStart = (width - xSize) / 2; - int yStart = (height - ySize) / 2; - int x = x2 - xStart; - int y = y2 - yStart + 5; - List<String> list = new ArrayList<>(); - if (y >= 68 && y <= 85) { - if (x >= 47 && x <= 64) { - if (((GT_Container_CropHarvestor) mContainer).mModeAlternative) { - list.add("Disable Hydration/Fertilizing/Weed-EX"); - } else { - list.add("Enable Hydration/Fertilizing/Weed-EX"); - } - } - } - if (y >= 12 && y <= 66) { - if (x >= 47 && x <= 56) { - int aWater = ((GT_Container_CropHarvestor) mContainer).mWaterRealAmount; - list.add("Water: " + aWater + "L / " - + ((GT_Container_CropHarvestor) mContainer) - .mTileEntity - .getMetaTileEntity() - .getCapacity() + "L"); - } - } - if (!list.isEmpty()) { - drawHoveringText(list, x, y, fontRendererObj); - RenderHelper.enableGUIStandardItemLighting(); - } - } -} diff --git a/src/main/java/gtPlusPlus/xmod/gregtech/api/gui/basic/GUI_PollutionCleaner.java b/src/main/java/gtPlusPlus/xmod/gregtech/api/gui/basic/GUI_PollutionCleaner.java deleted file mode 100644 index 3e4280f650..0000000000 --- a/src/main/java/gtPlusPlus/xmod/gregtech/api/gui/basic/GUI_PollutionCleaner.java +++ /dev/null @@ -1,76 +0,0 @@ -package gtPlusPlus.xmod.gregtech.api.gui.basic; - -import gregtech.api.gui.GT_GUIContainerMetaTile_Machine; -import gregtech.api.interfaces.tileentity.IGregTechTileEntity; -import gtPlusPlus.core.lib.CORE; -import java.util.ArrayList; -import java.util.List; -import net.minecraft.client.renderer.RenderHelper; -import net.minecraft.entity.player.InventoryPlayer; - -public class GUI_PollutionCleaner extends GT_GUIContainerMetaTile_Machine { - public final String mName; - public final String mNEI; - public final byte mProgressBarDirection; - public final byte mProgressBarAmount; - public int mReduction; - - public GUI_PollutionCleaner( - final InventoryPlayer aInventoryPlayer, - final IGregTechTileEntity aTileEntity, - final String aName, - final String aTextureFile) { - this(aInventoryPlayer, aTileEntity, aName, aTextureFile, "PollutionCleaner", (byte) 0, (byte) 1); - } - - public GUI_PollutionCleaner( - final InventoryPlayer aInventoryPlayer, - final IGregTechTileEntity aTileEntity, - final String aName, - final String aTextureFile, - final String aNEI, - final byte aProgressBarDirection, - final byte aProgressBarAmount) { - super( - new CONTAINER_PollutionCleaner(aInventoryPlayer, aTileEntity), - CORE.RES_PATH_GUI + "PollutionCleaner.png"); - this.mProgressBarDirection = aProgressBarDirection; - this.mProgressBarAmount = (byte) Math.max(1, aProgressBarAmount); - this.mName = aName; - this.mNEI = aNEI; - } - - @Override - protected void drawGuiContainerForegroundLayer(final int par1, final int par2) { - this.fontRendererObj.drawString(this.mName, 8, 4, 4210752); - this.drawTooltip(par1, par2); - } - - private void drawTooltip(final int x2, final int y2) { - final int xStart = (this.width - this.xSize) / 2; - final int yStart = (this.height - this.ySize) / 2; - final int x3 = x2 - xStart; - final int y3 = y2 - yStart + 5; - final List<String> list = new ArrayList<String>(); - if (y3 >= 67 && y3 <= 84) { - if (x3 >= 77 && x3 <= 95) { - // Do Dumb shit - CONTAINER_PollutionCleaner aContainerCast = (CONTAINER_PollutionCleaner) this.mContainer; - mReduction = aContainerCast.mReduction; - list.add("Reduction: " + mReduction + "/s"); - } - } - if (!list.isEmpty()) { - this.drawHoveringText(list, x3, y3, this.fontRendererObj); - RenderHelper.enableGUIStandardItemLighting(); - } - } - - @Override - protected void drawGuiContainerBackgroundLayer(final float par1, final int par2, final int par3) { - super.drawGuiContainerBackgroundLayer(par1, par2, par3); - final int x = (this.width - this.xSize) / 2; - final int y = (this.height - this.ySize) / 2; - this.drawTexturedModalRect(x, y, 0, 0, this.xSize, this.ySize); - } -} diff --git a/src/main/java/gtPlusPlus/xmod/gregtech/api/gui/computer/GT_Container_ComputerCube.java b/src/main/java/gtPlusPlus/xmod/gregtech/api/gui/computer/GT_Container_ComputerCube.java deleted file mode 100644 index 5aa0da1c8c..0000000000 --- a/src/main/java/gtPlusPlus/xmod/gregtech/api/gui/computer/GT_Container_ComputerCube.java +++ /dev/null @@ -1,407 +0,0 @@ -package gtPlusPlus.xmod.gregtech.api.gui.computer; - -import cpw.mods.fml.relauncher.Side; -import cpw.mods.fml.relauncher.SideOnly; -import gregtech.api.gui.*; -import gregtech.api.interfaces.tileentity.IGregTechTileEntity; -import gregtech.api.objects.GT_ItemStack; -import gtPlusPlus.api.objects.Logger; -import gtPlusPlus.core.slots.SlotDataStick; -import gtPlusPlus.core.util.Utils; -import gtPlusPlus.core.util.math.MathUtils; -import gtPlusPlus.xmod.gregtech.common.tileentities.misc.GT_TileEntity_ComputerCube; -import java.util.Iterator; -import net.minecraft.entity.player.*; -import net.minecraft.inventory.*; -import net.minecraft.item.ItemStack; - -public class GT_Container_ComputerCube extends GT_ContainerMetaTile_Machine { - - public long mEUOut; - public int mEUOut1; - public int mEUOut2; - - public int mHeat; - - public int mMaxHeat; - - public int mHEM; - - public int mExplosionStrength; - - public long mEU; - public int mEU1; - public int mEU2; - - public long mStoredEU; - public int mStoredEU1; - public int mStoredEU2; - public long mMaxStoredEU; - public int mMaxStoredEU1; - public int mMaxStoredEU2; - - public int mProgress; - - public int mID; - - public GT_Container_ComputerCube(InventoryPlayer aInventoryPlayer, IGregTechTileEntity aTileEntity, int aID) { - super(aInventoryPlayer, aTileEntity); - Logger.INFO("1 Container Mode: " + aID); - Logger.INFO("2 Container Mode: " + getMode()); - mID = getMode(); - Logger.INFO("3 Container Mode: " + getMode()); - // addSlotsComputer(aInventoryPlayer); - detectAndSendChanges(); - } - - public void addSlots(InventoryPlayer aInventoryPlayer) { - addSlotsComputer(aInventoryPlayer); - } - - private int getMode() { - return ((GT_TileEntity_ComputerCube) mTileEntity.getMetaTileEntity()).mMode; - } - - public void addSlotsComputer(InventoryPlayer aInventoryPlayer) { - int y; - mID = ((GT_TileEntity_ComputerCube) mTileEntity.getMetaTileEntity()).mMode; - Logger.INFO("" + (Utils.isClient() ? "Client" : "Server") + " Mode: " + mID); - addSlotToContainer( - new GT_Slot_Holo(this.mTileEntity, 58, 156 + ((this.mID == 5) ? 50 : 0), 4, false, false, 1)); - switch (this.mID) { - case 1: - addSlotToContainer(new GT_Slot_Holo(this.mTileEntity, 58, 156, 86, false, false, 1)); - addSlotToContainer(new GT_Slot_Holo(this.mTileEntity, 58, 156, 70, false, false, 1)); - addSlotToContainer(new GT_Slot_Holo(this.mTileEntity, 58, 156, 54, false, false, 1)); - for (y = 0; y < 6; y++) { - for (int x = 0; x < 9; x++) - addSlotToContainer(new GT_Slot_Holo( - this.mTileEntity, x + y * 9, 5 + x * 16, 5 + y * 16, false, false, 64)); - } - addSlotToContainer(new GT_Slot_Holo(this.mTileEntity, 113, 153, 28, false, false, 64)); - break; - case 2: - addSlotToContainer(new SlotDataStick(this.mTileEntity, 54, 8, 28)); - addSlotToContainer(new Slot(this.mTileEntity, 55, 26, 28)); - addSlotToContainer(new GT_Slot_Output(this.mTileEntity, 56, 134, 28)); - addSlotToContainer(new GT_Slot_Output(this.mTileEntity, 57, 152, 28)); - break; - case 3: - addSlotToContainer(new GT_Slot_Holo(this.mTileEntity, 58, 88, 65, false, false, 1)); - addSlotToContainer(new GT_Slot_Holo(this.mTileEntity, 58, 104, 65, false, false, 1)); - addSlotToContainer(new GT_Slot_Holo(this.mTileEntity, 59, 122, 35, false, false, 64)); - addSlotToContainer(new GT_Slot_Holo(this.mTileEntity, 60, 92, 5, false, false, 64)); - addSlotToContainer(new GT_Slot_Holo(this.mTileEntity, 61, 122, 5, false, false, 64)); - addSlotToContainer(new GT_Slot_Holo(this.mTileEntity, 62, 152, 35, false, false, 64)); - addSlotToContainer(new GT_Slot_Holo(this.mTileEntity, 63, 122, 65, false, false, 64)); - addSlotToContainer(new GT_Slot_Holo(this.mTileEntity, 64, 92, 35, false, false, 64)); - break; - case 4: - addSlotToContainer(new GT_Slot_Holo(this.mTileEntity, 58, 88, 65, false, false, 1)); - addSlotToContainer(new GT_Slot_Holo(this.mTileEntity, 58, 104, 65, false, false, 1)); - addSlotToContainer(new GT_Slot_Holo(this.mTileEntity, 59, 122, 5, false, false, 64)); - addSlotToContainer(new GT_Slot_Holo(this.mTileEntity, 60, 122, 65, false, false, 64)); - addSlotToContainer(new GT_Slot_Holo(this.mTileEntity, 61, 152, 35, false, false, 64)); - break; - case 5: - addSlotToContainer(new GT_Slot_Holo(this.mTileEntity, 58, 190, 146, false, false, 1)); - addSlotToContainer(new GT_Slot_Holo(this.mTileEntity, 58, 206, 146, false, false, 1)); - addSlotToContainer(new GT_Slot_Holo(this.mTileEntity, 59, 206, 38, false, false, 64)); - addSlotToContainer(new GT_Slot_Holo(this.mTileEntity, 60, 206, 56, false, false, 64)); - addSlotToContainer(new GT_Slot_Holo(this.mTileEntity, 61, 206, 74, false, false, 64)); - addSlotToContainer(new GT_Slot_Holo(this.mTileEntity, 62, 206, 92, false, false, 64)); - addSlotToContainer(new GT_Slot_Holo(this.mTileEntity, 63, 206, 110, false, false, 64)); - addSlotToContainer(new GT_Slot_Holo(this.mTileEntity, 64, 153, 7, false, false, 64)); - addSlotToContainer(new GT_Slot_Holo(this.mTileEntity, 65, 169, 7, false, false, 64)); - addSlotToContainer(new GT_Slot_Holo(this.mTileEntity, 66, 185, 7, false, false, 64)); - addSlotToContainer(new GT_Slot_Holo(this.mTileEntity, 67, 153, 23, false, false, 64)); - addSlotToContainer(new GT_Slot_Holo(this.mTileEntity, 68, 169, 23, false, false, 64)); - addSlotToContainer(new GT_Slot_Holo(this.mTileEntity, 69, 185, 23, false, false, 64)); - addSlotToContainer(new GT_Slot_Holo(this.mTileEntity, 70, 153, 39, false, false, 64)); - addSlotToContainer(new GT_Slot_Holo(this.mTileEntity, 71, 169, 39, false, false, 64)); - addSlotToContainer(new GT_Slot_Holo(this.mTileEntity, 72, 185, 39, false, false, 64)); - break; - case 6: - addSlotToContainer(new GT_Slot_Holo(this.mTileEntity, 58, 88, 65, false, false, 1)); - addSlotToContainer(new GT_Slot_Holo(this.mTileEntity, 58, 104, 65, false, false, 1)); - addSlotToContainer(new GT_Slot_Holo(this.mTileEntity, 59, 122, 35, false, false, 64)); - addSlotToContainer(new GT_Slot_Holo(this.mTileEntity, 60, 92, 5, false, false, 64)); - addSlotToContainer(new GT_Slot_Holo(this.mTileEntity, 61, 122, 5, false, false, 64)); - addSlotToContainer(new GT_Slot_Holo(this.mTileEntity, 62, 152, 35, false, false, 64)); - addSlotToContainer(new GT_Slot_Holo(this.mTileEntity, 63, 122, 65, false, false, 64)); - addSlotToContainer(new GT_Slot_Holo(this.mTileEntity, 64, 92, 35, false, false, 64)); - break; - } - } - - public ItemStack slotClick(int aSlotIndex, int aMouseclick, int aShifthold, EntityPlayer aPlayer) { - // Logger.INFO("Clicked slot " + aSlotIndex); - if (aSlotIndex < 0) { - // Logger.INFO(""); - return super.slotClick(aSlotIndex, aMouseclick, aShifthold, aPlayer); - } - if (this.mID != ((GT_TileEntity_ComputerCube) mTileEntity.getMetaTileEntity()).mMode) { - // Logger.INFO("This ID: " + mID + ", Tile: " + ((GT_TileEntity_ComputerCube) - // mTileEntity.getMetaTileEntity()).mMode); - return null; - } - Slot tSlot = (Slot) this.inventorySlots.get(aSlotIndex); - if (tSlot == null) { - // Logger.INFO("Null Slot?"); - } else { - ItemStack tStack = tSlot.getStack(); - // Logger.INFO("Good Slot!"); - if (aSlotIndex == 0) { - // Logger.INFO("Slot is 0"); - if (aMouseclick == 0) { - Logger.INFO("Forward"); - ((GT_TileEntity_ComputerCube) mTileEntity.getMetaTileEntity()).switchModeForward(); - } else { - Logger.INFO("Backwards"); - ((GT_TileEntity_ComputerCube) mTileEntity.getMetaTileEntity()).switchModeBackward(); - } - if (aPlayer instanceof EntityPlayerMP) { - EntityPlayerMP aPlayerMP = (EntityPlayerMP) aPlayer; - changePage(aPlayerMP, ((GT_TileEntity_ComputerCube) mTileEntity.getMetaTileEntity()).mMode); - } - // FMLNetworkHandler.openGui(entityPlayer, mod, modGuiId, world, x, y, z); - // aPlayer.openGui(CORE.MODID, getComputerCubeGUIID(), this.mTileEntity.getWorld(), - // this.mTileEntity.getXCoord(), this.mTileEntity.getYCoord(), this.mTileEntity.getZCoord()); - } else if (aSlotIndex <= 2 && this.mID == 3) { - if (aSlotIndex == 1) { - ((GT_TileEntity_ComputerCube) mTileEntity.getMetaTileEntity()).switchCentrifugePageBackward(); - onCraftMatrixChanged(this.mTileEntity); - } else if (aSlotIndex == 2) { - ((GT_TileEntity_ComputerCube) mTileEntity.getMetaTileEntity()).switchCentrifugePageForward(); - onCraftMatrixChanged(this.mTileEntity); - } - } else if (aSlotIndex <= 2 && this.mID == 6) { - if (aSlotIndex == 1) { - ((GT_TileEntity_ComputerCube) mTileEntity.getMetaTileEntity()).switchElectrolyzerPageBackward(); - onCraftMatrixChanged(this.mTileEntity); - } else if (aSlotIndex == 2) { - ((GT_TileEntity_ComputerCube) mTileEntity.getMetaTileEntity()).switchElectrolyzerPageForward(); - onCraftMatrixChanged(this.mTileEntity); - } - } else if (aSlotIndex <= 2 && this.mID == 4) { - if (aSlotIndex == 1) { - ((GT_TileEntity_ComputerCube) mTileEntity.getMetaTileEntity()).switchFusionPageBackward(); - onCraftMatrixChanged(this.mTileEntity); - } else if (aSlotIndex == 2) { - ((GT_TileEntity_ComputerCube) mTileEntity.getMetaTileEntity()).switchFusionPageForward(); - onCraftMatrixChanged(this.mTileEntity); - } - } else if (aSlotIndex <= 2 && this.mID == 5) { - if (aSlotIndex == 1) { - ((GT_TileEntity_ComputerCube) mTileEntity.getMetaTileEntity()).switchDescriptionPageBackward(); - onCraftMatrixChanged(this.mTileEntity); - } else if (aSlotIndex == 2) { - ((GT_TileEntity_ComputerCube) mTileEntity.getMetaTileEntity()).switchDescriptionPageForward(); - onCraftMatrixChanged(this.mTileEntity); - } - } else if (aSlotIndex <= 58 && this.mID == 1) { - if (aSlotIndex == 1) { - ((GT_TileEntity_ComputerCube) mTileEntity.getMetaTileEntity()).switchNuclearReactor(); - onCraftMatrixChanged(this.mTileEntity); - } else if (aSlotIndex == 2) { - ((GT_TileEntity_ComputerCube) mTileEntity.getMetaTileEntity()).loadNuclearReactor(); - onCraftMatrixChanged(this.mTileEntity); - } else if (aSlotIndex == 3) { - ((GT_TileEntity_ComputerCube) mTileEntity.getMetaTileEntity()).saveNuclearReactor(); - } else { - if (aShifthold == 1) { - tSlot.putStack(null); - ((GT_TileEntity_ComputerCube) mTileEntity.getMetaTileEntity()) - .getSimulator() - .slotClick(aSlotIndex, null); - return null; - } - - if (aMouseclick == 1) { - tSlot.putStack(null); - } - if (aMouseclick == 0) { - if (tStack == null) { - if (getSlot(58).getStack() != null && aSlotIndex != 58) { - tSlot.putStack(getSlot(58).getStack().copy()); - ((GT_TileEntity_ComputerCube) mTileEntity.getMetaTileEntity()) - .getSimulator() - .slotClick( - aSlotIndex, - new GT_ItemStack( - getSlot(58).getStack().copy())); - } else { - tSlot.putStack(new ItemStack(GT_TileEntity_ComputerCube.sReactorList.get(0).mItem, 1)); - ((GT_TileEntity_ComputerCube) mTileEntity.getMetaTileEntity()) - .getSimulator() - .slotClick(aSlotIndex, GT_TileEntity_ComputerCube.sReactorList.get(0)); - } - return null; - } - for (int i = 1; i < GT_TileEntity_ComputerCube.sReactorList.size(); i++) { - if (GT_TileEntity_ComputerCube.sReactorList.get(i - 1).mItem == tStack.getItem()) { - tSlot.putStack( - new ItemStack(GT_TileEntity_ComputerCube.sReactorList.get(i).mItem, 1, 0)); - ((GT_TileEntity_ComputerCube) mTileEntity.getMetaTileEntity()) - .getSimulator() - .slotClick(aSlotIndex, GT_TileEntity_ComputerCube.sReactorList.get(i)); - /*if (tSlot.getStack() != null && tSlot.getStack().getItem() == GT_ModHandler.getIC2Item("reactorIsotopeCell", 1).getItem()) { - tSlot.getStack().setItemDamage(tSlot.getStack().getMaxDamage() - 1); - }*/ - return null; - } - } - tSlot.putStack(null); - ((GT_TileEntity_ComputerCube) mTileEntity.getMetaTileEntity()) - .getSimulator() - .slotClick(aSlotIndex, null); - return null; - } - if (tStack == null) return null; - if (tStack.stackSize < tStack.getMaxStackSize()) { - tStack.stackSize++; - return null; - } - tStack.stackSize = 1; - return null; - } - } else { - // Logger.INFO("Super 2"); - return super.slotClick(aSlotIndex, aMouseclick, aShifthold, aPlayer); - } - } - // Logger.INFO("???"); - return null; - } - - public void changePage(EntityPlayerMP aPlayerMP, int aMode) { - GT_TileEntity_ComputerCube aCompTile = (GT_TileEntity_ComputerCube) mTileEntity.getMetaTileEntity(); - aCompTile.onRightclick(mTileEntity, aPlayerMP); - } - - public boolean doesBindPlayerInventory() { - return (this.mID != 1 && this.mID != 5); - } - - public void detectAndSendChanges() { - super.detectAndSendChanges(); - if (mTileEntity.isClientSide() || mTileEntity.getMetaTileEntity() == null) { - return; - } - mStoredEU = mTileEntity.getStoredEU(); - mMaxStoredEU = mTileEntity.getEUCapacity(); - int[] aStored = MathUtils.splitLongIntoTwoIntegers(mStoredEU); - int[] aMaxStorage = MathUtils.splitLongIntoTwoIntegers(mMaxStoredEU); - mStoredEU1 = aStored[0]; - mStoredEU2 = aStored[1]; - mMaxStoredEU1 = aMaxStorage[0]; - mMaxStoredEU2 = aMaxStorage[1]; - - this.mID = ((GT_TileEntity_ComputerCube) mTileEntity.getMetaTileEntity()).mMode; - this.mEUOut = ((GT_TileEntity_ComputerCube) mTileEntity.getMetaTileEntity()).mEUOut; - int[] aEUSplit1 = MathUtils.splitLongIntoTwoIntegers(mEUOut); - this.mEUOut1 = aEUSplit1[0]; - this.mEUOut2 = aEUSplit1[1]; - this.mHeat = ((GT_TileEntity_ComputerCube) mTileEntity.getMetaTileEntity()).mHeat; - this.mMaxHeat = ((GT_TileEntity_ComputerCube) mTileEntity.getMetaTileEntity()).mMaxHeat; - this.mHEM = (int) (((GT_TileEntity_ComputerCube) mTileEntity.getMetaTileEntity()).mHEM * 10000.0F); - this.mExplosionStrength = - (int) (((GT_TileEntity_ComputerCube) mTileEntity.getMetaTileEntity()).mExplosionStrength * 100.0F); - this.mEU = ((GT_TileEntity_ComputerCube) mTileEntity.getMetaTileEntity()).mEU; - this.mProgress = ((GT_TileEntity_ComputerCube) mTileEntity.getMetaTileEntity()).mProgress; - this.mMaxProgressTime = ((GT_TileEntity_ComputerCube) mTileEntity.getMetaTileEntity()).mMaxProgress; - this.mProgressTime = (int) ((GT_TileEntity_ComputerCube) mTileEntity.getMetaTileEntity()).getEUVar(); - int[] aEUSplit2 = MathUtils.splitLongIntoTwoIntegers(mEU); - this.mEU1 = aEUSplit2[0]; - this.mEU2 = aEUSplit2[1]; - Iterator<ICrafting> var2 = this.crafters.iterator(); - while (var2.hasNext()) { - ICrafting var1 = var2.next(); - var1.sendProgressBarUpdate(this, 101, this.mID); - var1.sendProgressBarUpdate(this, 102, this.mHeat & 0xFFFF); - var1.sendProgressBarUpdate(this, 103, this.mMaxHeat & 0xFFFF); - var1.sendProgressBarUpdate(this, 104, this.mHEM); - var1.sendProgressBarUpdate(this, 105, this.mExplosionStrength); - var1.sendProgressBarUpdate(this, 106, this.mHeat >>> 16); - var1.sendProgressBarUpdate(this, 107, this.mMaxHeat >>> 16); - var1.sendProgressBarUpdate(this, 108, this.mEU1); - var1.sendProgressBarUpdate(this, 109, this.mEU2); - var1.sendProgressBarUpdate(this, 110, this.mProgress); - var1.sendProgressBarUpdate(this, 111, this.mEUOut1); - var1.sendProgressBarUpdate(this, 112, this.mEUOut2); - var1.sendProgressBarUpdate(this, 113, mStoredEU1); - var1.sendProgressBarUpdate(this, 114, mStoredEU2); - var1.sendProgressBarUpdate(this, 115, mMaxStoredEU1); - var1.sendProgressBarUpdate(this, 116, mMaxStoredEU2); - } - } - - @SideOnly(Side.CLIENT) - public void updateProgressBar(int par1, int par2) { - super.updateProgressBar(par1, par2); - switch (par1) { - case 101: - this.mID = par2; - break; - case 102: - this.mHeat = this.mHeat & 0xFFFF0000 | par2; - break; - case 103: - this.mMaxHeat = this.mMaxHeat & 0xFFFF0000 | par2; - break; - case 104: - this.mHEM = par2; - break; - case 105: - this.mExplosionStrength = par2; - break; - case 106: - this.mHeat = this.mHeat & 0xFFFF | par2 << 16; - break; - case 107: - this.mMaxHeat = this.mMaxHeat & 0xFFFF | par2 << 16; - break; - case 108: - this.mEU1 = par2; - case 109: - this.mEU2 = par2; - this.mEU = MathUtils.combineTwoIntegersToLong(mEU1, mEU2); - break; - case 110: - this.mProgress = par2; - break; - case 111: - this.mEUOut1 = par2; - case 112: - this.mEUOut2 = par2; - this.mEUOut = MathUtils.combineTwoIntegersToLong(mEUOut1, mEUOut2); - break; - case 113: - mStoredEU1 = par2; - break; - case 114: - mStoredEU2 = par2; - mStoredEU = MathUtils.combineTwoIntegersToLong(mStoredEU1, mStoredEU2); - break; - case 115: - mMaxStoredEU1 = par2; - break; - case 116: - mMaxStoredEU2 = par2; - mMaxStoredEU = MathUtils.combineTwoIntegersToLong(mMaxStoredEU1, mMaxStoredEU2); - break; - } - } - - public int getSlotStartIndex() { - return 1; - } - - public int getSlotCount() { - return (this.mID == 2) ? 4 : 0; - } - - public int getShiftClickSlotCount() { - return (this.mID == 2) ? 2 : 0; - } -} diff --git a/src/main/java/gtPlusPlus/xmod/gregtech/api/gui/computer/GT_Container_RedstoneCircuitBlock.java b/src/main/java/gtPlusPlus/xmod/gregtech/api/gui/computer/GT_Container_RedstoneCircuitBlock.java deleted file mode 100644 index d02061185a..0000000000 --- a/src/main/java/gtPlusPlus/xmod/gregtech/api/gui/computer/GT_Container_RedstoneCircuitBlock.java +++ /dev/null @@ -1,175 +0,0 @@ -package gtPlusPlus.xmod.gregtech.api.gui.computer; - -import cpw.mods.fml.relauncher.Side; -import cpw.mods.fml.relauncher.SideOnly; -import gregtech.api.gui.GT_ContainerMetaTile_Machine; -import gregtech.api.gui.GT_Slot_Holo; -import gregtech.api.interfaces.tileentity.IGregTechTileEntity; -import gregtech.api.util.GT_Utility; -import gtPlusPlus.xmod.gregtech.common.tileentities.redstone.GT_MetaTileEntity_RedstoneCircuitBlock; -import java.util.Iterator; -import net.minecraft.entity.player.EntityPlayer; -import net.minecraft.entity.player.InventoryPlayer; -import net.minecraft.inventory.ICrafting; -import net.minecraft.inventory.Slot; -import net.minecraft.item.ItemStack; -import net.minecraftforge.oredict.OreDictionary; - -public class GT_Container_RedstoneCircuitBlock extends GT_ContainerMetaTile_Machine { - - public GT_Container_RedstoneCircuitBlock(InventoryPlayer aInventoryPlayer, IGregTechTileEntity aTileEntity) { - super(aInventoryPlayer, aTileEntity); - } - - public void addSlots(InventoryPlayer aInventoryPlayer) { - addSlotToContainer(new GT_Slot_Holo(mTileEntity, 0, 8, 6, false, true, 1)); - addSlotToContainer(new GT_Slot_Holo(mTileEntity, 0, 8, 24, false, true, 1)); - addSlotToContainer(new GT_Slot_Holo(mTileEntity, 0, 8, 42, false, true, 1)); - addSlotToContainer(new GT_Slot_Holo(mTileEntity, 0, 8, 60, false, true, 1)); - - addSlotToContainer(new GT_Slot_Holo(mTileEntity, 0, 152, 6, false, true, 1)); - addSlotToContainer(new GT_Slot_Holo(mTileEntity, 0, 152, 24, false, true, 1)); - addSlotToContainer(new GT_Slot_Holo(mTileEntity, 0, 152, 42, false, true, 1)); - - addSlotToContainer(new GT_Slot_Holo(mTileEntity, 1, 26, 6, false, true, 1)); - addSlotToContainer(new GT_Slot_Holo(mTileEntity, 2, 26, 24, false, true, 1)); - addSlotToContainer(new GT_Slot_Holo(mTileEntity, 3, 26, 42, false, true, 1)); - addSlotToContainer(new GT_Slot_Holo(mTileEntity, 4, 26, 60, false, true, 1)); - } - - public ItemStack slotClick(int aSlotIndex, int aMouseclick, int aShifthold, EntityPlayer aPlayer) { - if (aSlotIndex < 0 || aSlotIndex > 6) return super.slotClick(aSlotIndex, aMouseclick, aShifthold, aPlayer); - - Slot tSlot = (Slot) inventorySlots.get(aSlotIndex); - if (tSlot != null) { - if (mTileEntity.getMetaTileEntity() == null) return null; - if (aSlotIndex < 4) { - ItemStack tStack = aPlayer.inventory.getItemStack(); - if (tStack == null) { - ((GT_MetaTileEntity_RedstoneCircuitBlock) mTileEntity.getMetaTileEntity()) - .changeGateData( - aSlotIndex, - aMouseclick == 0 - ? aShifthold == 0 ? +1 : aShifthold == 1 ? +128 : +16 - : aShifthold == 0 ? -1 : aShifthold == 1 ? -128 : -16); - } else { - tStack = GT_Utility.copy(tStack); - if (aMouseclick != 0) tStack.setItemDamage(OreDictionary.WILDCARD_VALUE); - ((GT_MetaTileEntity_RedstoneCircuitBlock) mTileEntity.getMetaTileEntity()) - .stackGateData(aSlotIndex, tStack); - } - return null; - } else if (aSlotIndex == 4) { - ((GT_MetaTileEntity_RedstoneCircuitBlock) mTileEntity.getMetaTileEntity()).switchOutput(); - } else if (aSlotIndex == 5) { - mTileEntity.setActive(!mTileEntity.isActive()); - } else if (aSlotIndex == 6) { - if (aMouseclick == 0) - ((GT_MetaTileEntity_RedstoneCircuitBlock) mTileEntity.getMetaTileEntity()) - .switchGateForward(aShifthold != 0); - else - ((GT_MetaTileEntity_RedstoneCircuitBlock) mTileEntity.getMetaTileEntity()) - .switchGateBackward(aShifthold != 0); - } - } - return super.slotClick(aSlotIndex, aMouseclick, aShifthold, aPlayer); - } - - public int mData[] = new int[] {0, 0, 0, 0, 0, 0, 0, 0}, mGate = 0; - - @SuppressWarnings("rawtypes") - public void detectAndSendChanges() { - super.detectAndSendChanges(); - if (mTileEntity.isClientSide() || mTileEntity.getMetaTileEntity() == null) return; - mGate = ((GT_MetaTileEntity_RedstoneCircuitBlock) mTileEntity.getMetaTileEntity()).mGate; - mData = ((GT_MetaTileEntity_RedstoneCircuitBlock) mTileEntity.getMetaTileEntity()).mGateData; - - Iterator var2 = this.crafters.iterator(); - while (var2.hasNext()) { - ICrafting var1 = (ICrafting) var2.next(); - var1.sendProgressBarUpdate(this, 100, mGate & 65535); - var1.sendProgressBarUpdate(this, 101, mGate >>> 16); - var1.sendProgressBarUpdate(this, 102, mData[0] & 65535); - var1.sendProgressBarUpdate(this, 103, mData[0] >>> 16); - var1.sendProgressBarUpdate(this, 104, mData[1] & 65535); - var1.sendProgressBarUpdate(this, 105, mData[1] >>> 16); - var1.sendProgressBarUpdate(this, 106, mData[2] & 65535); - var1.sendProgressBarUpdate(this, 107, mData[2] >>> 16); - var1.sendProgressBarUpdate(this, 108, mData[3] & 65535); - var1.sendProgressBarUpdate(this, 109, mData[3] >>> 16); - var1.sendProgressBarUpdate(this, 110, mData[4] & 65535); - var1.sendProgressBarUpdate(this, 111, mData[4] >>> 16); - var1.sendProgressBarUpdate(this, 112, mData[5] & 65535); - var1.sendProgressBarUpdate(this, 113, mData[5] >>> 16); - var1.sendProgressBarUpdate(this, 114, mData[6] & 65535); - var1.sendProgressBarUpdate(this, 115, mData[6] >>> 16); - var1.sendProgressBarUpdate(this, 116, mData[7] & 65535); - var1.sendProgressBarUpdate(this, 117, mData[7] >>> 16); - } - } - - public void addCraftingToCrafters(ICrafting par1ICrafting) { - super.addCraftingToCrafters(par1ICrafting); - } - - @SideOnly(Side.CLIENT) - public void updateProgressBar(int par1, int par2) { - super.updateProgressBar(par1, par2); - switch (par1) { - case 100: - mGate = mGate & -65536 | par2; - break; - case 101: - mGate = mGate & 65535 | par2 << 16; - break; - case 102: - mData[0] = mData[0] & -65536 | par2; - break; - case 103: - mData[0] = mData[0] & 65535 | par2 << 16; - break; - case 104: - mData[1] = mData[1] & -65536 | par2; - break; - case 105: - mData[1] = mData[1] & 65535 | par2 << 16; - break; - case 106: - mData[2] = mData[2] & -65536 | par2; - break; - case 107: - mData[2] = mData[2] & 65535 | par2 << 16; - break; - case 108: - mData[3] = mData[3] & -65536 | par2; - break; - case 109: - mData[3] = mData[3] & 65535 | par2 << 16; - break; - case 110: - mData[4] = mData[4] & -65536 | par2; - break; - case 111: - mData[4] = mData[4] & 65535 | par2 << 16; - break; - case 112: - mData[5] = mData[5] & -65536 | par2; - break; - case 113: - mData[5] = mData[5] & 65535 | par2 << 16; - break; - case 114: - mData[6] = mData[6] & -65536 | par2; - break; - case 115: - mData[6] = mData[6] & 65535 | par2 << 16; - break; - case 116: - mData[7] = mData[7] & -65536 | par2; - break; - case 117: - mData[7] = mData[7] & 65535 | par2 << 16; - break; - } - } -} diff --git a/src/main/java/gtPlusPlus/xmod/gregtech/api/gui/computer/GT_GUIContainer_ComputerCube.java b/src/main/java/gtPlusPlus/xmod/gregtech/api/gui/computer/GT_GUIContainer_ComputerCube.java deleted file mode 100644 index c7d2c47f7b..0000000000 --- a/src/main/java/gtPlusPlus/xmod/gregtech/api/gui/computer/GT_GUIContainer_ComputerCube.java +++ /dev/null @@ -1,225 +0,0 @@ -package gtPlusPlus.xmod.gregtech.api.gui.computer; - -import gregtech.api.gui.GT_GUIContainerMetaTile_Machine; -import gregtech.api.interfaces.tileentity.IGregTechTileEntity; -import gregtech.api.util.GT_Recipe; -import gregtech.api.util.GT_Recipe.GT_Recipe_Map; -import gtPlusPlus.core.lib.CORE; -import gtPlusPlus.core.util.Utils; -import gtPlusPlus.core.util.math.MathUtils; -import gtPlusPlus.xmod.gregtech.common.computer.GT_Computercube_Description; -import gtPlusPlus.xmod.gregtech.common.tileentities.misc.GT_TileEntity_ComputerCube; -import net.minecraft.entity.player.InventoryPlayer; -import net.minecraft.util.ResourceLocation; -import net.minecraft.util.StatCollector; - -public class GT_GUIContainer_ComputerCube extends GT_GUIContainerMetaTile_Machine { - - public final GT_Container_ComputerCube mPowerContainer; - - public GT_GUIContainer_ComputerCube( - InventoryPlayer aInventoryPlayer, IGregTechTileEntity aBaseMetaTileEntity, int aID) { - super( - new GT_Container_ComputerCube(aInventoryPlayer, aBaseMetaTileEntity, aID), - CORE.RES_PATH_GUI + "computer/" + aID + ".png"); - mPowerContainer = (GT_Container_ComputerCube) mContainer; - if (mPowerContainer.mID == 5) { - this.xSize += 50; - } - } - - public static ResourceLocation[] mGUIbackground = new ResourceLocation[8]; - - static { - mGUIbackground[0] = new ResourceLocation(CORE.RES_PATH_GUI + "computer/0.png"); - mGUIbackground[1] = new ResourceLocation(CORE.RES_PATH_GUI + "computer/1.png"); - mGUIbackground[2] = new ResourceLocation(CORE.RES_PATH_GUI + "computer/2.png"); - mGUIbackground[3] = new ResourceLocation(CORE.RES_PATH_GUI + "computer/3.png"); - mGUIbackground[4] = new ResourceLocation(CORE.RES_PATH_GUI + "computer/4.png"); - mGUIbackground[5] = new ResourceLocation(CORE.RES_PATH_GUI + "computer/5.png"); - mGUIbackground[6] = new ResourceLocation(CORE.RES_PATH_GUI + "computer/6.png"); - mGUIbackground[7] = new ResourceLocation(CORE.RES_PATH_GUI + "computer/Redstone.png"); - } - - protected void drawGuiContainerForegroundLayer(int par1, int par2) { - GT_Container_ComputerCube tContainer = (GT_Container_ComputerCube) this.mContainer; - // Logger.INFO("3 GUI Mode: "+xSize); - // GT_TileEntity_ComputerCube tTileEntity = (GT_TileEntity_ComputerCube) tContainer.mTileEntity; - if (tContainer != null) - switch (tContainer.mID) { - case 0: - this.fontRendererObj.drawString("Solaris 1.7.10", 56, 70, Utils.rgbtoHexValue(100, 190, 255)); - // this.fontRendererObj.drawString(StatCollector.translateToLocal("container.inventory"), 8, - // this.ySize - 96 + 2, 4210752); - break; - case 1: - this.fontRendererObj.drawString("Reactorstats:", 7, 108, 16448255); - this.fontRendererObj.drawString( - toNumber(tContainer.mEU) + "EU at " + tContainer.mEUOut + "EU/t", 7, 120, 16448255); - this.fontRendererObj.drawString("HEM: " + (tContainer.mHEM / 10000.0F), 7, 128, 16448255); - this.fontRendererObj.drawString( - toNumber(tContainer.mHeat) + "/" + toNumber(tContainer.mMaxHeat) + "Heat", - 7, - 136, - 16448255); - this.fontRendererObj.drawString( - "Explosionpower: " + (tContainer.mExplosionStrength / 100.0F), 7, 144, 16448255); - this.fontRendererObj.drawString( - "Runtime: " - + ((tContainer.mProgress > 0) - ? ( - /*(tContainer.mEU / tContainer.mEUOut)*/ tContainer.mProgress / 20) - : 0) - + "secs", - 7, - 152, - 16448255); - break; - case 2: - this.fontRendererObj.drawString("Scanner", 51, 7, 16448255); - if (tContainer.mProgress == 0) { - this.fontRendererObj.drawString("Can be used to", 51, 24, 16448255); - this.fontRendererObj.drawString("scan things", 51, 32, 16448255); - this.fontRendererObj.drawString("Currently", 51, 48, Utils.rgbtoHexValue(200, 20, 20)); - this.fontRendererObj.drawString("Disabled", 51, 56, Utils.rgbtoHexValue(200, 20, 20)); - } else { - this.fontRendererObj.drawString("Progress:", 51, 24, 16448255); - this.fontRendererObj.drawString( - MathUtils.findPercentage(tContainer.mProgress, tContainer.mMaxProgressTime) + " %", - 51, - 32, - 16448255); - } - this.fontRendererObj.drawString( - StatCollector.translateToLocal("container.inventory"), 8, this.ySize - 96 + 2, 4210752); - break; - case 3: - this.fontRendererObj.drawString("Centrifuge", 7, 7, 16448255); - this.fontRendererObj.drawString( - "Recipe: " + (tContainer.mMaxHeat + 1) + "/" - + GT_Recipe_Map.sCentrifugeRecipes.mRecipeList.size(), - 7, - 23, - 16448255); - this.fontRendererObj.drawString("EU: " + toNumber(tContainer.mEU), 7, 31, 16448255); - break; - case 4: - this.fontRendererObj.drawString("Fusionreactor", 7, 7, 16448255); - this.fontRendererObj.drawString( - "Recipe: " + (tContainer.mMaxHeat + 1) + "/" - + GT_TileEntity_ComputerCube.sFusionReactorRecipes.size(), - 7, - 15, - 16448255); - this.fontRendererObj.drawString("Start: " + toNumber(tContainer.mEU) + "EU", 7, 23, 16448255); - this.fontRendererObj.drawString("EU/t: " + toNumber(tContainer.mEUOut), 7, 31, 16448255); - this.fontRendererObj.drawString(toNumber(tContainer.mHeat) + " Ticks", 7, 39, 16448255); - GT_Recipe tRecipe = GT_TileEntity_ComputerCube.sFusionReactorRecipes.get(tContainer.mMaxHeat); - this.fontRendererObj.drawString("" + tRecipe.mFluidOutputs[0].getLocalizedName(), 7, 55, 16448255); - if (tContainer.mEUOut < 0) { - this.fontRendererObj.drawString( - "IN: " + toNumber(-tContainer.mEUOut * tContainer.mHeat) + "EU", 7, 47, 16448255); - break; - } - this.fontRendererObj.drawString( - "OUT: " + toNumber(tContainer.mEUOut * tContainer.mHeat) + "EU", 7, 47, 16448255); - break; - case 5: - if (tContainer.mID == 5 && this.xSize == 176) { - this.xSize += 50; - } - if (tContainer.mMaxHeat >= 0 - && tContainer.mMaxHeat < GT_Computercube_Description.sDescriptions.size()) - for (int i = 0; - i - < ((GT_Computercube_Description) GT_Computercube_Description.sDescriptions.get( - tContainer.mMaxHeat)) - .mDescription - .length; - i++) { - if (i == 0) { - this.fontRendererObj.drawString( - ((GT_Computercube_Description) GT_Computercube_Description.sDescriptions.get( - tContainer.mMaxHeat)) - .mDescription[i], - 7, - 7, - 16448255); - } else { - this.fontRendererObj.drawString( - ((GT_Computercube_Description) GT_Computercube_Description.sDescriptions.get( - tContainer.mMaxHeat)) - .mDescription[i], - 7, - 7 + 8 * i, - 16448255); - } - } - break; - case 6: - this.fontRendererObj.drawString("Electrolyzer", 7, 7, 16448255); - this.fontRendererObj.drawString( - "Recipe: " + (tContainer.mMaxHeat + 1) + "/" - + GT_Recipe_Map.sElectrolyzerRecipes.mRecipeList.size(), - 7, - 23, - 16448255); - this.fontRendererObj.drawString("EU: " + toNumber(tContainer.mEU), 7, 31, 16448255); - break; - } - } - - protected void drawGuiContainerBackgroundLayer(float par1, int par2, int par3) { - if (mContainer != null) { - GT_Container_ComputerCube tContainer = (GT_Container_ComputerCube) this.mContainer; - mc.renderEngine.bindTexture(mGUIbackground[((GT_Container_ComputerCube) this.mContainer).mID]); - int x = (width - xSize) / 2; - int y = (height - ySize) / 2; - drawTexturedModalRect(x, y, 0, 0, xSize, ySize); - switch (tContainer.mID) { - case 0: - if (this.mPowerContainer.mStoredEU > 0 && this.mPowerContainer.mMaxStoredEU > 0) { - final double tScale = MathUtils.findPercentage( - this.mPowerContainer.mStoredEU, this.mPowerContainer.mMaxStoredEU); - this.drawTexturedModalRect( - x + 44, y + 8, 0, 166, Math.min(MathUtils.roundToClosestInt(tScale), 95), 5); - } else { - // - // Logger.INFO("1 No Power? "+tContainer.mProgressTime+" | - // "+tContainer.mTileEntity.getEUCapacity()); - // Logger.INFO("2 No Power? "+aComp.getEUVar()+" | "+aComp.maxEUStore()); - } - break; - case 5: - if (tContainer.mExplosionStrength != 0) drawTexturedModalRect(x + 152, y + 6, 0, 166, 50, 50); - break; - } - } - } - - public String toNumber(long mEU) { - String tString = ""; - boolean temp = true, negative = false; - if (mEU < 0) { - mEU *= -1; - negative = true; - } - int i; - for (i = 1000000000; i > 0; i /= 10) { - long tDigit = mEU / i % 10; - if (temp && tDigit != 0) temp = false; - if (!temp) { - tString = tString + tDigit; - if (i != 1) { - int j; - for (j = i; j > 0; ) { - if (j == 1) tString = tString + ","; - j /= 1000; - } - } - } - } - if (tString.equals("")) tString = "0"; - return negative ? ("-" + tString) : tString; - } -} diff --git a/src/main/java/gtPlusPlus/xmod/gregtech/api/gui/computer/GT_GUIContainer_RedstoneCircuitBlock.java b/src/main/java/gtPlusPlus/xmod/gregtech/api/gui/computer/GT_GUIContainer_RedstoneCircuitBlock.java deleted file mode 100644 index 2612ad5592..0000000000 --- a/src/main/java/gtPlusPlus/xmod/gregtech/api/gui/computer/GT_GUIContainer_RedstoneCircuitBlock.java +++ /dev/null @@ -1,136 +0,0 @@ -package gtPlusPlus.xmod.gregtech.api.gui.computer; - -import gregtech.api.GregTech_API; -import gregtech.api.gui.GT_GUIContainerMetaTile_Machine; -import gregtech.api.interfaces.tileentity.IGregTechTileEntity; -import gregtech.api.util.GT_CircuitryBehavior; -import gregtech.api.util.GT_Utility; -import gtPlusPlus.core.lib.CORE; -import java.util.ArrayList; -import java.util.List; -import net.minecraft.client.renderer.RenderHelper; -import net.minecraft.entity.player.InventoryPlayer; - -public class GT_GUIContainer_RedstoneCircuitBlock extends GT_GUIContainerMetaTile_Machine { - - public GT_GUIContainer_RedstoneCircuitBlock(InventoryPlayer aInventoryPlayer, IGregTechTileEntity aTileEntity) { - super( - new GT_Container_RedstoneCircuitBlock(aInventoryPlayer, aTileEntity), - CORE.RES_PATH_GUI + "RedstoneCircuitBlock.png"); - } - - @Override - protected void drawGuiContainerForegroundLayer(int par1, int par2) { - GT_CircuitryBehavior tCircuit = - GregTech_API.sCircuitryBehaviors.get(((GT_Container_RedstoneCircuitBlock) mContainer).mGate); - if (tCircuit != null) { - this.fontRendererObj.drawString(tCircuit.getName(), 46, 8, 16448255); - this.fontRendererObj.drawString(tCircuit.getDescription(), 46, 19, 16448255); - - this.fontRendererObj.drawString( - tCircuit.getDataDescription(((GT_Container_RedstoneCircuitBlock) mContainer).mData, 0), - 46, - 33, - 16448255); - this.fontRendererObj.drawString( - tCircuit.getDataDescription(((GT_Container_RedstoneCircuitBlock) mContainer).mData, 1), - 46, - 44, - 16448255); - this.fontRendererObj.drawString( - tCircuit.getDataDescription(((GT_Container_RedstoneCircuitBlock) mContainer).mData, 2), - 46, - 55, - 16448255); - this.fontRendererObj.drawString( - tCircuit.getDataDescription(((GT_Container_RedstoneCircuitBlock) mContainer).mData, 3), - 46, - 66, - 16448255); - - String tString; - tString = tCircuit.getDataDisplay(((GT_Container_RedstoneCircuitBlock) mContainer).mData, 0); - this.fontRendererObj.drawString( - tString == null - ? GT_Utility.parseNumberToString(((GT_Container_RedstoneCircuitBlock) mContainer).mData[0]) - : tString, - 99, - 33, - 16448255); - tString = tCircuit.getDataDisplay(((GT_Container_RedstoneCircuitBlock) mContainer).mData, 1); - this.fontRendererObj.drawString( - tString == null - ? GT_Utility.parseNumberToString(((GT_Container_RedstoneCircuitBlock) mContainer).mData[1]) - : tString, - 99, - 44, - 16448255); - tString = tCircuit.getDataDisplay(((GT_Container_RedstoneCircuitBlock) mContainer).mData, 2); - this.fontRendererObj.drawString( - tString == null - ? GT_Utility.parseNumberToString(((GT_Container_RedstoneCircuitBlock) mContainer).mData[2]) - : tString, - 99, - 55, - 16448255); - tString = tCircuit.getDataDisplay(((GT_Container_RedstoneCircuitBlock) mContainer).mData, 3); - this.fontRendererObj.drawString( - tString == null - ? GT_Utility.parseNumberToString(((GT_Container_RedstoneCircuitBlock) mContainer).mData[3]) - : tString, - 99, - 66, - 16448255); - } - this.drawTooltip(par1, par2); - } - - @Override - protected void drawGuiContainerBackgroundLayer(float par1, int par2, int par3) { - super.drawGuiContainerBackgroundLayer(par1, par2, par3); - int x = (width - xSize) / 2; - int y = (height - ySize) / 2; - drawTexturedModalRect(x, y, 0, 0, xSize, ySize); - - if (mContainer != null) { - if (((GT_Container_RedstoneCircuitBlock) mContainer).mOutput > 0) - drawTexturedModalRect(x + 151, y + 5, 176, 0, 18, 18); - if ((((GT_Container_RedstoneCircuitBlock) mContainer).mActive & 1) > 0) - drawTexturedModalRect(x + 151, y + 23, 176, 18, 18, 18); - if (((GT_Container_RedstoneCircuitBlock) mContainer).mDisplayErrorCode > 0) - if ((((GT_Container_RedstoneCircuitBlock) mContainer).mTileEntity.getTimer() / 5) % 2 == 0) - drawTexturedModalRect(x + 140, y + 9, 194, 0, 7, 7); - else - ; - else drawTexturedModalRect(x + 140, y + 9, 201, 0, 7, 7); - } - } - - private void drawTooltip(final int x2, final int y2) { - final int xStart = (this.width - this.xSize) / 2; - final int yStart = (this.height - this.ySize) / 2; - final int x3 = x2 - xStart; - final int y3 = y2 - yStart + 5; - final List<String> list = new ArrayList<String>(); - - int y = 10; - if (x3 >= 151 && x3 <= 168) { - if (y3 >= y && y3 <= (y + 17)) { - list.add("Toggle EU Output"); - } - if (y3 >= (y + 18) && y3 <= (y + 35)) { - list.add("Toggle Active State"); - } - if (y3 >= (y + 36) && y3 <= (y + 53)) { - list.add("Change Redstone Circuit"); - } - } - - if (!list.isEmpty()) { - // RenderHelper.enableGUIStandardItemLighting(); - this.drawHoveringText(list, x3, y3, this.fontRendererObj); - RenderHelper.enableGUIStandardItemLighting(); - } - // RenderHelper.enableStandardItemLighting(); - } -} diff --git a/src/main/java/gtPlusPlus/xmod/gregtech/api/gui/fluidreactor/Container_FluidReactor.java b/src/main/java/gtPlusPlus/xmod/gregtech/api/gui/fluidreactor/Container_FluidReactor.java deleted file mode 100644 index dff58351e0..0000000000 --- a/src/main/java/gtPlusPlus/xmod/gregtech/api/gui/fluidreactor/Container_FluidReactor.java +++ /dev/null @@ -1,174 +0,0 @@ -package gtPlusPlus.xmod.gregtech.api.gui.fluidreactor; - -import cpw.mods.fml.relauncher.Side; -import cpw.mods.fml.relauncher.SideOnly; -import gregtech.api.gui.GT_Container_BasicMachine; -import gregtech.api.gui.GT_Slot_Render; -import gregtech.api.interfaces.metatileentity.IMetaTileEntity; -import gregtech.api.interfaces.tileentity.IGregTechTileEntity; -import gtPlusPlus.api.objects.Logger; -import gtPlusPlus.core.slots.SlotChemicalPlantInput; -import gtPlusPlus.core.slots.SlotNoInput; -import gtPlusPlus.core.util.reflect.ReflectionUtils; -import gtPlusPlus.xmod.gregtech.common.tileentities.machines.basic.GregtechMetaTileEntity_ChemicalReactor; -import java.util.Iterator; -import net.minecraft.entity.player.EntityPlayer; -import net.minecraft.entity.player.InventoryPlayer; -import net.minecraft.inventory.ICrafting; -import net.minecraft.item.ItemStack; - -public class Container_FluidReactor extends GT_Container_BasicMachine { - - public boolean mFluidTransfer_1 = false; - public boolean mFluidTransfer_2 = false; - public boolean oFluidTransfer_1 = false; - public boolean oFluidTransfer_2 = false; - - public Container_FluidReactor(InventoryPlayer aInventoryPlayer, IGregTechTileEntity aTileEntity) { - super(aInventoryPlayer, aTileEntity); - } - - @Override - public void addSlots(InventoryPlayer aInventoryPlayer) { - - // Gui Buttons - this.addSlotToContainer(new SlotNoInput(this.mTileEntity, 0, 8, 63)); // Fluid 1 - this.addSlotToContainer(new SlotNoInput(this.mTileEntity, 1, 44, 63)); - this.addSlotToContainer(new SlotNoInput(this.mTileEntity, 2, 26, 63)); // Fluid 2 - - int tStartIndex = 3; - // Input Slots - this.addSlotToContainer(new SlotChemicalPlantInput(this.mTileEntity, tStartIndex++, 8, 7)); - this.addSlotToContainer(new SlotChemicalPlantInput(this.mTileEntity, tStartIndex++, 26, 7)); - this.addSlotToContainer(new SlotChemicalPlantInput(this.mTileEntity, tStartIndex++, 44, 7)); - this.addSlotToContainer(new SlotChemicalPlantInput(this.mTileEntity, tStartIndex++, 62, 7)); - - // Output Slots - this.addSlotToContainer(new SlotNoInput(this.mTileEntity, tStartIndex++, 107, 16)); - this.addSlotToContainer(new SlotNoInput(this.mTileEntity, tStartIndex++, 125, 16)); - this.addSlotToContainer(new SlotNoInput(this.mTileEntity, tStartIndex++, 107, 34)); - this.addSlotToContainer(new SlotNoInput(this.mTileEntity, tStartIndex++, 125, 34)); - - // Cell Collector Slot - this.addSlotToContainer(new SlotNoInput(this.mTileEntity, tStartIndex++, 116, 63)); - - // Inputs Fluids - this.addSlotToContainer(new GT_Slot_Render(this.mTileEntity, tStartIndex++, 8, 42)); - this.addSlotToContainer(new GT_Slot_Render(this.mTileEntity, tStartIndex++, 26, 42)); - this.addSlotToContainer(new GT_Slot_Render(this.mTileEntity, tStartIndex++, 44, 42)); - this.addSlotToContainer(new GT_Slot_Render(this.mTileEntity, tStartIndex++, 62, 42)); - - // Output Fluids - this.addSlotToContainer(new GT_Slot_Render(this.mTileEntity, tStartIndex++, 143, 16)); - this.addSlotToContainer(new GT_Slot_Render(this.mTileEntity, tStartIndex++, 143, 34)); - } - - public ItemStack slotClick(int aSlotIndex, int aMouseclick, int aShifthold, EntityPlayer aPlayer) { - if (aSlotIndex == 0 || aSlotIndex == 2) { - if (this.mTileEntity != null && this.mTileEntity.isServerSide()) { - try { - final IMetaTileEntity aMetaTileEntity = this.mTileEntity.getMetaTileEntity(); - if (aMetaTileEntity == null) { - return null; - } - if (aMetaTileEntity instanceof GregtechMetaTileEntity_ChemicalReactor) { - // Set Tile - if (aSlotIndex == 0) { - ((GregtechMetaTileEntity_ChemicalReactor) aMetaTileEntity).mFluidTransfer_1 = - !((GregtechMetaTileEntity_ChemicalReactor) aMetaTileEntity).mFluidTransfer_1; - } else if (aSlotIndex == 2) { - ((GregtechMetaTileEntity_ChemicalReactor) aMetaTileEntity).mFluidTransfer_2 = - !((GregtechMetaTileEntity_ChemicalReactor) aMetaTileEntity).mFluidTransfer_2; - } - return null; - } - } catch (Throwable t) { - t.printStackTrace(); - } - } - } - // Logger.INFO("Clicked slot "+aSlotIndex); - return super.slotClick(aSlotIndex, aMouseclick, aShifthold, aPlayer); - } - - public void detectAndSendChanges() { - super.detectAndSendChanges(); - if (this.mTileEntity != null && this.mTileEntity.isServerSide()) { - try { - Iterator var2 = this.crafters.iterator(); - final IMetaTileEntity aMetaTileEntity = this.mTileEntity.getMetaTileEntity(); - if (aMetaTileEntity == null) { - Logger.INFO("bad"); - return; - } - if (aMetaTileEntity instanceof GregtechMetaTileEntity_ChemicalReactor) { - // Read from Tile - this.mFluidTransfer_1 = ((GregtechMetaTileEntity_ChemicalReactor) aMetaTileEntity).mFluidTransfer_1; - this.mFluidTransfer_2 = ((GregtechMetaTileEntity_ChemicalReactor) aMetaTileEntity).mFluidTransfer_2; - int mTimer; - mTimer = (int) - ReflectionUtils.getField(this.getClass(), "mTimer").get(this); - while (true) { - ICrafting var1; - do { - if (!var2.hasNext()) { - this.oFluidTransfer_1 = this.mFluidTransfer_1; - this.oFluidTransfer_2 = this.mFluidTransfer_2; - return; - } - var1 = (ICrafting) var2.next(); - if (mTimer % 500 == 10 || this.oFluidTransfer_1 != this.mFluidTransfer_1) { - var1.sendProgressBarUpdate(this, -50, this.mFluidTransfer_1 ? 1 : 0); - } - if (mTimer % 500 == 10 || this.oFluidTransfer_2 != this.mFluidTransfer_2) { - var1.sendProgressBarUpdate(this, -51, this.mFluidTransfer_2 ? 1 : 0); - } - } while (mTimer % 500 != 10); - } - } else { - Logger.INFO("bad cast"); - } - } catch (IllegalArgumentException | IllegalAccessException e) { - e.printStackTrace(); - } - } - } - - public void addCraftingToCrafters(ICrafting par1ICrafting) { - super.addCraftingToCrafters(par1ICrafting); - } - - @SideOnly(Side.CLIENT) - public void updateProgressBar(int par1, int par2) { - if (par1 > 0) { - super.updateProgressBar(par1, par2); - } else { - switch (par1) { - case -50: - this.mFluidTransfer_1 = par2 != 0; - break; - case -51: - this.mFluidTransfer_2 = par2 != 0; - break; - default: - break; - } - } - } - - public int getSlotStartIndex() { - return 3; - } - - public int getShiftClickStartIndex() { - return 3; - } - - public int getSlotCount() { - return this.getShiftClickSlotCount() + 5 + 2; - } - - public int getShiftClickSlotCount() { - return 4; - } -} diff --git a/src/main/java/gtPlusPlus/xmod/gregtech/api/gui/fluidreactor/GUI_FluidReactor.java b/src/main/java/gtPlusPlus/xmod/gregtech/api/gui/fluidreactor/GUI_FluidReactor.java deleted file mode 100644 index fa8c9f571d..0000000000 --- a/src/main/java/gtPlusPlus/xmod/gregtech/api/gui/fluidreactor/GUI_FluidReactor.java +++ /dev/null @@ -1,135 +0,0 @@ -package gtPlusPlus.xmod.gregtech.api.gui.fluidreactor; - -import gregtech.api.gui.GT_Container_BasicMachine; -import gregtech.api.gui.GT_GUIContainerMetaTile_Machine; -import gregtech.api.interfaces.tileentity.IGregTechTileEntity; -import gtPlusPlus.core.lib.CORE; -import java.util.ArrayList; -import java.util.List; -import net.minecraft.client.renderer.RenderHelper; -import net.minecraft.entity.player.InventoryPlayer; - -public class GUI_FluidReactor extends GT_GUIContainerMetaTile_Machine { - public final String mName; - public final String mNEI; - public final byte mProgressBarDirection; - public final byte mProgressBarAmount; - - public GUI_FluidReactor( - InventoryPlayer aInventoryPlayer, - IGregTechTileEntity aTileEntity, - String aName, - String aTextureFile, - String aNEI) { - this(aInventoryPlayer, aTileEntity, aName, aTextureFile, aNEI, (byte) 0, (byte) 1); - } - - public GUI_FluidReactor( - InventoryPlayer aInventoryPlayer, - IGregTechTileEntity aTileEntity, - String aName, - String aTextureFile, - String aNEI, - byte aProgressBarDirection, - byte aProgressBarAmount) { - super(new Container_FluidReactor(aInventoryPlayer, aTileEntity), CORE.MODID + ":textures/gui/FluidReactor.png"); - this.mProgressBarDirection = aProgressBarDirection; - this.mProgressBarAmount = (byte) Math.max(1, aProgressBarAmount); - this.mName = aName; - this.mNEI = aNEI; - } - - protected void drawGuiContainerForegroundLayer(int par1, int par2) { - this.fontRendererObj.drawString(this.mName, 82, 5, 4210752); - this.drawTooltip(par1, par2); - } - - private void drawTooltip(int x2, int y2) { - int xStart = (this.width - this.xSize) / 2; - int yStart = (this.height - this.ySize) / 2; - int x = x2 - xStart; - int y = y2 - yStart + 5; - List<String> list = new ArrayList(); - if (y >= 67 && y <= 84) { - if (x >= 7 && x <= 24) { - list.add("Fluid 1 Auto-Output"); - } - if (x >= 25 && x <= 42) { - list.add("Fluid 2 Auto-Output"); - } - if (x >= 43 && x <= 61) { - list.add("Item Auto-Output"); - } - } - - if (!list.isEmpty()) { - this.drawHoveringText(list, x, y, this.fontRendererObj); - RenderHelper.enableGUIStandardItemLighting(); - } - } - - protected void drawGuiContainerBackgroundLayer(float par1, int par2, int par3) { - super.drawGuiContainerBackgroundLayer(par1, par2, par3); - int x = (this.width - this.xSize) / 2; - int y = (this.height - this.ySize) / 2; - this.drawTexturedModalRect(x, y, 0, 0, this.xSize, this.ySize); - if (this.mContainer != null) { - if (((Container_FluidReactor) this.mContainer).mFluidTransfer_1) { - this.drawTexturedModalRect(x + 7, y + 62, 176, 18, 18, 18); - } - if (((Container_FluidReactor) this.mContainer).mFluidTransfer_2) { - this.drawTexturedModalRect(x + 25, y + 62, 194, 18, 18, 18); - } - if (((GT_Container_BasicMachine) this.mContainer).mItemTransfer) { - this.drawTexturedModalRect(x + 43, y + 62, 176, 36, 18, 18); - } - - if (((GT_Container_BasicMachine) this.mContainer).mStuttering) { - this.drawTexturedModalRect(x + 79, y + 44, 176, 54, 18, 18); - } - - if (this.mContainer.mMaxProgressTime > 0) { - int tSize = this.mProgressBarDirection < 2 ? 20 : 18; - int tProgress = Math.max( - 1, - Math.min( - tSize * this.mProgressBarAmount, - (this.mContainer.mProgressTime > 0 ? 1 : 0) - + this.mContainer.mProgressTime - * tSize - * this.mProgressBarAmount - / this.mContainer.mMaxProgressTime)) - % (tSize + 1); - switch (this.mProgressBarDirection) { - case 0: - this.drawTexturedModalRect(x + 82, y + 24, 176, 0, tProgress, 18); - break; - case 1: - this.drawTexturedModalRect(x + 82 + 20 - tProgress, y + 24, 196 - tProgress, 0, tProgress, 18); - break; - case 2: - this.drawTexturedModalRect(x + 82, y + 24, 176, 0, 20, tProgress); - break; - case 3: - this.drawTexturedModalRect(x + 82, y + 24 + 18 - tProgress, 176, 18 - tProgress, 20, tProgress); - break; - case 4: - tProgress = 20 - tProgress; - this.drawTexturedModalRect(x + 82, y + 24, 176, 0, tProgress, 18); - break; - case 5: - tProgress = 20 - tProgress; - this.drawTexturedModalRect(x + 82 + 20 - tProgress, y + 24, 196 - tProgress, 0, tProgress, 18); - break; - case 6: - tProgress = 18 - tProgress; - this.drawTexturedModalRect(x + 82, y + 24, 176, 0, 20, tProgress); - break; - case 7: - tProgress = 18 - tProgress; - this.drawTexturedModalRect(x + 82, y + 24 + 18 - tProgress, 176, 18 - tProgress, 20, tProgress); - } - } - } - } -} diff --git a/src/main/java/gtPlusPlus/xmod/gregtech/api/gui/hatches/CONTAINER_1by1_Turbine.java b/src/main/java/gtPlusPlus/xmod/gregtech/api/gui/hatches/CONTAINER_1by1_Turbine.java deleted file mode 100644 index 836e7198c3..0000000000 --- a/src/main/java/gtPlusPlus/xmod/gregtech/api/gui/hatches/CONTAINER_1by1_Turbine.java +++ /dev/null @@ -1,60 +0,0 @@ -package gtPlusPlus.xmod.gregtech.api.gui.hatches; - -import gregtech.api.gui.GT_Container_1by1; -import gregtech.api.interfaces.tileentity.IGregTechTileEntity; -import gtPlusPlus.xmod.gregtech.common.tileentities.machines.multi.production.turbines.GregtechMetaTileEntity_LargerTurbineBase; -import net.minecraft.entity.player.EntityPlayer; -import net.minecraft.entity.player.InventoryPlayer; -import net.minecraft.inventory.IInventory; -import net.minecraft.inventory.Slot; -import net.minecraft.item.ItemStack; - -public class CONTAINER_1by1_Turbine extends GT_Container_1by1 { - - public CONTAINER_1by1_Turbine(InventoryPlayer aInventoryPlayer, IGregTechTileEntity aTileEntity) { - super(aInventoryPlayer, aTileEntity); - } - - @Override - public void addSlots(InventoryPlayer aInventoryPlayer) { - addSlotToContainer(new SlotTurbine(mTileEntity, 0, 80, 35)); - } - - @Override - public int getShiftClickSlotCount() { - return 0; - } - - @Override - public boolean canDragIntoSlot(Slot par1Slot) { - return false; - } - - public class SlotTurbine extends Slot { - public SlotTurbine(final IInventory inventory, final int x, final int y, final int z) { - super(inventory, x, y, z); - } - - @Override - public boolean isItemValid(final ItemStack itemstack) { - return GregtechMetaTileEntity_LargerTurbineBase.isValidTurbine(itemstack); - } - - @Override - public int getSlotStackLimit() { - return 1; - } - - @Override - public boolean canTakeStack(EntityPlayer p_82869_1_) { - return false; - } - - @Override - public void putStack(ItemStack aStack) { - if (isItemValid(aStack)) { - this.inventory.setInventorySlotContents(0, aStack); - } - } - } -} diff --git a/src/main/java/gtPlusPlus/xmod/gregtech/api/gui/hatches/CONTAINER_2by2.java b/src/main/java/gtPlusPlus/xmod/gregtech/api/gui/hatches/CONTAINER_2by2.java deleted file mode 100644 index 60106825a0..0000000000 --- a/src/main/java/gtPlusPlus/xmod/gregtech/api/gui/hatches/CONTAINER_2by2.java +++ /dev/null @@ -1,31 +0,0 @@ -package gtPlusPlus.xmod.gregtech.api.gui.hatches; - -import gregtech.api.gui.GT_ContainerMetaTile_Machine; -import gregtech.api.interfaces.tileentity.IGregTechTileEntity; -import net.minecraft.entity.player.InventoryPlayer; -import net.minecraft.inventory.Slot; - -public class CONTAINER_2by2 extends GT_ContainerMetaTile_Machine { - - public CONTAINER_2by2(InventoryPlayer aInventoryPlayer, IGregTechTileEntity aTileEntity) { - super(aInventoryPlayer, aTileEntity); - } - - @Override - public void addSlots(InventoryPlayer aInventoryPlayer) { - addSlotToContainer(new Slot(mTileEntity, 0, 71, 26)); - addSlotToContainer(new Slot(mTileEntity, 1, 89, 26)); - addSlotToContainer(new Slot(mTileEntity, 2, 71, 44)); - addSlotToContainer(new Slot(mTileEntity, 3, 89, 44)); - } - - @Override - public int getSlotCount() { - return 4; - } - - @Override - public int getShiftClickSlotCount() { - return 4; - } -} diff --git a/src/main/java/gtPlusPlus/xmod/gregtech/api/gui/hatches/CONTAINER_4by4.java b/src/main/java/gtPlusPlus/xmod/gregtech/api/gui/hatches/CONTAINER_4by4.java deleted file mode 100644 index 0c011f164b..0000000000 --- a/src/main/java/gtPlusPlus/xmod/gregtech/api/gui/hatches/CONTAINER_4by4.java +++ /dev/null @@ -1,43 +0,0 @@ -package gtPlusPlus.xmod.gregtech.api.gui.hatches; - -import gregtech.api.gui.GT_ContainerMetaTile_Machine; -import gregtech.api.interfaces.tileentity.IGregTechTileEntity; -import net.minecraft.entity.player.InventoryPlayer; -import net.minecraft.inventory.Slot; - -public class CONTAINER_4by4 extends GT_ContainerMetaTile_Machine { - - public CONTAINER_4by4(InventoryPlayer aInventoryPlayer, IGregTechTileEntity aTileEntity) { - super(aInventoryPlayer, aTileEntity); - } - - @Override - public void addSlots(InventoryPlayer aInventoryPlayer) { - addSlotToContainer(new Slot(mTileEntity, 0, 53, 8)); - addSlotToContainer(new Slot(mTileEntity, 1, 71, 8)); - addSlotToContainer(new Slot(mTileEntity, 2, 89, 8)); - addSlotToContainer(new Slot(mTileEntity, 3, 107, 8)); - addSlotToContainer(new Slot(mTileEntity, 4, 53, 26)); - addSlotToContainer(new Slot(mTileEntity, 5, 71, 26)); - addSlotToContainer(new Slot(mTileEntity, 6, 89, 26)); - addSlotToContainer(new Slot(mTileEntity, 7, 107, 26)); - addSlotToContainer(new Slot(mTileEntity, 8, 53, 44)); - addSlotToContainer(new Slot(mTileEntity, 9, 71, 44)); - addSlotToContainer(new Slot(mTileEntity, 10, 89, 44)); - addSlotToContainer(new Slot(mTileEntity, 11, 107, 44)); - addSlotToContainer(new Slot(mTileEntity, 12, 53, 62)); - addSlotToContainer(new Slot(mTileEntity, 13, 71, 62)); - addSlotToContainer(new Slot(mTileEntity, 14, 89, 62)); - addSlotToContainer(new Slot(mTileEntity, 15, 107, 62)); - } - - @Override - public int getSlotCount() { - return 16; - } - - @Override - public int getShiftClickSlotCount() { - return 16; - } -} diff --git a/src/main/java/gtPlusPlus/xmod/gregtech/api/gui/hatches/CONTAINER_HatchNbtConsumable.java b/src/main/java/gtPlusPlus/xmod/gregtech/api/gui/hatches/CONTAINER_HatchNbtConsumable.java deleted file mode 100644 index 9f3f42bb9b..0000000000 --- a/src/main/java/gtPlusPlus/xmod/gregtech/api/gui/hatches/CONTAINER_HatchNbtConsumable.java +++ /dev/null @@ -1,298 +0,0 @@ -package gtPlusPlus.xmod.gregtech.api.gui.hatches; - -import cpw.mods.fml.relauncher.Side; -import cpw.mods.fml.relauncher.SideOnly; -import gregtech.api.gui.GT_Container; -import gregtech.api.interfaces.tileentity.IGregTechTileEntity; -import gregtech.api.util.GT_LanguageManager; -import gtPlusPlus.core.slots.SlotNoInput; -import java.util.Iterator; -import net.minecraft.entity.player.EntityPlayer; -import net.minecraft.entity.player.InventoryPlayer; -import net.minecraft.inventory.ICrafting; -import net.minecraft.inventory.IInventory; -import net.minecraft.inventory.Slot; -import net.minecraft.item.ItemStack; - -public class CONTAINER_HatchNbtConsumable extends GT_Container { - - public final int mInputslotCount; - private final int mTotalSlotCount; - - public CONTAINER_HatchNbtConsumable( - InventoryPlayer aInventoryPlayer, IGregTechTileEntity aTileEntity, int aInputslotCount) { - super(aInventoryPlayer, aTileEntity); - mInputslotCount = aInputslotCount; - mTotalSlotCount = aInputslotCount * 2; - mTileEntity = aTileEntity; - if (mTileEntity != null && mTileEntity.getMetaTileEntity() != null) { - addSlots(aInventoryPlayer); - if (doesBindPlayerInventory()) { - bindPlayerInventory(aInventoryPlayer); - } - detectAndSendChanges(); - } else { - aInventoryPlayer.player.openContainer = aInventoryPlayer.player.inventoryContainer; - } - } - - @Override - public void addSlots(InventoryPlayer aInventoryPlayer) { - if (mTotalSlotCount == 8) { - final int aSlotYStart = 26; - final int aSlotYFinish = aSlotYStart + (18 * 2); - final int aSlotXStart1 = 26; - final int aSlotXFinish1 = aSlotXStart1 + (18 * 2); - final int aSlotXStart2 = 116; - final int aSlotXFinish2 = aSlotXStart2 + (18 * 2); - int aSlotID = 0; - for (int y = aSlotYStart; y < aSlotYFinish; y += 18) { - for (int x = aSlotXStart1; x < aSlotXFinish1; x += 18) { - addSlotToContainer(new Slot(mTileEntity, aSlotID++, x, y)); - } - } - for (int y = aSlotYStart; y < aSlotYFinish; y += 18) { - for (int x = aSlotXStart2; x < aSlotXFinish2; x += 18) { - addSlotToContainer(new ViewingSlot(mTileEntity, aSlotID++, x, y)); - } - } - } else if (mTotalSlotCount == 18) { - int aSlotYStart = 20; - int aSlotYFinish = aSlotYStart + (18 * 3); - int aSlotXStart1 = 26; - int aSlotXFinish1 = aSlotXStart1 + (18 * 3); - int aSlotXStart2 = 98; - int aSlotXFinish2 = aSlotXStart2 + (18 * 3); - int aSlotID = 0; - for (int y = aSlotYStart; y < aSlotYFinish; y += 18) { - for (int x = aSlotXStart1; x < aSlotXFinish1; x += 18) { - addSlotToContainer(new Slot(mTileEntity, aSlotID++, x, y)); - } - } - for (int y = aSlotYStart; y < aSlotYFinish; y += 18) { - for (int x = aSlotXStart2; x < aSlotXFinish2; x += 18) { - addSlotToContainer(new ViewingSlot(mTileEntity, aSlotID++, x, y)); - } - } - } else if (mTotalSlotCount == 32) { - int aSlotYStart = 8; - int aSlotYFinish = aSlotYStart + (18 * 4); - int aSlotXStart1 = 8; - int aSlotXFinish1 = aSlotXStart1 + (18 * 4); - int aSlotXStart2 = 97; - int aSlotXFinish2 = aSlotXStart2 + (18 * 4); - int aSlotID = 0; - for (int y = aSlotYStart; y < aSlotYFinish; y += 18) { - for (int x = aSlotXStart1; x < aSlotXFinish1; x += 18) { - addSlotToContainer(new Slot(mTileEntity, aSlotID++, x, y)); - } - } - for (int y = aSlotYStart; y < aSlotYFinish; y += 18) { - for (int x = aSlotXStart2; x < aSlotXFinish2; x += 18) { - addSlotToContainer(new ViewingSlot(mTileEntity, aSlotID++, x, y)); - } - } - } - } - - @Override - public int getSlotCount() { - return mTotalSlotCount; - } - - @Override - public int getShiftClickSlotCount() { - return mInputslotCount; - } - - /* - * Uselss stuff copied from GT - */ - - public int mActive = 0, - mMaxProgressTime = 0, - mProgressTime = 0, - mEnergy = 0, - mSteam = 0, - mSteamStorage = 0, - mStorage = 0, - mOutput = 0, - mInput = 0, - mID = 0, - mDisplayErrorCode = 0; - private int oActive = 0, - oMaxProgressTime = 0, - oProgressTime = 0, - oEnergy = 0, - oSteam = 0, - oSteamStorage = 0, - oStorage = 0, - oOutput = 0, - oInput = 0, - oID = 0, - oDisplayErrorCode = 0, - mTimer = 0; - - @Override - public void detectAndSendChanges() { - super.detectAndSendChanges(); - if (mTileEntity.isClientSide() || mTileEntity.getMetaTileEntity() == null) return; - mStorage = (int) Math.min(Integer.MAX_VALUE, mTileEntity.getEUCapacity()); - mEnergy = (int) Math.min(Integer.MAX_VALUE, mTileEntity.getStoredEU()); - mSteamStorage = (int) Math.min(Integer.MAX_VALUE, mTileEntity.getSteamCapacity()); - mSteam = (int) Math.min(Integer.MAX_VALUE, mTileEntity.getStoredSteam()); - mOutput = (int) Math.min(Integer.MAX_VALUE, mTileEntity.getOutputVoltage()); - mInput = (int) Math.min(Integer.MAX_VALUE, mTileEntity.getInputVoltage()); - mDisplayErrorCode = mTileEntity.getErrorDisplayID(); - mProgressTime = mTileEntity.getProgress(); - mMaxProgressTime = mTileEntity.getMaxProgress(); - mActive = mTileEntity.isActive() ? 1 : 0; - mTimer++; - - Iterator var2 = this.crafters.iterator(); - while (var2.hasNext()) { - ICrafting var1 = (ICrafting) var2.next(); - if (mTimer % 500 == 10 || oEnergy != mEnergy) { - var1.sendProgressBarUpdate(this, 0, mEnergy & 65535); - var1.sendProgressBarUpdate(this, 1, mEnergy >>> 16); - } - if (mTimer % 500 == 10 || oStorage != mStorage) { - var1.sendProgressBarUpdate(this, 2, mStorage & 65535); - var1.sendProgressBarUpdate(this, 3, mStorage >>> 16); - } - if (mTimer % 500 == 10 || oOutput != mOutput) { - var1.sendProgressBarUpdate(this, 4, mOutput); - } - if (mTimer % 500 == 10 || oInput != mInput) { - var1.sendProgressBarUpdate(this, 5, mInput); - } - if (mTimer % 500 == 10 || oDisplayErrorCode != mDisplayErrorCode) { - var1.sendProgressBarUpdate(this, 6, mDisplayErrorCode); - } - if (mTimer % 500 == 10 || oProgressTime != mProgressTime) { - var1.sendProgressBarUpdate(this, 11, mProgressTime & 65535); - var1.sendProgressBarUpdate(this, 12, mProgressTime >>> 16); - } - if (mTimer % 500 == 10 || oMaxProgressTime != mMaxProgressTime) { - var1.sendProgressBarUpdate(this, 13, mMaxProgressTime & 65535); - var1.sendProgressBarUpdate(this, 14, mMaxProgressTime >>> 16); - } - if (mTimer % 500 == 10 || oID != mID) { - var1.sendProgressBarUpdate(this, 15, mID); - } - if (mTimer % 500 == 10 || oActive != mActive) { - var1.sendProgressBarUpdate(this, 16, mActive); - } - if (mTimer % 500 == 10 || oSteam != mSteam) { - var1.sendProgressBarUpdate(this, 17, mSteam & 65535); - var1.sendProgressBarUpdate(this, 18, mSteam >>> 16); - } - if (mTimer % 500 == 10 || oSteamStorage != mSteamStorage) { - var1.sendProgressBarUpdate(this, 19, mSteamStorage & 65535); - var1.sendProgressBarUpdate(this, 20, mSteamStorage >>> 16); - } - } - - oID = mID; - oSteam = mSteam; - oInput = mInput; - oActive = mActive; - oOutput = mOutput; - oEnergy = mEnergy; - oStorage = mStorage; - oSteamStorage = mSteamStorage; - oProgressTime = mProgressTime; - oMaxProgressTime = mMaxProgressTime; - oDisplayErrorCode = mDisplayErrorCode; - } - - @SideOnly(Side.CLIENT) - @Override - public void updateProgressBar(int par1, int par2) { - super.updateProgressBar(par1, par2); - switch (par1) { - case 0: - mEnergy = mEnergy & -65536 | par2; - break; - case 1: - mEnergy = mEnergy & 65535 | par2 << 16; - break; - case 2: - mStorage = mStorage & -65536 | par2; - break; - case 3: - mStorage = mStorage & 65535 | par2 << 16; - break; - case 4: - mOutput = par2; - break; - case 5: - mInput = par2; - break; - case 6: - mDisplayErrorCode = par2; - break; - case 11: - mProgressTime = mProgressTime & -65536 | par2; - break; - case 12: - mProgressTime = mProgressTime & 65535 | par2 << 16; - break; - case 13: - mMaxProgressTime = mMaxProgressTime & -65536 | par2; - break; - case 14: - mMaxProgressTime = mMaxProgressTime & 65535 | par2 << 16; - break; - case 15: - mID = par2; - break; - case 16: - mActive = par2; - break; - case 17: - mSteam = mSteam & -65536 | par2; - break; - case 18: - mSteam = mSteam & 65535 | par2 << 16; - break; - case 19: - mSteamStorage = mSteamStorage & -65536 | par2; - break; - case 20: - mSteamStorage = mSteamStorage & 65535 | par2 << 16; - break; - } - } - - @Override - public boolean canInteractWith(EntityPlayer player) { - return mTileEntity.isUseableByPlayer(player); - } - - public String trans(String aKey, String aEnglish) { - return GT_LanguageManager.addStringLocalization("Interaction_DESCRIPTION_Index_" + aKey, aEnglish, false); - } - - private static class ViewingSlot extends SlotNoInput { - - public ViewingSlot(IInventory inventory, int index, int x, int y) { - super(inventory, index, x, y); - } - - @Override - public boolean isItemValid(ItemStack itemstack) { - return false; - } - - @Override - public int getSlotStackLimit() { - return 1; - } - - @Override - public boolean canTakeStack(EntityPlayer p_82869_1_) { - return true; - } - } -} diff --git a/src/main/java/gtPlusPlus/xmod/gregtech/api/gui/hatches/GUI_1by1_Turbine.java b/src/main/java/gtPlusPlus/xmod/gregtech/api/gui/hatches/GUI_1by1_Turbine.java deleted file mode 100644 index cd0381a1f1..0000000000 --- a/src/main/java/gtPlusPlus/xmod/gregtech/api/gui/hatches/GUI_1by1_Turbine.java +++ /dev/null @@ -1,36 +0,0 @@ -package gtPlusPlus.xmod.gregtech.api.gui.hatches; - -import static gregtech.api.enums.GT_Values.RES_PATH_GUI; - -import gregtech.api.gui.GT_GUIContainerMetaTile_Machine; -import gregtech.api.interfaces.tileentity.IGregTechTileEntity; -import net.minecraft.entity.player.InventoryPlayer; - -public class GUI_1by1_Turbine extends GT_GUIContainerMetaTile_Machine { - - private final String mName; - - public GUI_1by1_Turbine(InventoryPlayer aInventoryPlayer, IGregTechTileEntity aTileEntity, String aName) { - super(new CONTAINER_1by1_Turbine(aInventoryPlayer, aTileEntity), RES_PATH_GUI + "1by1.png"); - mName = aName; - } - - public GUI_1by1_Turbine( - InventoryPlayer aInventoryPlayer, IGregTechTileEntity aTileEntity, String aName, String aBackground) { - super(new CONTAINER_1by1_Turbine(aInventoryPlayer, aTileEntity), RES_PATH_GUI + aBackground + "1by1.png"); - mName = aName; - } - - @Override - protected void drawGuiContainerForegroundLayer(int par1, int par2) { - fontRendererObj.drawString(mName, 8, 4, 4210752); - } - - @Override - protected void drawGuiContainerBackgroundLayer(float par1, int par2, int par3) { - super.drawGuiContainerBackgroundLayer(par1, par2, par3); - int x = (width - xSize) / 2; - int y = (height - ySize) / 2; - drawTexturedModalRect(x, y, 0, 0, xSize, ySize); - } -} diff --git a/src/main/java/gtPlusPlus/xmod/gregtech/api/gui/hatches/GUI_2by2.java b/src/main/java/gtPlusPlus/xmod/gregtech/api/gui/hatches/GUI_2by2.java deleted file mode 100644 index c31b74b0f8..0000000000 --- a/src/main/java/gtPlusPlus/xmod/gregtech/api/gui/hatches/GUI_2by2.java +++ /dev/null @@ -1,44 +0,0 @@ -package gtPlusPlus.xmod.gregtech.api.gui.hatches; - -import static gregtech.api.enums.GT_Values.RES_PATH_GUI; - -import gregtech.api.gui.GT_GUIContainerMetaTile_Machine; -import gregtech.api.interfaces.tileentity.IGregTechTileEntity; -import net.minecraft.entity.player.InventoryPlayer; - -public class GUI_2by2 extends GT_GUIContainerMetaTile_Machine { - - private final String mName; - - public GUI_2by2( - CONTAINER_2by2 containerType, - InventoryPlayer aInventoryPlayer, - IGregTechTileEntity aTileEntity, - String aName) { - super(containerType, RES_PATH_GUI + "2by2.png"); - mName = aName; - } - - public GUI_2by2( - CONTAINER_2by2 containerType, - InventoryPlayer aInventoryPlayer, - IGregTechTileEntity aTileEntity, - String aName, - String aBackground) { - super(containerType, RES_PATH_GUI + aBackground + "2by2.png"); - mName = aName; - } - - @Override - protected void drawGuiContainerForegroundLayer(int par1, int par2) { - fontRendererObj.drawString(mName, 8, 4, 4210752); - } - - @Override - protected void drawGuiContainerBackgroundLayer(float par1, int par2, int par3) { - super.drawGuiContainerBackgroundLayer(par1, par2, par3); - int x = (width - xSize) / 2; - int y = (height - ySize) / 2; - drawTexturedModalRect(x, y, 0, 0, xSize, ySize); - } -} diff --git a/src/main/java/gtPlusPlus/xmod/gregtech/api/gui/hatches/GUI_4by4.java b/src/main/java/gtPlusPlus/xmod/gregtech/api/gui/hatches/GUI_4by4.java deleted file mode 100644 index 379d1d7941..0000000000 --- a/src/main/java/gtPlusPlus/xmod/gregtech/api/gui/hatches/GUI_4by4.java +++ /dev/null @@ -1,44 +0,0 @@ -package gtPlusPlus.xmod.gregtech.api.gui.hatches; - -import static gregtech.api.enums.GT_Values.RES_PATH_GUI; - -import gregtech.api.gui.GT_GUIContainerMetaTile_Machine; -import gregtech.api.interfaces.tileentity.IGregTechTileEntity; -import net.minecraft.entity.player.InventoryPlayer; - -public class GUI_4by4 extends GT_GUIContainerMetaTile_Machine { - - private final String mName; - - public GUI_4by4( - CONTAINER_4by4 containerType, - InventoryPlayer aInventoryPlayer, - IGregTechTileEntity aTileEntity, - String aName) { - super(containerType, RES_PATH_GUI + "4by4.png"); - mName = aName; - } - - public GUI_4by4( - CONTAINER_4by4 containerType, - InventoryPlayer aInventoryPlayer, - IGregTechTileEntity aTileEntity, - String aName, - String aBackground) { - super(containerType, RES_PATH_GUI + aBackground + "4by4.png"); - mName = aName; - } - - @Override - protected void drawGuiContainerForegroundLayer(int par1, int par2) { - fontRendererObj.drawString(mName, 8, 4, 4210752); - } - - @Override - protected void drawGuiContainerBackgroundLayer(float par1, int par2, int par3) { - super.drawGuiContainerBackgroundLayer(par1, par2, par3); - int x = (width - xSize) / 2; - int y = (height - ySize) / 2; - drawTexturedModalRect(x, y, 0, 0, xSize, ySize); - } -} diff --git a/src/main/java/gtPlusPlus/xmod/gregtech/api/gui/hatches/GUI_HatchNbtConsumable.java b/src/main/java/gtPlusPlus/xmod/gregtech/api/gui/hatches/GUI_HatchNbtConsumable.java deleted file mode 100644 index 47d24764cc..0000000000 --- a/src/main/java/gtPlusPlus/xmod/gregtech/api/gui/hatches/GUI_HatchNbtConsumable.java +++ /dev/null @@ -1,55 +0,0 @@ -package gtPlusPlus.xmod.gregtech.api.gui.hatches; - -import static gregtech.api.enums.GT_Values.RES_PATH_GUI; - -import gregtech.api.gui.GT_GUIContainer; - -public class GUI_HatchNbtConsumable extends GT_GUIContainer { - - private final String mName; - private final int mTotalSlotCount; - public final CONTAINER_HatchNbtConsumable mContainer; - - public GUI_HatchNbtConsumable(CONTAINER_HatchNbtConsumable aContainer, String aName) { - super(aContainer, RES_PATH_GUI + getTextureForGUI(aContainer.mInputslotCount * 2) + ".png"); - mContainer = aContainer; - mName = aName; - mTotalSlotCount = aContainer.mInputslotCount * 2; - } - - private static final String getTextureForGUI(int aTotalSlotCOunt) { - if (aTotalSlotCOunt == 18) { - return "HatchNbtConsumable_3By3"; - } else if (aTotalSlotCOunt == 32) { - return "HatchNbtConsumable_4By4"; - } else { - return "HatchNbtConsumable_2By2"; - } - } - - @Override - protected void drawGuiContainerForegroundLayer(int par1, int par2) { - if (mTotalSlotCount == 18) { - fontRendererObj.drawString(mName, 8, 4, 4210752); - fontRendererObj.drawString("Stock", 25, 14, 4210752); - fontRendererObj.drawString("Active", 115, 14, 4210752); - } else if (mTotalSlotCount == 32) { - // fontRendererObj.drawString("Slots: "+mTotalSlotCount, 8, 4, 4210752); - // fontRendererObj.drawString(mName, 8, 4, 4210752); - // fontRendererObj.drawString("Stock", 25, 16, 4210752); - // fontRendererObj.drawString("Active", 115, 16, 4210752); - } else { - fontRendererObj.drawString(mName, 8, 4, 4210752); - fontRendererObj.drawString("Stock", 25, 16, 4210752); - fontRendererObj.drawString("Active", 115, 16, 4210752); - } - } - - @Override - protected void drawGuiContainerBackgroundLayer(float par1, int par2, int par3) { - super.drawGuiContainerBackgroundLayer(par1, par2, par3); - int x = (width - xSize) / 2; - int y = (height - ySize) / 2; - drawTexturedModalRect(x, y, 0, 0, xSize, ySize); - } -} diff --git a/src/main/java/gtPlusPlus/xmod/gregtech/api/gui/hatches/charge/CONTAINER_Electric_2by2.java b/src/main/java/gtPlusPlus/xmod/gregtech/api/gui/hatches/charge/CONTAINER_Electric_2by2.java deleted file mode 100644 index 52627305e2..0000000000 --- a/src/main/java/gtPlusPlus/xmod/gregtech/api/gui/hatches/charge/CONTAINER_Electric_2by2.java +++ /dev/null @@ -1,21 +0,0 @@ -package gtPlusPlus.xmod.gregtech.api.gui.hatches.charge; - -import gregtech.api.interfaces.tileentity.IGregTechTileEntity; -import gtPlusPlus.core.slots.SlotElectric; -import gtPlusPlus.xmod.gregtech.api.gui.hatches.CONTAINER_2by2; -import net.minecraft.entity.player.InventoryPlayer; - -public class CONTAINER_Electric_2by2 extends CONTAINER_2by2 { - - public CONTAINER_Electric_2by2(InventoryPlayer aInventoryPlayer, IGregTechTileEntity aTileEntity) { - super(aInventoryPlayer, aTileEntity); - } - - @Override - public void addSlots(InventoryPlayer aInventoryPlayer) { - addSlotToContainer(new SlotElectric(mTileEntity, 0, 71, 26)); - addSlotToContainer(new SlotElectric(mTileEntity, 1, 89, 26)); - addSlotToContainer(new SlotElectric(mTileEntity, 2, 71, 44)); - addSlotToContainer(new SlotElectric(mTileEntity, 3, 89, 44)); - } -} diff --git a/src/main/java/gtPlusPlus/xmod/gregtech/api/gui/hatches/charge/CONTAINER_Electric_4by4.java b/src/main/java/gtPlusPlus/xmod/gregtech/api/gui/hatches/charge/CONTAINER_Electric_4by4.java deleted file mode 100644 index 64f0f00fbd..0000000000 --- a/src/main/java/gtPlusPlus/xmod/gregtech/api/gui/hatches/charge/CONTAINER_Electric_4by4.java +++ /dev/null @@ -1,33 +0,0 @@ -package gtPlusPlus.xmod.gregtech.api.gui.hatches.charge; - -import gregtech.api.interfaces.tileentity.IGregTechTileEntity; -import gtPlusPlus.core.slots.SlotElectric; -import gtPlusPlus.xmod.gregtech.api.gui.hatches.CONTAINER_4by4; -import net.minecraft.entity.player.InventoryPlayer; - -public class CONTAINER_Electric_4by4 extends CONTAINER_4by4 { - - public CONTAINER_Electric_4by4(InventoryPlayer aInventoryPlayer, IGregTechTileEntity aTileEntity) { - super(aInventoryPlayer, aTileEntity); - } - - @Override - public void addSlots(InventoryPlayer aInventoryPlayer) { - addSlotToContainer(new SlotElectric(mTileEntity, 0, 53, 8)); - addSlotToContainer(new SlotElectric(mTileEntity, 1, 71, 8)); - addSlotToContainer(new SlotElectric(mTileEntity, 2, 89, 8)); - addSlotToContainer(new SlotElectric(mTileEntity, 3, 107, 8)); - addSlotToContainer(new SlotElectric(mTileEntity, 4, 53, 26)); - addSlotToContainer(new SlotElectric(mTileEntity, 5, 71, 26)); - addSlotToContainer(new SlotElectric(mTileEntity, 6, 89, 26)); - addSlotToContainer(new SlotElectric(mTileEntity, 7, 107, 26)); - addSlotToContainer(new SlotElectric(mTileEntity, 8, 53, 44)); - addSlotToContainer(new SlotElectric(mTileEntity, 9, 71, 44)); - addSlotToContainer(new SlotElectric(mTileEntity, 10, 89, 44)); - addSlotToContainer(new SlotElectric(mTileEntity, 11, 107, 44)); - addSlotToContainer(new SlotElectric(mTileEntity, 12, 53, 62)); - addSlotToContainer(new SlotElectric(mTileEntity, 13, 71, 62)); - addSlotToContainer(new SlotElectric(mTileEntity, 14, 89, 62)); - addSlotToContainer(new SlotElectric(mTileEntity, 15, 107, 62)); - } -} diff --git a/src/main/java/gtPlusPlus/xmod/gregtech/api/gui/hatches/charge/GUI_Electric_2by2.java b/src/main/java/gtPlusPlus/xmod/gregtech/api/gui/hatches/charge/GUI_Electric_2by2.java deleted file mode 100644 index de06a97aaa..0000000000 --- a/src/main/java/gtPlusPlus/xmod/gregtech/api/gui/hatches/charge/GUI_Electric_2by2.java +++ /dev/null @@ -1,23 +0,0 @@ -package gtPlusPlus.xmod.gregtech.api.gui.hatches.charge; - -import static gregtech.api.enums.GT_Values.RES_PATH_GUI; - -import gregtech.api.interfaces.tileentity.IGregTechTileEntity; -import gtPlusPlus.xmod.gregtech.api.gui.hatches.GUI_2by2; -import net.minecraft.entity.player.InventoryPlayer; - -public class GUI_Electric_2by2 extends GUI_2by2 { - - public GUI_Electric_2by2(InventoryPlayer aInventoryPlayer, IGregTechTileEntity aTileEntity, String aName) { - super(new CONTAINER_Electric_2by2(aInventoryPlayer, aTileEntity), aInventoryPlayer, aTileEntity, aName); - } - - public GUI_Electric_2by2( - InventoryPlayer aInventoryPlayer, IGregTechTileEntity aTileEntity, String aName, String aBackground) { - super( - new CONTAINER_Electric_2by2(aInventoryPlayer, aTileEntity), - aInventoryPlayer, - aTileEntity, - RES_PATH_GUI + aBackground + "2by2.png"); - } -} diff --git a/src/main/java/gtPlusPlus/xmod/gregtech/api/gui/hatches/charge/GUI_Electric_4by4.java b/src/main/java/gtPlusPlus/xmod/gregtech/api/gui/hatches/charge/GUI_Electric_4by4.java deleted file mode 100644 index 16b1a44fea..0000000000 --- a/src/main/java/gtPlusPlus/xmod/gregtech/api/gui/hatches/charge/GUI_Electric_4by4.java +++ /dev/null @@ -1,23 +0,0 @@ -package gtPlusPlus.xmod.gregtech.api.gui.hatches.charge; - -import static gregtech.api.enums.GT_Values.RES_PATH_GUI; - -import gregtech.api.interfaces.tileentity.IGregTechTileEntity; -import gtPlusPlus.xmod.gregtech.api.gui.hatches.GUI_4by4; -import net.minecraft.entity.player.InventoryPlayer; - -public class GUI_Electric_4by4 extends GUI_4by4 { - - public GUI_Electric_4by4(InventoryPlayer aInventoryPlayer, IGregTechTileEntity aTileEntity, String aName) { - super(new CONTAINER_Electric_4by4(aInventoryPlayer, aTileEntity), aInventoryPlayer, aTileEntity, aName); - } - - public GUI_Electric_4by4( - InventoryPlayer aInventoryPlayer, IGregTechTileEntity aTileEntity, String aName, String aBackground) { - super( - new CONTAINER_Electric_4by4(aInventoryPlayer, aTileEntity), - aInventoryPlayer, - aTileEntity, - RES_PATH_GUI + aBackground + "4by4.png"); - } -} diff --git a/src/main/java/gtPlusPlus/xmod/gregtech/api/gui/power/CONTAINER_BasicTank.java b/src/main/java/gtPlusPlus/xmod/gregtech/api/gui/power/CONTAINER_BasicTank.java deleted file mode 100644 index 71c362b88b..0000000000 --- a/src/main/java/gtPlusPlus/xmod/gregtech/api/gui/power/CONTAINER_BasicTank.java +++ /dev/null @@ -1,66 +0,0 @@ -package gtPlusPlus.xmod.gregtech.api.gui.power; - -import cpw.mods.fml.relauncher.Side; -import cpw.mods.fml.relauncher.SideOnly; -import gregtech.api.gui.GT_ContainerMetaTile_Machine; -import gregtech.api.gui.GT_Slot_Output; -import gregtech.api.gui.GT_Slot_Render; -import gregtech.api.interfaces.tileentity.IGregTechTileEntity; -import gtPlusPlus.xmod.gregtech.api.metatileentity.custom.power.GTPP_MTE_BasicTank; -import java.util.Iterator; -import net.minecraft.entity.player.InventoryPlayer; -import net.minecraft.inventory.ICrafting; -import net.minecraft.inventory.Slot; - -public class CONTAINER_BasicTank extends GT_ContainerMetaTile_Machine { - public int mContent = 0; - - public CONTAINER_BasicTank(InventoryPlayer aInventoryPlayer, IGregTechTileEntity aTileEntity) { - super(aInventoryPlayer, aTileEntity); - } - - public void addSlots(InventoryPlayer aInventoryPlayer) { - this.addSlotToContainer(new Slot(this.mTileEntity, 0, 80, 17)); - this.addSlotToContainer(new GT_Slot_Output(this.mTileEntity, 1, 80, 53)); - this.addSlotToContainer(new GT_Slot_Render(this.mTileEntity, 2, 59, 42)); - } - - public void detectAndSendChanges() { - super.detectAndSendChanges(); - if (!this.mTileEntity.isClientSide() && this.mTileEntity.getMetaTileEntity() != null) { - if (((GTPP_MTE_BasicTank) this.mTileEntity.getMetaTileEntity()).mFluid != null) { - this.mContent = ((GTPP_MTE_BasicTank) this.mTileEntity.getMetaTileEntity()).mFluid.amount; - } else { - this.mContent = 0; - } - - Iterator var2 = this.crafters.iterator(); - - while (var2.hasNext()) { - ICrafting var1 = (ICrafting) var2.next(); - var1.sendProgressBarUpdate(this, 100, this.mContent & 'ï¿¿'); - var1.sendProgressBarUpdate(this, 101, this.mContent >>> 16); - } - } - } - - @SideOnly(Side.CLIENT) - public void updateProgressBar(int par1, int par2) { - super.updateProgressBar(par1, par2); - switch (par1) { - case 100: - this.mContent = this.mContent & -65536 | par2; - break; - case 101: - this.mContent = this.mContent & 'ï¿¿' | par2 << 16; - } - } - - public int getSlotCount() { - return 2; - } - - public int getShiftClickSlotCount() { - return 1; - } -} diff --git a/src/main/java/gtPlusPlus/xmod/gregtech/api/gui/power/GUI_BasicTank.java b/src/main/java/gtPlusPlus/xmod/gregtech/api/gui/power/GUI_BasicTank.java deleted file mode 100644 index 468b7dc7a9..0000000000 --- a/src/main/java/gtPlusPlus/xmod/gregtech/api/gui/power/GUI_BasicTank.java +++ /dev/null @@ -1,34 +0,0 @@ -package gtPlusPlus.xmod.gregtech.api.gui.power; - -import gregtech.api.gui.GT_GUIContainerMetaTile_Machine; -import gregtech.api.interfaces.tileentity.IGregTechTileEntity; -import gregtech.api.util.GT_Utility; -import net.minecraft.entity.player.InventoryPlayer; -import net.minecraft.util.StatCollector; - -public class GUI_BasicTank extends GT_GUIContainerMetaTile_Machine { - private final String mName; - - public GUI_BasicTank(InventoryPlayer aInventoryPlayer, IGregTechTileEntity aTileEntity, String aName) { - super(new CONTAINER_BasicTank(aInventoryPlayer, aTileEntity), "gregtech:textures/gui/BasicTank.png"); - this.mName = aName; - } - - protected void drawGuiContainerForegroundLayer(int par1, int par2) { - this.fontRendererObj.drawString( - StatCollector.translateToLocal("container.inventory"), 8, this.ySize - 96 + 2, 4210752); - this.fontRendererObj.drawString(this.mName, 8, 6, 4210752); - if (this.mContainer != null) { - this.fontRendererObj.drawString("Liquid Amount", 10, 20, 16448255); - this.fontRendererObj.drawString( - GT_Utility.parseNumberToString(((CONTAINER_BasicTank) this.mContainer).mContent), 10, 30, 16448255); - } - } - - protected void drawGuiContainerBackgroundLayer(float par1, int par2, int par3) { - super.drawGuiContainerBackgroundLayer(par1, par2, par3); - int x = (this.width - this.xSize) / 2; - int y = (this.height - this.ySize) / 2; - this.drawTexturedModalRect(x, y, 0, 0, this.xSize, this.ySize); - } -} diff --git a/src/main/java/gtPlusPlus/xmod/gregtech/api/gui/widget/DataStickSlotWidget.java b/src/main/java/gtPlusPlus/xmod/gregtech/api/gui/widget/DataStickSlotWidget.java new file mode 100644 index 0000000000..dbda217c27 --- /dev/null +++ b/src/main/java/gtPlusPlus/xmod/gregtech/api/gui/widget/DataStickSlotWidget.java @@ -0,0 +1,28 @@ +package gtPlusPlus.xmod.gregtech.api.gui.widget; + +import com.gtnewhorizons.modularui.api.ModularUITextures; +import com.gtnewhorizons.modularui.api.forge.IItemHandlerModifiable; +import com.gtnewhorizons.modularui.common.internal.wrapper.BaseSlot; +import com.gtnewhorizons.modularui.common.widget.SlotWidget; +import gregtech.api.enums.ItemList; +import gregtech.api.gui.modularui.GT_UITextures; +import gregtech.api.util.GT_Utility; + +public class DataStickSlotWidget extends SlotWidget { + + public DataStickSlotWidget(IItemHandlerModifiable handler, int index) { + this(new BaseSlot(handler, index) { + @Override + public int getSlotStackLimit() { + return 1; + } + }); + } + + private DataStickSlotWidget(BaseSlot slot) { + super(slot); + setFilter(stack -> GT_Utility.areStacksEqual(stack, ItemList.Tool_DataStick.get(1), true) + || GT_Utility.areStacksEqual(stack, ItemList.Tool_DataOrb.get(1), true)); + setBackground(ModularUITextures.ITEM_SLOT, GT_UITextures.OVERLAY_SLOT_DATA_ORB); + } +} diff --git a/src/main/java/gtPlusPlus/xmod/gregtech/api/gui/widget/ElectricSlotWidget.java b/src/main/java/gtPlusPlus/xmod/gregtech/api/gui/widget/ElectricSlotWidget.java new file mode 100644 index 0000000000..b575c3c4bd --- /dev/null +++ b/src/main/java/gtPlusPlus/xmod/gregtech/api/gui/widget/ElectricSlotWidget.java @@ -0,0 +1,37 @@ +package gtPlusPlus.xmod.gregtech.api.gui.widget; + +import com.gtnewhorizons.modularui.api.forge.IItemHandlerModifiable; +import com.gtnewhorizons.modularui.common.internal.wrapper.BaseSlot; +import com.gtnewhorizons.modularui.common.widget.SlotWidget; +import gregtech.api.items.GT_MetaGenerated_Tool; +import ic2.api.info.Info; +import ic2.api.item.ElectricItem; +import ic2.api.item.IElectricItem; +import net.minecraft.item.ItemStack; + +public class ElectricSlotWidget extends SlotWidget { + + public ElectricSlotWidget(IItemHandlerModifiable handler, int index) { + this(new BaseSlot(handler, index, false) { + @Override + public int getSlotStackLimit() { + return 1; + } + }); + } + + private ElectricSlotWidget(BaseSlot slot) { + super(slot); + setFilter(stack -> (accepts(stack)) + || (stack.getItem() instanceof GT_MetaGenerated_Tool) + || (stack.getItem() instanceof IElectricItem)); + } + + private boolean accepts(final ItemStack stack) { + if (stack == null) { + return false; + } + return (Info.itemEnergy.getEnergyValue(stack) > 0.0D) + || (ElectricItem.manager.discharge(stack, (1.0D / 0.0D), 4, true, true, true) > 0.0D); + } +} diff --git a/src/main/java/gtPlusPlus/xmod/gregtech/api/gui/workbench/GT_Container_AdvancedWorkbench.java b/src/main/java/gtPlusPlus/xmod/gregtech/api/gui/workbench/GT_Container_AdvancedWorkbench.java deleted file mode 100644 index 23dd924702..0000000000 --- a/src/main/java/gtPlusPlus/xmod/gregtech/api/gui/workbench/GT_Container_AdvancedWorkbench.java +++ /dev/null @@ -1,158 +0,0 @@ -package gtPlusPlus.xmod.gregtech.api.gui.workbench; - -import gregtech.api.gui.GT_ContainerMetaTile_Machine; -import gregtech.api.gui.GT_Slot_Holo; -import gregtech.api.interfaces.tileentity.IGregTechTileEntity; -import gregtech.api.util.GT_Utility; -import gtPlusPlus.api.objects.Logger; -import gtPlusPlus.core.slots.SlotBlueprint; -import gtPlusPlus.core.slots.SlotElectric; -import gtPlusPlus.xmod.gregtech.common.tileentities.storage.GT_MetaTileEntity_AdvancedCraftingTable; -import net.minecraft.entity.player.EntityPlayer; -import net.minecraft.entity.player.InventoryPlayer; -import net.minecraft.inventory.Slot; -import net.minecraft.item.ItemStack; - -public class GT_Container_AdvancedWorkbench extends GT_ContainerMetaTile_Machine { - - public GT_Container_AdvancedWorkbench(InventoryPlayer aInventoryPlayer, IGregTechTileEntity aTileEntity) { - super(aInventoryPlayer, aTileEntity); - } - - public void addSlots(InventoryPlayer aInventoryPlayer) { - addSlotToContainer(new Slot(mTileEntity, 0, 8, 8)); - addSlotToContainer(new Slot(mTileEntity, 1, 26, 8)); - addSlotToContainer(new Slot(mTileEntity, 2, 44, 8)); - addSlotToContainer(new Slot(mTileEntity, 3, 62, 8)); - addSlotToContainer(new Slot(mTileEntity, 4, 8, 26)); - addSlotToContainer(new Slot(mTileEntity, 5, 26, 26)); - addSlotToContainer(new Slot(mTileEntity, 6, 44, 26)); - addSlotToContainer(new Slot(mTileEntity, 7, 62, 26)); - addSlotToContainer(new Slot(mTileEntity, 8, 8, 44)); - addSlotToContainer(new Slot(mTileEntity, 9, 26, 44)); - addSlotToContainer(new Slot(mTileEntity, 10, 44, 44)); - addSlotToContainer(new Slot(mTileEntity, 11, 62, 44)); - addSlotToContainer(new Slot(mTileEntity, 12, 8, 62)); - addSlotToContainer(new Slot(mTileEntity, 13, 26, 62)); - addSlotToContainer(new Slot(mTileEntity, 14, 44, 62)); - addSlotToContainer(new Slot(mTileEntity, 15, 62, 62)); - - addSlotToContainer(new SlotElectric(mTileEntity, 16, 82, 8)); - addSlotToContainer(new SlotElectric(mTileEntity, 17, 100, 8)); - addSlotToContainer(new SlotElectric(mTileEntity, 18, 118, 8)); - addSlotToContainer(new SlotElectric(mTileEntity, 19, 136, 8)); - addSlotToContainer(new SlotElectric(mTileEntity, 20, 154, 8)); - - addSlotToContainer(new Slot(mTileEntity, 21, 82, 28)); - addSlotToContainer(new Slot(mTileEntity, 22, 100, 28)); - addSlotToContainer(new Slot(mTileEntity, 23, 118, 28)); - addSlotToContainer(new Slot(mTileEntity, 24, 82, 46)); - addSlotToContainer(new Slot(mTileEntity, 25, 100, 46)); - addSlotToContainer(new Slot(mTileEntity, 26, 118, 46)); - addSlotToContainer(new Slot(mTileEntity, 27, 82, 64)); - addSlotToContainer(new Slot(mTileEntity, 28, 100, 64)); - addSlotToContainer(new Slot(mTileEntity, 29, 118, 64)); - - addSlotToContainer(new Slot(mTileEntity, 33, 154, 28)); - addSlotToContainer(new Slot(mTileEntity, 34, 154, 64)); - - addSlotToContainer(new SlotBlueprint(mTileEntity, 30, 136, 28)); - addSlotToContainer(new GT_Slot_Holo(mTileEntity, 31, 136, 64, false, false, 1)); - addSlotToContainer(new GT_Slot_Holo(mTileEntity, 32, 154, 46, false, false, 1)); - addSlotToContainer(new GT_Slot_Holo(mTileEntity, 32, 136, 46, false, false, 1)); - } - - public ItemStack slotClick(int aSlotIndex, int aMouseclick, int aShifthold, EntityPlayer aPlayer) { - Logger.INFO("Clicked on slot " + aSlotIndex); - if (aSlotIndex < 21 || aSlotIndex > 35) return super.slotClick(aSlotIndex, aMouseclick, aShifthold, aPlayer); - if (mTileEntity == null || mTileEntity.getMetaTileEntity() == null) return null; - try { - ItemStack tStack = ((Slot) inventorySlots.get(aSlotIndex)).getStack(); - if (tStack != null - && tStack.stackSize <= 0 - && !GT_Utility.areStacksEqual(tStack, aPlayer.inventory.getItemStack())) { - return null; - } - if (aSlotIndex == 32) { - if (aMouseclick == 0 && aShifthold == 1) { - ((GT_MetaTileEntity_AdvancedCraftingTable) mTileEntity.getMetaTileEntity()).setBluePrint(null); - return null; - } - } else if (aSlotIndex == 33) { - ItemStack tStack2, - tCraftedStack = - ((GT_MetaTileEntity_AdvancedCraftingTable) mTileEntity.getMetaTileEntity()) - .getCraftingOutput(); - if (tCraftedStack != null) { - if (aShifthold == 1) { - for (byte i = 0; i < aPlayer.inventory.mainInventory.length; i++) { - for (byte j = 0; - j < tCraftedStack.getMaxStackSize() / tCraftedStack.stackSize - && ((GT_MetaTileEntity_AdvancedCraftingTable) - mTileEntity.getMetaTileEntity()) - .canDoCraftingOutput(); - j++) { - if (!GT_Utility.areStacksEqual( - tStack2 = ((GT_MetaTileEntity_AdvancedCraftingTable) - mTileEntity.getMetaTileEntity()) - .getCraftingOutput(), - tCraftedStack) - || tStack.stackSize != tStack2.stackSize) - return aPlayer.inventory.getItemStack(); - aPlayer.inventory.mainInventory[i] = (((GT_MetaTileEntity_AdvancedCraftingTable) - mTileEntity.getMetaTileEntity()) - .consumeMaterials(aPlayer, aPlayer.inventory.mainInventory[i])); - } - } - } else { - if (aMouseclick == 0) { - if (((GT_MetaTileEntity_AdvancedCraftingTable) mTileEntity.getMetaTileEntity()) - .canDoCraftingOutput()) - aPlayer.inventory.setItemStack( - ((GT_MetaTileEntity_AdvancedCraftingTable) mTileEntity.getMetaTileEntity()) - .consumeMaterials(aPlayer, aPlayer.inventory.getItemStack())); - return aPlayer.inventory.getItemStack(); - } else { - for (int i = 0; - i < tCraftedStack.getMaxStackSize() / tCraftedStack.stackSize - && ((GT_MetaTileEntity_AdvancedCraftingTable) - mTileEntity.getMetaTileEntity()) - .canDoCraftingOutput(); - i++) { - if (!GT_Utility.areStacksEqual( - tStack2 = ((GT_MetaTileEntity_AdvancedCraftingTable) - mTileEntity.getMetaTileEntity()) - .getCraftingOutput(), - tCraftedStack) - || tStack.stackSize != tStack2.stackSize) - return aPlayer.inventory.getItemStack(); - aPlayer.inventory.setItemStack( - ((GT_MetaTileEntity_AdvancedCraftingTable) mTileEntity.getMetaTileEntity()) - .consumeMaterials(aPlayer, aPlayer.inventory.getItemStack())); - } - return aPlayer.inventory.getItemStack(); - } - } - } - return null; - } else if (aSlotIndex == 34) { - ((GT_MetaTileEntity_AdvancedCraftingTable) mTileEntity.getMetaTileEntity()).mFlushMode = true; - return null; - } else if (aSlotIndex == 35) { - ((GT_MetaTileEntity_AdvancedCraftingTable) mTileEntity.getMetaTileEntity()).sortIntoTheInputSlots(); - return null; - } - } catch (Throwable e) { - // GT_Log.log.catching(e); - } - return super.slotClick(aSlotIndex, aMouseclick, aShifthold, aPlayer); - } - - public int getSlotCount() { - return 33; - } - - public int getShiftClickSlotCount() { - return 21; - } -} diff --git a/src/main/java/gtPlusPlus/xmod/gregtech/api/gui/workbench/GT_Container_BronzeWorkbench.java b/src/main/java/gtPlusPlus/xmod/gregtech/api/gui/workbench/GT_Container_BronzeWorkbench.java deleted file mode 100644 index 46bd70e55a..0000000000 --- a/src/main/java/gtPlusPlus/xmod/gregtech/api/gui/workbench/GT_Container_BronzeWorkbench.java +++ /dev/null @@ -1,153 +0,0 @@ -package gtPlusPlus.xmod.gregtech.api.gui.workbench; - -import gregtech.api.gui.GT_ContainerMetaTile_Machine; -import gregtech.api.gui.GT_Slot_Holo; -import gregtech.api.interfaces.tileentity.IGregTechTileEntity; -import gregtech.api.util.GT_Utility; -import gtPlusPlus.core.slots.SlotBlueprint; -import gtPlusPlus.xmod.gregtech.common.tileentities.storage.GT_MetaTileEntity_BronzeCraftingTable; -import net.minecraft.entity.player.EntityPlayer; -import net.minecraft.entity.player.InventoryPlayer; -import net.minecraft.inventory.Slot; -import net.minecraft.item.ItemStack; - -public class GT_Container_BronzeWorkbench extends GT_ContainerMetaTile_Machine { - - public GT_Container_BronzeWorkbench(InventoryPlayer aInventoryPlayer, IGregTechTileEntity aTileEntity) { - super(aInventoryPlayer, aTileEntity); - } - - public void addSlots(InventoryPlayer aInventoryPlayer) { - addSlotToContainer(new Slot(mTileEntity, 0, 8, 8)); - addSlotToContainer(new Slot(mTileEntity, 1, 26, 8)); - addSlotToContainer(new Slot(mTileEntity, 2, 44, 8)); - addSlotToContainer(new Slot(mTileEntity, 3, 62, 8)); - addSlotToContainer(new Slot(mTileEntity, 4, 8, 26)); - addSlotToContainer(new Slot(mTileEntity, 5, 26, 26)); - addSlotToContainer(new Slot(mTileEntity, 6, 44, 26)); - addSlotToContainer(new Slot(mTileEntity, 7, 62, 26)); - addSlotToContainer(new Slot(mTileEntity, 8, 8, 44)); - addSlotToContainer(new Slot(mTileEntity, 9, 26, 44)); - addSlotToContainer(new Slot(mTileEntity, 10, 44, 44)); - addSlotToContainer(new Slot(mTileEntity, 11, 62, 44)); - addSlotToContainer(new Slot(mTileEntity, 12, 8, 62)); - addSlotToContainer(new Slot(mTileEntity, 13, 26, 62)); - addSlotToContainer(new Slot(mTileEntity, 14, 44, 62)); - addSlotToContainer(new Slot(mTileEntity, 15, 62, 62)); - - addSlotToContainer(new Slot(mTileEntity, 16, 82, 8)); - addSlotToContainer(new Slot(mTileEntity, 17, 100, 8)); - addSlotToContainer(new Slot(mTileEntity, 18, 118, 8)); - addSlotToContainer(new Slot(mTileEntity, 19, 136, 8)); - addSlotToContainer(new Slot(mTileEntity, 20, 154, 8)); - - addSlotToContainer(new Slot(mTileEntity, 21, 82, 28)); - addSlotToContainer(new Slot(mTileEntity, 22, 100, 28)); - addSlotToContainer(new Slot(mTileEntity, 23, 118, 28)); - addSlotToContainer(new Slot(mTileEntity, 24, 82, 46)); - addSlotToContainer(new Slot(mTileEntity, 25, 100, 46)); - addSlotToContainer(new Slot(mTileEntity, 26, 118, 46)); - addSlotToContainer(new Slot(mTileEntity, 27, 82, 64)); - addSlotToContainer(new Slot(mTileEntity, 28, 100, 64)); - addSlotToContainer(new Slot(mTileEntity, 29, 118, 64)); - - addSlotToContainer(new Slot(mTileEntity, 33, 154, 28)); - addSlotToContainer(new Slot(mTileEntity, 34, 154, 64)); - - addSlotToContainer(new SlotBlueprint(mTileEntity, 30, 136, 28)); - addSlotToContainer(new GT_Slot_Holo(mTileEntity, 31, 136, 64, false, false, 1)); - addSlotToContainer(new GT_Slot_Holo(mTileEntity, 32, 154, 46, false, false, 1)); - addSlotToContainer(new GT_Slot_Holo(mTileEntity, 32, 136, 46, false, false, 1)); - } - - public ItemStack slotClick(int aSlotIndex, int aMouseclick, int aShifthold, EntityPlayer aPlayer) { - if (aSlotIndex < 21 || aSlotIndex > 35) return super.slotClick(aSlotIndex, aMouseclick, aShifthold, aPlayer); - if (mTileEntity == null || mTileEntity.getMetaTileEntity() == null) return null; - try { - ItemStack tStack = ((Slot) inventorySlots.get(aSlotIndex)).getStack(); - if (tStack != null - && tStack.stackSize <= 0 - && !GT_Utility.areStacksEqual(tStack, aPlayer.inventory.getItemStack())) { - return null; - } - if (aSlotIndex == 32) { - if (aMouseclick == 0 && aShifthold == 1) { - ((GT_MetaTileEntity_BronzeCraftingTable) mTileEntity.getMetaTileEntity()).setBluePrint(null); - return null; - } - } else if (aSlotIndex == 33) { - ItemStack tStack2, - tCraftedStack = - ((GT_MetaTileEntity_BronzeCraftingTable) mTileEntity.getMetaTileEntity()) - .getCraftingOutput(); - if (tCraftedStack != null) { - if (aShifthold == 1) { - for (byte i = 0; i < aPlayer.inventory.mainInventory.length; i++) { - for (byte j = 0; - j < tCraftedStack.getMaxStackSize() / tCraftedStack.stackSize - && ((GT_MetaTileEntity_BronzeCraftingTable) mTileEntity.getMetaTileEntity()) - .canDoCraftingOutput(); - j++) { - if (!GT_Utility.areStacksEqual( - tStack2 = ((GT_MetaTileEntity_BronzeCraftingTable) - mTileEntity.getMetaTileEntity()) - .getCraftingOutput(), - tCraftedStack) - || tStack.stackSize != tStack2.stackSize) - return aPlayer.inventory.getItemStack(); - aPlayer.inventory.mainInventory[i] = (((GT_MetaTileEntity_BronzeCraftingTable) - mTileEntity.getMetaTileEntity()) - .consumeMaterials(aPlayer, aPlayer.inventory.mainInventory[i])); - } - } - } else { - if (aMouseclick == 0) { - if (((GT_MetaTileEntity_BronzeCraftingTable) mTileEntity.getMetaTileEntity()) - .canDoCraftingOutput()) - aPlayer.inventory.setItemStack( - ((GT_MetaTileEntity_BronzeCraftingTable) mTileEntity.getMetaTileEntity()) - .consumeMaterials(aPlayer, aPlayer.inventory.getItemStack())); - return aPlayer.inventory.getItemStack(); - } else { - for (int i = 0; - i < tCraftedStack.getMaxStackSize() / tCraftedStack.stackSize - && ((GT_MetaTileEntity_BronzeCraftingTable) mTileEntity.getMetaTileEntity()) - .canDoCraftingOutput(); - i++) { - if (!GT_Utility.areStacksEqual( - tStack2 = ((GT_MetaTileEntity_BronzeCraftingTable) - mTileEntity.getMetaTileEntity()) - .getCraftingOutput(), - tCraftedStack) - || tStack.stackSize != tStack2.stackSize) - return aPlayer.inventory.getItemStack(); - aPlayer.inventory.setItemStack( - ((GT_MetaTileEntity_BronzeCraftingTable) mTileEntity.getMetaTileEntity()) - .consumeMaterials(aPlayer, aPlayer.inventory.getItemStack())); - } - return aPlayer.inventory.getItemStack(); - } - } - } - return null; - } else if (aSlotIndex == 34) { - ((GT_MetaTileEntity_BronzeCraftingTable) mTileEntity.getMetaTileEntity()).mFlushMode = true; - return null; - } else if (aSlotIndex == 35) { - ((GT_MetaTileEntity_BronzeCraftingTable) mTileEntity.getMetaTileEntity()).sortIntoTheInputSlots(); - return null; - } - } catch (Throwable e) { - // GT_Log.log.catching(e); - } - return super.slotClick(aSlotIndex, aMouseclick, aShifthold, aPlayer); - } - - public int getSlotCount() { - return 33; - } - - public int getShiftClickSlotCount() { - return 21; - } -} diff --git a/src/main/java/gtPlusPlus/xmod/gregtech/api/gui/workbench/GT_GUIContainer_AdvancedWorkbench.java b/src/main/java/gtPlusPlus/xmod/gregtech/api/gui/workbench/GT_GUIContainer_AdvancedWorkbench.java deleted file mode 100644 index d341a0766d..0000000000 --- a/src/main/java/gtPlusPlus/xmod/gregtech/api/gui/workbench/GT_GUIContainer_AdvancedWorkbench.java +++ /dev/null @@ -1,89 +0,0 @@ -package gtPlusPlus.xmod.gregtech.api.gui.workbench; - -import gregtech.api.gui.GT_ContainerMetaTile_Machine; -import gregtech.api.gui.GT_GUIContainerMetaTile_Machine; -import gregtech.api.interfaces.tileentity.IGregTechTileEntity; -import gtPlusPlus.core.lib.CORE; -import gtPlusPlus.core.util.sys.KeyboardUtils; -import java.util.ArrayList; -import java.util.List; -import net.minecraft.client.renderer.RenderHelper; -import net.minecraft.entity.player.InventoryPlayer; - -public class GT_GUIContainer_AdvancedWorkbench extends GT_GUIContainerMetaTile_Machine { - - private final String mLocalName; - - public GT_GUIContainer_AdvancedWorkbench( - InventoryPlayer aInventoryPlayer, IGregTechTileEntity aTileEntity, String aLocalName) { - super( - new GT_Container_AdvancedWorkbench(aInventoryPlayer, aTileEntity), - CORE.RES_PATH_GUI + "AdvancedCraftingTable.png"); - mLocalName = aLocalName; - } - - public GT_GUIContainer_AdvancedWorkbench( - GT_ContainerMetaTile_Machine aContainer, String aLocalName, String aResource) { - super(aContainer, aResource); - mLocalName = aLocalName; - } - - @Override - protected void drawGuiContainerForegroundLayer(int par1, int par2) { - // fontRendererObj.drawString(mLocalName, 8, 4, 4210752); - this.drawTooltip(par1, par2); - } - - private void drawTooltip(final int x2, final int y2) { - final int xStart = (this.width - this.xSize) / 2; - final int yStart = (this.height - this.ySize) / 2; - final int x3 = x2 - xStart; - final int y3 = y2 - yStart + 5; - final List<String> list = new ArrayList<String>(); - // 154 - 172 - - if (KeyboardUtils.isShiftKeyDown()) { - if (y3 >= 30 && y3 <= 49) { - if (x3 >= 135 && x3 <= 154) { - list.add("Blueprint Slot"); - list.add("Shift+Lmb Sets to crafting output"); - } - if (x3 >= 153 && x3 <= 170) { - list.add("Extraction Slot"); - list.add("Things can always be pulled from here"); - } - } - if (y3 >= 50 && y3 <= 67) { - if (x3 >= 135 && x3 <= 152) { - list.add("Flush"); - list.add("Empty crafting grid back to storage"); - } - if (x3 >= 153 && x3 <= 170) { - list.add("Automation"); - list.add("Allows output while"); - list.add("crafting grid is full"); - } - } - if (y3 >= 68 && y3 <= 85) { - if (x3 >= 135 && x3 <= 152) { - list.add("Output Slot"); - } - if (x3 >= 153 && x3 <= 170) { - list.add("Free Parking"); - } - } - } - if (!list.isEmpty()) { - this.drawHoveringText(list, x3, y3, this.fontRendererObj); - RenderHelper.enableGUIStandardItemLighting(); - } - } - - @Override - protected void drawGuiContainerBackgroundLayer(float par1, int par2, int par3) { - super.drawGuiContainerBackgroundLayer(par1, par2, par3); - int x = (width - xSize) / 2; - int y = (height - ySize) / 2; - drawTexturedModalRect(x, y, 0, 0, xSize, ySize); - } -} diff --git a/src/main/java/gtPlusPlus/xmod/gregtech/api/gui/workbench/GT_GUIContainer_BronzeWorkbench.java b/src/main/java/gtPlusPlus/xmod/gregtech/api/gui/workbench/GT_GUIContainer_BronzeWorkbench.java deleted file mode 100644 index 0967317090..0000000000 --- a/src/main/java/gtPlusPlus/xmod/gregtech/api/gui/workbench/GT_GUIContainer_BronzeWorkbench.java +++ /dev/null @@ -1,16 +0,0 @@ -package gtPlusPlus.xmod.gregtech.api.gui.workbench; - -import gregtech.api.interfaces.tileentity.IGregTechTileEntity; -import gtPlusPlus.core.lib.CORE; -import net.minecraft.entity.player.InventoryPlayer; - -public class GT_GUIContainer_BronzeWorkbench extends GT_GUIContainer_AdvancedWorkbench { - - public GT_GUIContainer_BronzeWorkbench( - InventoryPlayer aInventoryPlayer, IGregTechTileEntity aTileEntity, String aLocalName) { - super( - new GT_Container_BronzeWorkbench(aInventoryPlayer, aTileEntity), - aLocalName, - CORE.RES_PATH_GUI + "BronzeCraftingTable.png"); - } -} diff --git a/src/main/java/gtPlusPlus/xmod/gregtech/api/metatileentity/custom/power/GTPP_MTE_BasicLosslessGenerator.java b/src/main/java/gtPlusPlus/xmod/gregtech/api/metatileentity/custom/power/GTPP_MTE_BasicLosslessGenerator.java index 332d911ac4..841359c0b2 100644 --- a/src/main/java/gtPlusPlus/xmod/gregtech/api/metatileentity/custom/power/GTPP_MTE_BasicLosslessGenerator.java +++ b/src/main/java/gtPlusPlus/xmod/gregtech/api/metatileentity/custom/power/GTPP_MTE_BasicLosslessGenerator.java @@ -2,6 +2,7 @@ package gtPlusPlus.xmod.gregtech.api.metatileentity.custom.power; import gregtech.api.enums.GT_Values; import gregtech.api.enums.Textures.BlockIcons; +import gregtech.api.gui.modularui.GT_UIInfos; import gregtech.api.interfaces.ITexture; import gregtech.api.interfaces.tileentity.IGregTechTileEntity; import gregtech.api.util.GT_Recipe; @@ -80,12 +81,8 @@ public abstract class GTPP_MTE_BasicLosslessGenerator extends GTPP_MTE_BasicTank public boolean onRightclick(IGregTechTileEntity aBaseMetaTileEntity, EntityPlayer aPlayer) { Logger.WARNING("Right Clicked"); - if (aBaseMetaTileEntity.isClientSide()) { - return true; - } else { - aBaseMetaTileEntity.openGUI(aPlayer); - return true; - } + GT_UIInfos.openGTTileEntityUI(aBaseMetaTileEntity, aPlayer); + return true; } public ITexture[] getFront(byte aColor) { @@ -330,4 +327,9 @@ public abstract class GTPP_MTE_BasicLosslessGenerator extends GTPP_MTE_BasicTank public int getTankPressure() { return -100; } + + @Override + public boolean useModularUI() { + return true; + } } diff --git a/src/main/java/gtPlusPlus/xmod/gregtech/api/metatileentity/custom/power/GTPP_MTE_BasicMachine.java b/src/main/java/gtPlusPlus/xmod/gregtech/api/metatileentity/custom/power/GTPP_MTE_BasicMachine.java index f6cf2391b3..cb3f42b6f6 100644 --- a/src/main/java/gtPlusPlus/xmod/gregtech/api/metatileentity/custom/power/GTPP_MTE_BasicMachine.java +++ b/src/main/java/gtPlusPlus/xmod/gregtech/api/metatileentity/custom/power/GTPP_MTE_BasicMachine.java @@ -5,8 +5,7 @@ import static gregtech.api.enums.GT_Values.V; import gregtech.api.GregTech_API; import gregtech.api.enums.ItemList; import gregtech.api.enums.Textures; -import gregtech.api.gui.GT_Container_BasicMachine; -import gregtech.api.gui.GT_GUIContainer_BasicMachine; +import gregtech.api.gui.modularui.GT_UIInfos; import gregtech.api.interfaces.ITexture; import gregtech.api.interfaces.tileentity.IGregTechTileEntity; import gregtech.api.metatileentity.implementations.GT_MetaTileEntity_MultiBlockBase; @@ -19,7 +18,6 @@ import gregtech.api.util.GT_Utility; import gtPlusPlus.api.objects.random.XSTR; import java.util.Arrays; import net.minecraft.entity.player.EntityPlayer; -import net.minecraft.entity.player.InventoryPlayer; import net.minecraft.item.ItemStack; import net.minecraft.nbt.NBTTagCompound; import net.minecraft.tileentity.TileEntity; @@ -446,29 +444,11 @@ public abstract class GTPP_MTE_BasicMachine extends GTPP_MTE_BasicTank { @Override public boolean onRightclick(IGregTechTileEntity aBaseMetaTileEntity, EntityPlayer aPlayer) { - if (aBaseMetaTileEntity.isClientSide()) return true; - aBaseMetaTileEntity.openGUI(aPlayer); + GT_UIInfos.openGTTileEntityUI(aBaseMetaTileEntity, aPlayer); return true; } @Override - public Object getServerGUI(int aID, InventoryPlayer aPlayerInventory, IGregTechTileEntity aBaseMetaTileEntity) { - return new GT_Container_BasicMachine(aPlayerInventory, aBaseMetaTileEntity); - } - - @Override - public Object getClientGUI(int aID, InventoryPlayer aPlayerInventory, IGregTechTileEntity aBaseMetaTileEntity) { - return new GT_GUIContainer_BasicMachine( - aPlayerInventory, - aBaseMetaTileEntity, - getLocalName(), - mGUIName, - GT_Utility.isStringValid(mNEIName) - ? mNEIName - : getRecipeList() != null ? getRecipeList().mUnlocalizedName : ""); - } - - @Override public void initDefaultModes(NBTTagCompound aNBT) { mMainFacing = -1; } diff --git a/src/main/java/gtPlusPlus/xmod/gregtech/api/metatileentity/custom/power/GTPP_MTE_BasicTank.java b/src/main/java/gtPlusPlus/xmod/gregtech/api/metatileentity/custom/power/GTPP_MTE_BasicTank.java index bbc2206784..7e2cfaa94a 100644 --- a/src/main/java/gtPlusPlus/xmod/gregtech/api/metatileentity/custom/power/GTPP_MTE_BasicTank.java +++ b/src/main/java/gtPlusPlus/xmod/gregtech/api/metatileentity/custom/power/GTPP_MTE_BasicTank.java @@ -4,9 +4,6 @@ import gregtech.api.enums.ItemList; import gregtech.api.interfaces.ITexture; import gregtech.api.interfaces.tileentity.IGregTechTileEntity; import gregtech.api.util.GT_Utility; -import gtPlusPlus.xmod.gregtech.api.gui.power.CONTAINER_BasicTank; -import gtPlusPlus.xmod.gregtech.api.gui.power.GUI_BasicTank; -import net.minecraft.entity.player.InventoryPlayer; import net.minecraft.item.ItemStack; import net.minecraft.nbt.NBTTagCompound; import net.minecraftforge.fluids.FluidStack; @@ -130,16 +127,6 @@ public abstract class GTPP_MTE_BasicTank extends GTPP_MTE_TieredMachineBlock { } @Override - public Object getServerGUI(int aID, InventoryPlayer aPlayerInventory, IGregTechTileEntity aBaseMetaTileEntity) { - return new CONTAINER_BasicTank(aPlayerInventory, aBaseMetaTileEntity); - } - - @Override - public Object getClientGUI(int aID, InventoryPlayer aPlayerInventory, IGregTechTileEntity aBaseMetaTileEntity) { - return new GUI_BasicTank(aPlayerInventory, aBaseMetaTileEntity, getLocalName()); - } - - @Override public void onPreTick(IGregTechTileEntity aBaseMetaTileEntity, long aTick) { if (aBaseMetaTileEntity.isServerSide()) { if (isFluidChangingAllowed() && getFillableStack() != null && getFillableStack().amount <= 0) diff --git a/src/main/java/gtPlusPlus/xmod/gregtech/api/metatileentity/implementations/GT_MetaTileEntity_BasicBreaker.java b/src/main/java/gtPlusPlus/xmod/gregtech/api/metatileentity/implementations/GT_MetaTileEntity_BasicBreaker.java index ac069be52d..b9ffc8740a 100644 --- a/src/main/java/gtPlusPlus/xmod/gregtech/api/metatileentity/implementations/GT_MetaTileEntity_BasicBreaker.java +++ b/src/main/java/gtPlusPlus/xmod/gregtech/api/metatileentity/implementations/GT_MetaTileEntity_BasicBreaker.java @@ -1,11 +1,13 @@ package gtPlusPlus.xmod.gregtech.api.metatileentity.implementations; +import com.gtnewhorizons.modularui.api.screen.ModularWindow; +import com.gtnewhorizons.modularui.api.screen.UIBuildContext; import gregtech.api.enums.GT_Values; import gregtech.api.enums.Textures.BlockIcons; -import gregtech.api.gui.GT_Container_4by4; -import gregtech.api.gui.GT_GUIContainer_4by4; +import gregtech.api.gui.modularui.GT_UIInfos; import gregtech.api.interfaces.ITexture; import gregtech.api.interfaces.metatileentity.IMetaTileEntity; +import gregtech.api.interfaces.modularui.IAddUIWidgets; import gregtech.api.interfaces.tileentity.IGregTechTileEntity; import gregtech.api.items.GT_MetaBase_Item; import gregtech.api.util.GT_ModHandler; @@ -14,12 +16,11 @@ import gtPlusPlus.xmod.gregtech.api.metatileentity.custom.power.GTPP_MTE_TieredM import ic2.api.item.ElectricItem; import ic2.api.item.IElectricItem; import net.minecraft.entity.player.EntityPlayer; -import net.minecraft.entity.player.InventoryPlayer; import net.minecraft.item.ItemStack; import net.minecraft.nbt.NBTTagCompound; import net.minecraft.util.EnumChatFormatting; -public class GT_MetaTileEntity_BasicBreaker extends GTPP_MTE_TieredMachineBlock { +public class GT_MetaTileEntity_BasicBreaker extends GTPP_MTE_TieredMachineBlock implements IAddUIWidgets { public boolean mCharge = false; public boolean mDecharge = false; @@ -190,20 +191,8 @@ public class GT_MetaTileEntity_BasicBreaker extends GTPP_MTE_TieredMachineBlock public void loadNBTData(NBTTagCompound aNBT) {} public boolean onRightclick(IGregTechTileEntity aBaseMetaTileEntity, EntityPlayer aPlayer) { - if (aBaseMetaTileEntity.isClientSide()) { - return true; - } else { - aBaseMetaTileEntity.openGUI(aPlayer); - return true; - } - } - - public Object getServerGUI(int aID, InventoryPlayer aPlayerInventory, IGregTechTileEntity aBaseMetaTileEntity) { - return new GT_Container_4by4(aPlayerInventory, aBaseMetaTileEntity); - } - - public Object getClientGUI(int aID, InventoryPlayer aPlayerInventory, IGregTechTileEntity aBaseMetaTileEntity) { - return new GT_GUIContainer_4by4(aPlayerInventory, aBaseMetaTileEntity, this.getLocalName()); + GT_UIInfos.openGTTileEntityUI(aBaseMetaTileEntity, aPlayer); + return true; } public void onPostTick(IGregTechTileEntity aBaseMetaTileEntity, long aTick) { @@ -299,4 +288,14 @@ public class GT_MetaTileEntity_BasicBreaker extends GTPP_MTE_TieredMachineBlock public boolean doesExplode() { return true; } + + @Override + public boolean useModularUI() { + return true; + } + + @Override + public void addUIWidgets(ModularWindow.Builder builder, UIBuildContext buildContext) { + getBaseMetaTileEntity().add4by4Slots(builder); + } } diff --git a/src/main/java/gtPlusPlus/xmod/gregtech/api/metatileentity/implementations/GT_MetaTileEntity_DeluxeMachine.java b/src/main/java/gtPlusPlus/xmod/gregtech/api/metatileentity/implementations/GT_MetaTileEntity_DeluxeMachine.java index 007e6a1761..299580391a 100644 --- a/src/main/java/gtPlusPlus/xmod/gregtech/api/metatileentity/implementations/GT_MetaTileEntity_DeluxeMachine.java +++ b/src/main/java/gtPlusPlus/xmod/gregtech/api/metatileentity/implementations/GT_MetaTileEntity_DeluxeMachine.java @@ -5,8 +5,7 @@ import static gregtech.api.enums.GT_Values.V; import gregtech.api.GregTech_API; import gregtech.api.enums.ItemList; import gregtech.api.enums.Textures; -import gregtech.api.gui.GT_Container_BasicMachine; -import gregtech.api.gui.GT_GUIContainer_BasicMachine; +import gregtech.api.gui.modularui.GT_UIInfos; import gregtech.api.interfaces.ITexture; import gregtech.api.interfaces.tileentity.IGregTechTileEntity; import gregtech.api.objects.GT_ItemStack; @@ -19,7 +18,6 @@ import gtPlusPlus.api.objects.Logger; import gtPlusPlus.api.objects.random.XSTR; import java.util.Arrays; import net.minecraft.entity.player.EntityPlayer; -import net.minecraft.entity.player.InventoryPlayer; import net.minecraft.item.ItemStack; import net.minecraft.nbt.NBTTagCompound; import net.minecraft.tileentity.TileEntity; @@ -395,39 +393,11 @@ public abstract class GT_MetaTileEntity_DeluxeMachine extends GT_MetaTileEntity_ @Override public boolean onRightclick(IGregTechTileEntity aBaseMetaTileEntity, EntityPlayer aPlayer) { - if (aBaseMetaTileEntity.isClientSide()) return true; - if (!false) { - aBaseMetaTileEntity.openGUI(aPlayer); - return true; - } - for (byte i = 0; i < 6; i++) { - if (aBaseMetaTileEntity.getAirAtSide(i)) { - aBaseMetaTileEntity.openGUI(aPlayer); - return true; - } - } - GT_Utility.sendChatToPlayer(aPlayer, "No free Side!"); + GT_UIInfos.openGTTileEntityUI(aBaseMetaTileEntity, aPlayer); return true; } @Override - public Object getServerGUI(int aID, InventoryPlayer aPlayerInventory, IGregTechTileEntity aBaseMetaTileEntity) { - return new GT_Container_BasicMachine(aPlayerInventory, aBaseMetaTileEntity); - } - - @Override - public Object getClientGUI(int aID, InventoryPlayer aPlayerInventory, IGregTechTileEntity aBaseMetaTileEntity) { - return new GT_GUIContainer_BasicMachine( - aPlayerInventory, - aBaseMetaTileEntity, - getLocalName(), - mGUIName, - GT_Utility.isStringValid(mNEIName) - ? mNEIName - : getRecipeList() != null ? getRecipeList().mUnlocalizedName : ""); - } - - @Override public void initDefaultModes(NBTTagCompound aNBT) { mMainFacing = -1; } diff --git a/src/main/java/gtPlusPlus/xmod/gregtech/api/metatileentity/implementations/GT_MetaTileEntity_DeluxeTank.java b/src/main/java/gtPlusPlus/xmod/gregtech/api/metatileentity/implementations/GT_MetaTileEntity_DeluxeTank.java index 4bd4e30f30..50c2237209 100644 --- a/src/main/java/gtPlusPlus/xmod/gregtech/api/metatileentity/implementations/GT_MetaTileEntity_DeluxeTank.java +++ b/src/main/java/gtPlusPlus/xmod/gregtech/api/metatileentity/implementations/GT_MetaTileEntity_DeluxeTank.java @@ -6,9 +6,6 @@ import gregtech.api.interfaces.tileentity.IGregTechTileEntity; import gregtech.api.metatileentity.implementations.GT_MetaTileEntity_BasicTank; import gregtech.api.util.GT_Utility; import gtPlusPlus.api.objects.Logger; -import gtPlusPlus.xmod.gregtech.api.gui.CONTAINER_DeluxeTank; -import gtPlusPlus.xmod.gregtech.api.gui.GUI_DeluxeTank; -import net.minecraft.entity.player.InventoryPlayer; import net.minecraft.item.ItemStack; import net.minecraft.nbt.NBTTagCompound; import net.minecraftforge.fluids.FluidStack; @@ -165,18 +162,6 @@ public abstract class GT_MetaTileEntity_DeluxeTank extends GT_MetaTileEntity_Bas } @Override - public Object getServerGUI( - final int aID, final InventoryPlayer aPlayerInventory, final IGregTechTileEntity aBaseMetaTileEntity) { - return new CONTAINER_DeluxeTank(aPlayerInventory, aBaseMetaTileEntity); - } - - @Override - public Object getClientGUI( - final int aID, final InventoryPlayer aPlayerInventory, final IGregTechTileEntity aBaseMetaTileEntity) { - return new GUI_DeluxeTank(aPlayerInventory, aBaseMetaTileEntity, this.getLocalName()); - } - - @Override public void onPreTick(final IGregTechTileEntity aBaseMetaTileEntity, final long aTick) { if (aBaseMetaTileEntity.isServerSide()) { if (this.isFluidChangingAllowed() diff --git a/src/main/java/gtPlusPlus/xmod/gregtech/api/metatileentity/implementations/GT_MetaTileEntity_Hatch_ControlCore.java b/src/main/java/gtPlusPlus/xmod/gregtech/api/metatileentity/implementations/GT_MetaTileEntity_Hatch_ControlCore.java index b2ea5a62ec..37037f7bbb 100644 --- a/src/main/java/gtPlusPlus/xmod/gregtech/api/metatileentity/implementations/GT_MetaTileEntity_Hatch_ControlCore.java +++ b/src/main/java/gtPlusPlus/xmod/gregtech/api/metatileentity/implementations/GT_MetaTileEntity_Hatch_ControlCore.java @@ -1,6 +1,9 @@ package gtPlusPlus.xmod.gregtech.api.metatileentity.implementations; +import com.gtnewhorizons.modularui.api.screen.ModularWindow; +import com.gtnewhorizons.modularui.api.screen.UIBuildContext; import gregtech.api.gui.*; +import gregtech.api.gui.modularui.GT_UIInfos; import gregtech.api.interfaces.ITexture; import gregtech.api.interfaces.tileentity.IGregTechTileEntity; import gregtech.api.metatileentity.MetaTileEntity; @@ -14,7 +17,6 @@ import gtPlusPlus.core.lib.CORE; import gtPlusPlus.xmod.gregtech.common.StaticFields59; import gtPlusPlus.xmod.gregtech.common.blocks.textures.TexturesGtBlock; import net.minecraft.entity.player.EntityPlayer; -import net.minecraft.entity.player.InventoryPlayer; import net.minecraft.item.ItemStack; import net.minecraft.tileentity.TileEntity; @@ -86,22 +88,11 @@ public class GT_MetaTileEntity_Hatch_ControlCore extends GT_MetaTileEntity_Hatch @Override public boolean onRightclick(IGregTechTileEntity aBaseMetaTileEntity, EntityPlayer aPlayer) { - if (aBaseMetaTileEntity.isClientSide()) return true; - aBaseMetaTileEntity.openGUI(aPlayer); + GT_UIInfos.openGTTileEntityUI(aBaseMetaTileEntity, aPlayer); return true; } @Override - public Object getServerGUI(int aID, InventoryPlayer aPlayerInventory, IGregTechTileEntity aBaseMetaTileEntity) { - return new GT_Container_1by1(aPlayerInventory, aBaseMetaTileEntity); - } - - @Override - public Object getClientGUI(int aID, InventoryPlayer aPlayerInventory, IGregTechTileEntity aBaseMetaTileEntity) { - return new GT_GUIContainer_1by1(aPlayerInventory, aBaseMetaTileEntity, "Control Core Module"); - } - - @Override public void onPostTick(IGregTechTileEntity aBaseMetaTileEntity, long aTimer) { if (aBaseMetaTileEntity.isServerSide() && aBaseMetaTileEntity.hasInventoryBeenModified()) { fillStacksIntoFirstSlots(); @@ -159,4 +150,14 @@ public class GT_MetaTileEntity_Hatch_ControlCore extends GT_MetaTileEntity_Hatch return true; } } + + @Override + public boolean useModularUI() { + return true; + } + + @Override + public void addUIWidgets(ModularWindow.Builder builder, UIBuildContext buildContext) { + getBaseMetaTileEntity().add1by1Slot(builder); + } } diff --git a/src/main/java/gtPlusPlus/xmod/gregtech/api/metatileentity/implementations/GT_MetaTileEntity_Hatch_ElementalDataOrbHolder.java b/src/main/java/gtPlusPlus/xmod/gregtech/api/metatileentity/implementations/GT_MetaTileEntity_Hatch_ElementalDataOrbHolder.java index 500f1945bc..c7aa7d5404 100644 --- a/src/main/java/gtPlusPlus/xmod/gregtech/api/metatileentity/implementations/GT_MetaTileEntity_Hatch_ElementalDataOrbHolder.java +++ b/src/main/java/gtPlusPlus/xmod/gregtech/api/metatileentity/implementations/GT_MetaTileEntity_Hatch_ElementalDataOrbHolder.java @@ -1,5 +1,12 @@ package gtPlusPlus.xmod.gregtech.api.metatileentity.implementations; +import com.gtnewhorizons.modularui.api.screen.ModularWindow; +import com.gtnewhorizons.modularui.api.screen.UIBuildContext; +import com.gtnewhorizons.modularui.common.widget.SlotGroup; +import com.gtnewhorizons.modularui.common.widget.SlotWidget; +import gregtech.api.enums.ItemList; +import gregtech.api.gui.modularui.GT_UIInfos; +import gregtech.api.gui.modularui.GT_UITextures; import gregtech.api.interfaces.ITexture; import gregtech.api.interfaces.tileentity.IGregTechTileEntity; import gregtech.api.metatileentity.MetaTileEntity; @@ -7,15 +14,15 @@ import gregtech.api.metatileentity.implementations.GT_MetaTileEntity_Hatch; import gregtech.api.objects.GT_RenderedTexture; import gregtech.api.util.GT_LanguageManager; import gregtech.api.util.GT_Recipe.GT_Recipe_Map; +import gregtech.api.util.GT_Utility; import gtPlusPlus.api.objects.Logger; +import gtPlusPlus.core.item.chemistry.AgriculturalChem; +import gtPlusPlus.core.item.chemistry.GenericChem; import gtPlusPlus.core.lib.CORE; import gtPlusPlus.core.util.minecraft.ItemUtils; -import gtPlusPlus.xmod.gregtech.api.gui.CONTAINER_DataHatch; -import gtPlusPlus.xmod.gregtech.api.gui.GUI_DataHatch; import gtPlusPlus.xmod.gregtech.common.blocks.textures.TexturesGtBlock; import java.util.ArrayList; import net.minecraft.entity.player.EntityPlayer; -import net.minecraft.entity.player.InventoryPlayer; import net.minecraft.item.ItemStack; import net.minecraft.nbt.NBTTagCompound; @@ -78,22 +85,11 @@ public class GT_MetaTileEntity_Hatch_ElementalDataOrbHolder extends GT_MetaTileE @Override public boolean onRightclick(IGregTechTileEntity aBaseMetaTileEntity, EntityPlayer aPlayer) { - if (aBaseMetaTileEntity.isClientSide()) return true; - aBaseMetaTileEntity.openGUI(aPlayer); + GT_UIInfos.openGTTileEntityUI(aBaseMetaTileEntity, aPlayer); return true; } @Override - public Object getServerGUI(int aID, InventoryPlayer aPlayerInventory, IGregTechTileEntity aBaseMetaTileEntity) { - return new CONTAINER_DataHatch(aPlayerInventory, aBaseMetaTileEntity); - } - - @Override - public Object getClientGUI(int aID, InventoryPlayer aPlayerInventory, IGregTechTileEntity aBaseMetaTileEntity) { - return new GUI_DataHatch(aPlayerInventory, aBaseMetaTileEntity, "Data Orb Repository"); - } - - @Override public void onPostTick(IGregTechTileEntity aBaseMetaTileEntity, long aTimer) { if (aBaseMetaTileEntity.isServerSide() && aBaseMetaTileEntity.hasInventoryBeenModified()) { fillStacksIntoFirstSlots(); @@ -181,4 +177,28 @@ public class GT_MetaTileEntity_Hatch_ElementalDataOrbHolder extends GT_MetaTileE } return false; } + + @Override + public boolean useModularUI() { + return true; + } + + @Override + public void addUIWidgets(ModularWindow.Builder builder, UIBuildContext buildContext) { + builder.widget(SlotGroup.ofItemHandler(inventoryHandler, 4) + .startFromSlot(0) + .endAtSlot(15) + .background(getGUITextureSet().getItemSlot(), GT_UITextures.OVERLAY_SLOT_DATA_ORB) + .applyForWidget( + widget -> widget.setFilter(stack -> ItemList.Tool_DataOrb.isStackEqual(stack, false, true))) + .build() + .setPos(52, 7)); + builder.widget(new SlotWidget(inventoryHandler, 16) + .setFilter(stack -> + stack.getItem() == GT_Utility.getIntegratedCircuit(0).getItem() + || stack.getItem() == AgriculturalChem.mBioCircuit + || stack.getItem() == GenericChem.mAdvancedCircuit) + .setBackground(getGUITextureSet().getItemSlot(), GT_UITextures.OVERLAY_SLOT_CIRCUIT) + .setPos(18, 34)); + } } diff --git a/src/main/java/gtPlusPlus/xmod/gregtech/api/metatileentity/implementations/GT_MetaTileEntity_Hatch_Energy_RTG.java b/src/main/java/gtPlusPlus/xmod/gregtech/api/metatileentity/implementations/GT_MetaTileEntity_Hatch_Energy_RTG.java index 726f7d09d9..7f291533a9 100644 --- a/src/main/java/gtPlusPlus/xmod/gregtech/api/metatileentity/implementations/GT_MetaTileEntity_Hatch_Energy_RTG.java +++ b/src/main/java/gtPlusPlus/xmod/gregtech/api/metatileentity/implementations/GT_MetaTileEntity_Hatch_Energy_RTG.java @@ -2,8 +2,9 @@ package gtPlusPlus.xmod.gregtech.api.metatileentity.implementations; import static gregtech.api.enums.GT_Values.V; -import gregtech.api.gui.GT_Container_3by3; -import gregtech.api.gui.GT_GUIContainer_3by3; +import com.gtnewhorizons.modularui.api.screen.ModularWindow; +import com.gtnewhorizons.modularui.api.screen.UIBuildContext; +import gregtech.api.gui.modularui.GT_UIInfos; import gregtech.api.interfaces.ITexture; import gregtech.api.interfaces.tileentity.IGregTechTileEntity; import gregtech.api.metatileentity.MetaTileEntity; @@ -15,7 +16,6 @@ import gtPlusPlus.core.util.minecraft.ItemUtils; import gtPlusPlus.xmod.gregtech.common.blocks.textures.TexturesGtBlock; import java.util.HashMap; import net.minecraft.entity.player.EntityPlayer; -import net.minecraft.entity.player.InventoryPlayer; import net.minecraft.item.Item; import net.minecraft.item.ItemStack; import net.minecraft.nbt.NBTTagCompound; @@ -126,21 +126,10 @@ public class GT_MetaTileEntity_Hatch_Energy_RTG extends GT_MetaTileEntity_Hatch_ @Override public boolean onRightclick(IGregTechTileEntity aBaseMetaTileEntity, EntityPlayer aPlayer) { - if (aBaseMetaTileEntity.isClientSide()) return true; - aBaseMetaTileEntity.openGUI(aPlayer); + GT_UIInfos.openGTTileEntityUI(aBaseMetaTileEntity, aPlayer); return true; } - @Override - public Object getServerGUI(int aID, InventoryPlayer aPlayerInventory, IGregTechTileEntity aBaseMetaTileEntity) { - return new GT_Container_3by3(aPlayerInventory, aBaseMetaTileEntity); - } - - @Override - public Object getClientGUI(int aID, InventoryPlayer aPlayerInventory, IGregTechTileEntity aBaseMetaTileEntity) { - return new GT_GUIContainer_3by3(aPlayerInventory, aBaseMetaTileEntity, "RTG Power Unit"); - } - private static class Dat { protected final String mUniqueDataTag; @@ -279,4 +268,14 @@ public class GT_MetaTileEntity_Hatch_Energy_RTG extends GT_MetaTileEntity_Hatch_ } return null; } + + @Override + public boolean useModularUI() { + return true; + } + + @Override + public void addUIWidgets(ModularWindow.Builder builder, UIBuildContext buildContext) { + getBaseMetaTileEntity().add3by3Slots(builder); + } } diff --git a/src/main/java/gtPlusPlus/xmod/gregtech/api/metatileentity/implementations/GT_MetaTileEntity_Hatch_InputBattery.java b/src/main/java/gtPlusPlus/xmod/gregtech/api/metatileentity/implementations/GT_MetaTileEntity_Hatch_InputBattery.java index d56a95d60f..03ba69a7cc 100644 --- a/src/main/java/gtPlusPlus/xmod/gregtech/api/metatileentity/implementations/GT_MetaTileEntity_Hatch_InputBattery.java +++ b/src/main/java/gtPlusPlus/xmod/gregtech/api/metatileentity/implementations/GT_MetaTileEntity_Hatch_InputBattery.java @@ -2,7 +2,10 @@ package gtPlusPlus.xmod.gregtech.api.metatileentity.implementations; import static gregtech.api.enums.GT_Values.V; +import com.gtnewhorizons.modularui.api.screen.ModularWindow; +import com.gtnewhorizons.modularui.api.screen.UIBuildContext; import gregtech.api.enums.GT_Values; +import gregtech.api.gui.modularui.GT_UIInfos; import gregtech.api.interfaces.ITexture; import gregtech.api.interfaces.tileentity.IGregTechTileEntity; import gregtech.api.metatileentity.MetaTileEntity; @@ -12,10 +15,9 @@ import gregtech.api.util.GT_ModHandler; import gregtech.api.util.GT_Recipe.GT_Recipe_Map; import gregtech.api.util.GT_Utility; import gtPlusPlus.core.lib.CORE; -import gtPlusPlus.xmod.gregtech.api.gui.hatches.charge.*; +import gtPlusPlus.xmod.gregtech.api.gui.widget.ElectricSlotWidget; import gtPlusPlus.xmod.gregtech.common.blocks.textures.TexturesGtBlock; import net.minecraft.entity.player.EntityPlayer; -import net.minecraft.entity.player.InventoryPlayer; import net.minecraft.item.ItemStack; public class GT_MetaTileEntity_Hatch_InputBattery extends GT_MetaTileEntity_Hatch { @@ -110,36 +112,11 @@ public class GT_MetaTileEntity_Hatch_InputBattery extends GT_MetaTileEntity_Hatc @Override public boolean onRightclick(IGregTechTileEntity aBaseMetaTileEntity, EntityPlayer aPlayer) { - if (aBaseMetaTileEntity.isClientSide()) return true; - aBaseMetaTileEntity.openGUI(aPlayer); + GT_UIInfos.openGTTileEntityUI(aBaseMetaTileEntity, aPlayer); return true; } @Override - public Object getServerGUI(int aID, InventoryPlayer aPlayerInventory, IGregTechTileEntity aBaseMetaTileEntity) { - switch (mTier) { - case 2: - return new CONTAINER_Electric_2by2(aPlayerInventory, aBaseMetaTileEntity); - case 4: - return new CONTAINER_Electric_4by4(aPlayerInventory, aBaseMetaTileEntity); - default: - return new CONTAINER_Electric_4by4(aPlayerInventory, aBaseMetaTileEntity); - } - } - - @Override - public Object getClientGUI(int aID, InventoryPlayer aPlayerInventory, IGregTechTileEntity aBaseMetaTileEntity) { - switch (mTier) { - case 2: - return new GUI_Electric_2by2(aPlayerInventory, aBaseMetaTileEntity, "Charging Bus"); - case 4: - return new GUI_Electric_4by4(aPlayerInventory, aBaseMetaTileEntity, "Charging Bus"); - default: - return new GUI_Electric_4by4(aPlayerInventory, aBaseMetaTileEntity, "Charging Bus"); - } - } - - @Override public void onPostTick(IGregTechTileEntity aBaseMetaTileEntity, long aTimer) { if (aBaseMetaTileEntity.isServerSide() && aBaseMetaTileEntity.hasInventoryBeenModified()) { fillStacksIntoFirstSlots(); @@ -239,4 +216,23 @@ public class GT_MetaTileEntity_Hatch_InputBattery extends GT_MetaTileEntity_Hatc public int dechargerSlotCount() { return 0; } + + @Override + public boolean useModularUI() { + return true; + } + + @Override + public void addUIWidgets(ModularWindow.Builder builder, UIBuildContext buildContext) { + if (mTier == 2) { + for (int i = 0; i < 4; i++) { + builder.widget( + new ElectricSlotWidget(inventoryHandler, i).setPos(70 + (i % 2) * 18, 25 + (i / 2) * 18)); + } + } else { + for (int i = 0; i < 16; i++) { + builder.widget(new ElectricSlotWidget(inventoryHandler, i).setPos(52 + (i % 4) * 18, 7 + (i / 4) * 18)); + } + } + } } diff --git a/src/main/java/gtPlusPlus/xmod/gregtech/api/metatileentity/implementations/GT_MetaTileEntity_Hatch_Muffler_Adv.java b/src/main/java/gtPlusPlus/xmod/gregtech/api/metatileentity/implementations/GT_MetaTileEntity_Hatch_Muffler_Adv.java index 94b927c80d..f62e0c27e0 100644 --- a/src/main/java/gtPlusPlus/xmod/gregtech/api/metatileentity/implementations/GT_MetaTileEntity_Hatch_Muffler_Adv.java +++ b/src/main/java/gtPlusPlus/xmod/gregtech/api/metatileentity/implementations/GT_MetaTileEntity_Hatch_Muffler_Adv.java @@ -1,7 +1,13 @@ package gtPlusPlus.xmod.gregtech.api.metatileentity.implementations; +import com.gtnewhorizons.modularui.api.screen.ModularWindow; +import com.gtnewhorizons.modularui.api.screen.UIBuildContext; +import com.gtnewhorizons.modularui.common.widget.SlotWidget; import gregtech.api.enums.GT_Values; +import gregtech.api.gui.modularui.GT_UIInfos; +import gregtech.api.gui.modularui.GUITextureSet; import gregtech.api.interfaces.ITexture; +import gregtech.api.interfaces.modularui.IAddGregtechLogo; import gregtech.api.interfaces.tileentity.IGregTechTileEntity; import gregtech.api.metatileentity.MetaTileEntity; import gregtech.api.metatileentity.implementations.GT_MetaTileEntity_Hatch_Muffler; @@ -11,18 +17,15 @@ import gtPlusPlus.api.objects.Logger; import gtPlusPlus.core.item.general.ItemAirFilter; import gtPlusPlus.core.lib.CORE; import gtPlusPlus.core.util.minecraft.gregtech.PollutionUtils; -import gtPlusPlus.core.util.reflect.ReflectionUtils; -import gtPlusPlus.xmod.gregtech.api.gui.CONTAINER_Hatch_Muffler_Advanced; -import gtPlusPlus.xmod.gregtech.api.gui.GUI_Hatch_Muffler_Advanced; +import gtPlusPlus.xmod.gregtech.api.gui.GTPP_UITextures; import gtPlusPlus.xmod.gregtech.common.StaticFields59; import gtPlusPlus.xmod.gregtech.common.blocks.textures.TexturesGtBlock; import net.minecraft.entity.player.EntityPlayer; -import net.minecraft.entity.player.InventoryPlayer; import net.minecraft.item.ItemStack; import net.minecraft.world.World; import net.minecraftforge.common.util.ForgeDirection; -public class GT_MetaTileEntity_Hatch_Muffler_Adv extends GT_MetaTileEntity_Hatch_Muffler { +public class GT_MetaTileEntity_Hatch_Muffler_Adv extends GT_MetaTileEntity_Hatch_Muffler implements IAddGregtechLogo { protected int SLOT_FILTER = 0; @@ -44,19 +47,12 @@ public class GT_MetaTileEntity_Hatch_Muffler_Adv extends GT_MetaTileEntity_Hatch private int mPollutionSmogLimit = 500000; public GT_MetaTileEntity_Hatch_Muffler_Adv(int aID, String aName, String aNameRegional, int aTier) { - super(aID, aName, aNameRegional, aTier); - ReflectionUtils.setField(this, "mInventory", new ItemStack[1]); - } - - public GT_MetaTileEntity_Hatch_Muffler_Adv(String aName, int aTier, String aDescription, ITexture[][][] aTextures) { - super(aName, aTier, aDescription, aTextures); - ReflectionUtils.setField(this, "mInventory", new ItemStack[1]); + super(aID, aName, aNameRegional, aTier, 1, new String[] {""}); } public GT_MetaTileEntity_Hatch_Muffler_Adv( String aName, int aTier, String[] aDescription, ITexture[][][] aTextures) { - super(aName, aTier, aDescription[0], aTextures); - ReflectionUtils.setField(this, "mInventory", new ItemStack[1]); + super(aName, aTier, 1, aDescription, aTextures); } public String[] getDescription() { @@ -98,20 +94,10 @@ public class GT_MetaTileEntity_Hatch_Muffler_Adv extends GT_MetaTileEntity_Hatch @Override public boolean onRightclick(IGregTechTileEntity aBaseMetaTileEntity, EntityPlayer aPlayer) { - if (aBaseMetaTileEntity.isClientSide()) return true; - aBaseMetaTileEntity.openGUI(aPlayer); + GT_UIInfos.openGTTileEntityUI(aBaseMetaTileEntity, aPlayer); return true; } - public Object getServerGUI(int aID, InventoryPlayer aPlayerInventory, IGregTechTileEntity aBaseMetaTileEntity) { - return new CONTAINER_Hatch_Muffler_Advanced(aPlayerInventory, aBaseMetaTileEntity); - } - - public Object getClientGUI(int aID, InventoryPlayer aPlayerInventory, IGregTechTileEntity aBaseMetaTileEntity) { - return new GUI_Hatch_Muffler_Advanced( - aPlayerInventory, aBaseMetaTileEntity, "Advanced Muffler", "machine_Charger.png"); - } - private boolean airCheck() { if (this.getBaseMetaTileEntity() .getAirAtSide(this.getBaseMetaTileEntity().getFrontFacing()) @@ -334,4 +320,31 @@ public class GT_MetaTileEntity_Hatch_Muffler_Adv extends GT_MetaTileEntity_Hatch (double) zSpd); } } + + @Override + public boolean useModularUI() { + return true; + } + + @Override + public void addGregTechLogo(ModularWindow.Builder builder) {} + + @Override + public GUITextureSet getGUITextureSet() { + return new GUITextureSet() + .setMainBackground(GTPP_UITextures.BACKGROUND_YELLOW) + .setItemSlot(GTPP_UITextures.SLOT_ITEM_YELLOW) + .setTitleTab( + GTPP_UITextures.TAB_TITLE_YELLOW, + GTPP_UITextures.TAB_TITLE_DARK_YELLOW, + GTPP_UITextures.TAB_TITLE_ANGULAR_YELLOW); + } + + @Override + public void addUIWidgets(ModularWindow.Builder builder, UIBuildContext buildContext) { + builder.widget(new SlotWidget(inventoryHandler, 0) + .setFilter(stack -> stack.getItem() instanceof ItemAirFilter) + .setBackground(getGUITextureSet().getItemSlot()) + .setPos(79, 34)); + } } diff --git a/src/main/java/gtPlusPlus/xmod/gregtech/api/metatileentity/implementations/GT_MetaTileEntity_Hatch_OutputBattery.java b/src/main/java/gtPlusPlus/xmod/gregtech/api/metatileentity/implementations/GT_MetaTileEntity_Hatch_OutputBattery.java index d6b0a570ac..101a310506 100644 --- a/src/main/java/gtPlusPlus/xmod/gregtech/api/metatileentity/implementations/GT_MetaTileEntity_Hatch_OutputBattery.java +++ b/src/main/java/gtPlusPlus/xmod/gregtech/api/metatileentity/implementations/GT_MetaTileEntity_Hatch_OutputBattery.java @@ -2,6 +2,9 @@ package gtPlusPlus.xmod.gregtech.api.metatileentity.implementations; import static gregtech.api.enums.GT_Values.V; +import com.gtnewhorizons.modularui.api.screen.ModularWindow; +import com.gtnewhorizons.modularui.api.screen.UIBuildContext; +import gregtech.api.gui.modularui.GT_UIInfos; import gregtech.api.interfaces.ITexture; import gregtech.api.interfaces.tileentity.IGregTechTileEntity; import gregtech.api.metatileentity.MetaTileEntity; @@ -10,10 +13,9 @@ import gregtech.api.objects.GT_RenderedTexture; import gregtech.api.util.GT_ModHandler; import gregtech.api.util.GT_Utility; import gtPlusPlus.core.lib.CORE; -import gtPlusPlus.xmod.gregtech.api.gui.hatches.charge.*; +import gtPlusPlus.xmod.gregtech.api.gui.widget.ElectricSlotWidget; import gtPlusPlus.xmod.gregtech.common.blocks.textures.TexturesGtBlock; import net.minecraft.entity.player.EntityPlayer; -import net.minecraft.entity.player.InventoryPlayer; import net.minecraft.item.ItemStack; public class GT_MetaTileEntity_Hatch_OutputBattery extends GT_MetaTileEntity_Hatch { @@ -101,36 +103,11 @@ public class GT_MetaTileEntity_Hatch_OutputBattery extends GT_MetaTileEntity_Hat @Override public boolean onRightclick(IGregTechTileEntity aBaseMetaTileEntity, EntityPlayer aPlayer) { - if (aBaseMetaTileEntity.isClientSide()) return true; - aBaseMetaTileEntity.openGUI(aPlayer); + GT_UIInfos.openGTTileEntityUI(aBaseMetaTileEntity, aPlayer); return true; } @Override - public Object getServerGUI(int aID, InventoryPlayer aPlayerInventory, IGregTechTileEntity aBaseMetaTileEntity) { - switch (mTier) { - case 2: - return new CONTAINER_Electric_2by2(aPlayerInventory, aBaseMetaTileEntity); - case 4: - return new CONTAINER_Electric_4by4(aPlayerInventory, aBaseMetaTileEntity); - default: - return new CONTAINER_Electric_4by4(aPlayerInventory, aBaseMetaTileEntity); - } - } - - @Override - public Object getClientGUI(int aID, InventoryPlayer aPlayerInventory, IGregTechTileEntity aBaseMetaTileEntity) { - switch (mTier) { - case 2: - return new GUI_Electric_2by2(aPlayerInventory, aBaseMetaTileEntity, "Discharging Bus"); - case 4: - return new GUI_Electric_4by4(aPlayerInventory, aBaseMetaTileEntity, "Discharging Bus"); - default: - return new GUI_Electric_4by4(aPlayerInventory, aBaseMetaTileEntity, "Discharging Bus"); - } - } - - @Override public boolean allowPullStack(IGregTechTileEntity aBaseMetaTileEntity, int aIndex, byte aSide, ItemStack aStack) { return aSide == aBaseMetaTileEntity.getFrontFacing(); } @@ -220,4 +197,23 @@ public class GT_MetaTileEntity_Hatch_OutputBattery extends GT_MetaTileEntity_Hat } super.onPostTick(aBaseMetaTileEntity, aTimer); } + + @Override + public boolean useModularUI() { + return true; + } + + @Override + public void addUIWidgets(ModularWindow.Builder builder, UIBuildContext buildContext) { + if (mTier == 2) { + for (int i = 0; i < 4; i++) { + builder.widget( + new ElectricSlotWidget(inventoryHandler, i).setPos(70 + (i % 2) * 18, 25 + (i / 2) * 18)); + } + } else { + for (int i = 0; i < 16; i++) { + builder.widget(new ElectricSlotWidget(inventoryHandler, i).setPos(52 + (i % 4) * 18, 7 + (i / 4) * 18)); + } + } + } } diff --git a/src/main/java/gtPlusPlus/xmod/gregtech/api/metatileentity/implementations/GT_MetaTileEntity_Hatch_Steam_BusInput.java b/src/main/java/gtPlusPlus/xmod/gregtech/api/metatileentity/implementations/GT_MetaTileEntity_Hatch_Steam_BusInput.java index d50d55b721..4be947d68e 100644 --- a/src/main/java/gtPlusPlus/xmod/gregtech/api/metatileentity/implementations/GT_MetaTileEntity_Hatch_Steam_BusInput.java +++ b/src/main/java/gtPlusPlus/xmod/gregtech/api/metatileentity/implementations/GT_MetaTileEntity_Hatch_Steam_BusInput.java @@ -3,10 +3,11 @@ package gtPlusPlus.xmod.gregtech.api.metatileentity.implementations; import static gregtech.api.enums.Textures.BlockIcons.ITEM_IN_SIGN; import static gregtech.api.enums.Textures.BlockIcons.OVERLAY_PIPE_IN; +import com.gtnewhorizons.modularui.api.screen.ModularWindow; +import com.gtnewhorizons.modularui.api.screen.UIBuildContext; import gregtech.GT_Mod; import gregtech.api.enums.Textures; -import gregtech.api.gui.GT_Container_2by2; -import gregtech.api.gui.GT_GUIContainer_2by2; +import gregtech.api.gui.modularui.GT_UIInfos; import gregtech.api.interfaces.ITexture; import gregtech.api.interfaces.tileentity.IGregTechTileEntity; import gregtech.api.metatileentity.MetaTileEntity; @@ -18,7 +19,6 @@ import gregtech.api.util.GT_Recipe.GT_Recipe_Map; import gregtech.api.util.GT_Utility; import gtPlusPlus.core.lib.CORE; import net.minecraft.entity.player.EntityPlayer; -import net.minecraft.entity.player.InventoryPlayer; import net.minecraft.item.ItemStack; import net.minecraft.nbt.NBTTagCompound; @@ -87,22 +87,11 @@ public class GT_MetaTileEntity_Hatch_Steam_BusInput extends GT_MetaTileEntity_Ha @Override public boolean onRightclick(IGregTechTileEntity aBaseMetaTileEntity, EntityPlayer aPlayer) { - if (aBaseMetaTileEntity.isClientSide()) return true; - aBaseMetaTileEntity.openGUI(aPlayer); + GT_UIInfos.openGTTileEntityUI(aBaseMetaTileEntity, aPlayer); return true; } @Override - public Object getServerGUI(int aID, InventoryPlayer aPlayerInventory, IGregTechTileEntity aBaseMetaTileEntity) { - return new GT_Container_2by2(aPlayerInventory, aBaseMetaTileEntity); - } - - @Override - public Object getClientGUI(int aID, InventoryPlayer aPlayerInventory, IGregTechTileEntity aBaseMetaTileEntity) { - return new GT_GUIContainer_2by2(aPlayerInventory, aBaseMetaTileEntity, "Steam Input Bus"); - } - - @Override public void onPostTick(IGregTechTileEntity aBaseMetaTileEntity, long aTimer) { if (aBaseMetaTileEntity.isServerSide() && aBaseMetaTileEntity.hasInventoryBeenModified()) { fillStacksIntoFirstSlots(); @@ -319,4 +308,14 @@ public class GT_MetaTileEntity_Hatch_Steam_BusInput extends GT_MetaTileEntity_Ha new GT_RenderedTexture(Textures.BlockIcons.OVERLAY_PIPE_OUT) }; } + + @Override + public boolean useModularUI() { + return true; + } + + @Override + public void addUIWidgets(ModularWindow.Builder builder, UIBuildContext buildContext) { + getBaseMetaTileEntity().add2by2Slots(builder); + } } diff --git a/src/main/java/gtPlusPlus/xmod/gregtech/api/metatileentity/implementations/GT_MetaTileEntity_Hatch_Steam_BusOutput.java b/src/main/java/gtPlusPlus/xmod/gregtech/api/metatileentity/implementations/GT_MetaTileEntity_Hatch_Steam_BusOutput.java index ab721cd605..a6bfd65636 100644 --- a/src/main/java/gtPlusPlus/xmod/gregtech/api/metatileentity/implementations/GT_MetaTileEntity_Hatch_Steam_BusOutput.java +++ b/src/main/java/gtPlusPlus/xmod/gregtech/api/metatileentity/implementations/GT_MetaTileEntity_Hatch_Steam_BusOutput.java @@ -3,10 +3,11 @@ package gtPlusPlus.xmod.gregtech.api.metatileentity.implementations; import static gregtech.api.enums.Textures.BlockIcons.ITEM_OUT_SIGN; import static gregtech.api.enums.Textures.BlockIcons.OVERLAY_PIPE_OUT; +import com.gtnewhorizons.modularui.api.screen.ModularWindow; +import com.gtnewhorizons.modularui.api.screen.UIBuildContext; import gregtech.GT_Mod; import gregtech.api.enums.Textures; -import gregtech.api.gui.GT_Container_2by2; -import gregtech.api.gui.GT_GUIContainer_2by2; +import gregtech.api.gui.modularui.GT_UIInfos; import gregtech.api.interfaces.ITexture; import gregtech.api.interfaces.tileentity.IGregTechTileEntity; import gregtech.api.metatileentity.MetaTileEntity; @@ -15,7 +16,6 @@ import gregtech.api.objects.GT_RenderedTexture; import gregtech.api.render.TextureFactory; import gtPlusPlus.core.lib.CORE; import net.minecraft.entity.player.EntityPlayer; -import net.minecraft.entity.player.InventoryPlayer; import net.minecraft.item.ItemStack; public class GT_MetaTileEntity_Hatch_Steam_BusOutput extends GT_MetaTileEntity_Hatch { @@ -79,22 +79,11 @@ public class GT_MetaTileEntity_Hatch_Steam_BusOutput extends GT_MetaTileEntity_H @Override public boolean onRightclick(IGregTechTileEntity aBaseMetaTileEntity, EntityPlayer aPlayer) { - if (aBaseMetaTileEntity.isClientSide()) return true; - aBaseMetaTileEntity.openGUI(aPlayer); + GT_UIInfos.openGTTileEntityUI(aBaseMetaTileEntity, aPlayer); return true; } @Override - public Object getServerGUI(int aID, InventoryPlayer aPlayerInventory, IGregTechTileEntity aBaseMetaTileEntity) { - return new GT_Container_2by2(aPlayerInventory, aBaseMetaTileEntity); - } - - @Override - public Object getClientGUI(int aID, InventoryPlayer aPlayerInventory, IGregTechTileEntity aBaseMetaTileEntity) { - return new GT_GUIContainer_2by2(aPlayerInventory, aBaseMetaTileEntity, "Steam Output Bus"); - } - - @Override public boolean allowPullStack(IGregTechTileEntity aBaseMetaTileEntity, int aIndex, byte aSide, ItemStack aStack) { return aSide == aBaseMetaTileEntity.getFrontFacing(); } @@ -249,4 +238,14 @@ public class GT_MetaTileEntity_Hatch_Steam_BusOutput extends GT_MetaTileEntity_H new GT_RenderedTexture(Textures.BlockIcons.OVERLAY_PIPE_OUT) }; } + + @Override + public boolean useModularUI() { + return true; + } + + @Override + public void addUIWidgets(ModularWindow.Builder builder, UIBuildContext buildContext) { + getBaseMetaTileEntity().add2by2Slots(builder); + } } diff --git a/src/main/java/gtPlusPlus/xmod/gregtech/api/metatileentity/implementations/GT_MetaTileEntity_Hatch_Turbine.java b/src/main/java/gtPlusPlus/xmod/gregtech/api/metatileentity/implementations/GT_MetaTileEntity_Hatch_Turbine.java index 572d9184b3..29868f4617 100644 --- a/src/main/java/gtPlusPlus/xmod/gregtech/api/metatileentity/implementations/GT_MetaTileEntity_Hatch_Turbine.java +++ b/src/main/java/gtPlusPlus/xmod/gregtech/api/metatileentity/implementations/GT_MetaTileEntity_Hatch_Turbine.java @@ -3,8 +3,12 @@ package gtPlusPlus.xmod.gregtech.api.metatileentity.implementations; import static gregtech.api.enums.Textures.BlockIcons.LARGETURBINE_ST5; import static gregtech.api.enums.Textures.BlockIcons.LARGETURBINE_ST_ACTIVE5; +import com.gtnewhorizons.modularui.api.screen.ModularWindow; +import com.gtnewhorizons.modularui.api.screen.UIBuildContext; +import com.gtnewhorizons.modularui.common.widget.SlotWidget; import gregtech.api.GregTech_API; import gregtech.api.enums.Materials; +import gregtech.api.gui.modularui.GT_UIInfos; import gregtech.api.interfaces.ITexture; import gregtech.api.interfaces.tileentity.IGregTechTileEntity; import gregtech.api.items.GT_MetaGenerated_Tool; @@ -20,12 +24,9 @@ import gtPlusPlus.core.lib.CORE; import gtPlusPlus.core.util.Utils; import gtPlusPlus.core.util.math.MathUtils; import gtPlusPlus.core.util.minecraft.PlayerUtils; -import gtPlusPlus.xmod.gregtech.api.gui.hatches.CONTAINER_1by1_Turbine; -import gtPlusPlus.xmod.gregtech.api.gui.hatches.GUI_1by1_Turbine; import gtPlusPlus.xmod.gregtech.common.StaticFields59; import gtPlusPlus.xmod.gregtech.common.tileentities.machines.multi.production.turbines.GregtechMetaTileEntity_LargerTurbineBase; import net.minecraft.entity.player.EntityPlayer; -import net.minecraft.entity.player.InventoryPlayer; import net.minecraft.item.ItemStack; import net.minecraft.nbt.NBTTagCompound; @@ -132,25 +133,11 @@ public class GT_MetaTileEntity_Hatch_Turbine extends GT_MetaTileEntity_Hatch { @Override public boolean onRightclick(IGregTechTileEntity aBaseMetaTileEntity, EntityPlayer aPlayer) { - if (aBaseMetaTileEntity.isClientSide()) { - return true; - } else { - aBaseMetaTileEntity.openGUI(aPlayer); - } + GT_UIInfos.openGTTileEntityUI(aBaseMetaTileEntity, aPlayer); return true; } @Override - public Object getServerGUI(int aID, InventoryPlayer aPlayerInventory, IGregTechTileEntity aBaseMetaTileEntity) { - return new CONTAINER_1by1_Turbine(aPlayerInventory, aBaseMetaTileEntity); - } - - @Override - public Object getClientGUI(int aID, InventoryPlayer aPlayerInventory, IGregTechTileEntity aBaseMetaTileEntity) { - return new GUI_1by1_Turbine(aPlayerInventory, aBaseMetaTileEntity, "Turbine Rotor Hatch"); - } - - @Override public boolean allowPullStack(IGregTechTileEntity aBaseMetaTileEntity, int aIndex, byte aSide, ItemStack aStack) { return false; } @@ -417,4 +404,17 @@ public class GT_MetaTileEntity_Hatch_Turbine extends GT_MetaTileEntity_Hatch { } return false; } + + @Override + public boolean useModularUI() { + return true; + } + + @Override + public void addUIWidgets(ModularWindow.Builder builder, UIBuildContext buildContext) { + builder.widget(new SlotWidget(inventoryHandler, 0) + .setFilter(GregtechMetaTileEntity_LargerTurbineBase::isValidTurbine) + .setAccess(false, true) + .setPos(79, 34)); + } } diff --git a/src/main/java/gtPlusPlus/xmod/gregtech/api/metatileentity/implementations/GT_MetaTileEntity_Hatch_TurbineProvider.java b/src/main/java/gtPlusPlus/xmod/gregtech/api/metatileentity/implementations/GT_MetaTileEntity_Hatch_TurbineProvider.java index 85b921b1ed..63937d42ce 100644 --- a/src/main/java/gtPlusPlus/xmod/gregtech/api/metatileentity/implementations/GT_MetaTileEntity_Hatch_TurbineProvider.java +++ b/src/main/java/gtPlusPlus/xmod/gregtech/api/metatileentity/implementations/GT_MetaTileEntity_Hatch_TurbineProvider.java @@ -1,5 +1,8 @@ package gtPlusPlus.xmod.gregtech.api.metatileentity.implementations; +import com.gtnewhorizons.modularui.api.screen.ModularWindow; +import com.gtnewhorizons.modularui.api.screen.UIBuildContext; +import com.gtnewhorizons.modularui.common.widget.SlotWidget; import gregtech.api.interfaces.ITexture; import gregtech.api.interfaces.metatileentity.IMetaTileEntity; import gregtech.api.interfaces.tileentity.IGregTechTileEntity; @@ -12,10 +15,8 @@ import gtPlusPlus.core.lib.CORE; import gtPlusPlus.core.util.Utils; import gtPlusPlus.core.util.minecraft.PlayerUtils; import gtPlusPlus.core.util.sys.KeyboardUtils; -import gtPlusPlus.xmod.gregtech.api.gui.hatches.CONTAINER_1by1_Turbine; -import gtPlusPlus.xmod.gregtech.api.gui.hatches.GUI_1by1_Turbine; +import gtPlusPlus.xmod.gregtech.common.tileentities.machines.multi.production.turbines.GregtechMetaTileEntity_LargerTurbineBase; import net.minecraft.entity.player.EntityPlayer; -import net.minecraft.entity.player.InventoryPlayer; import net.minecraft.item.ItemStack; import net.minecraft.nbt.NBTTagCompound; import net.minecraft.world.World; @@ -41,14 +42,6 @@ public class GT_MetaTileEntity_Hatch_TurbineProvider extends GT_MetaTileEntity_H return new GT_MetaTileEntity_Hatch_TurbineProvider(this.mName, this.mTier, this.mDescription, this.mTextures); } - public Object getServerGUI(int aID, InventoryPlayer aPlayerInventory, IGregTechTileEntity aBaseMetaTileEntity) { - return new CONTAINER_1by1_Turbine(aPlayerInventory, aBaseMetaTileEntity); - } - - public Object getClientGUI(int aID, InventoryPlayer aPlayerInventory, IGregTechTileEntity aBaseMetaTileEntity) { - return new GUI_1by1_Turbine(aPlayerInventory, aBaseMetaTileEntity, "Turbine Housing"); - } - @Override public String[] getDescription() { return new String[] { @@ -213,4 +206,17 @@ public class GT_MetaTileEntity_Hatch_TurbineProvider extends GT_MetaTileEntity_H super.onLeftclick(aBaseMetaTileEntity, aPlayer); } } + + @Override + public boolean allowSelectCircuit() { + return false; + } + + @Override + public void addUIWidgets(ModularWindow.Builder builder, UIBuildContext buildContext) { + builder.widget(new SlotWidget(inventoryHandler, 0) + .setFilter(GregtechMetaTileEntity_LargerTurbineBase::isValidTurbine) + .setAccess(false, true) + .setPos(79, 34)); + } } diff --git a/src/main/java/gtPlusPlus/xmod/gregtech/api/metatileentity/implementations/GT_MetaTileEntity_SuperBus_Input.java b/src/main/java/gtPlusPlus/xmod/gregtech/api/metatileentity/implementations/GT_MetaTileEntity_SuperBus_Input.java index 345af422f7..b8cdd775d5 100644 --- a/src/main/java/gtPlusPlus/xmod/gregtech/api/metatileentity/implementations/GT_MetaTileEntity_SuperBus_Input.java +++ b/src/main/java/gtPlusPlus/xmod/gregtech/api/metatileentity/implementations/GT_MetaTileEntity_SuperBus_Input.java @@ -1,9 +1,9 @@ package gtPlusPlus.xmod.gregtech.api.metatileentity.implementations; +import com.gtnewhorizons.modularui.api.UIInfos; import cpw.mods.fml.relauncher.Side; import cpw.mods.fml.relauncher.SideOnly; import gregtech.api.enums.GT_Values; -import gregtech.api.gui.GT_GUIDialogSelectItem; import gregtech.api.interfaces.ITexture; import gregtech.api.interfaces.tileentity.IGregTechTileEntity; import gregtech.api.metatileentity.MetaTileEntity; @@ -11,13 +11,12 @@ import gregtech.api.metatileentity.implementations.GT_MetaTileEntity_Hatch_Input import gregtech.api.net.GT_Packet_SetConfigurationCircuit; import gregtech.api.util.GT_Utility; import gregtech.api.util.extensions.ArrayExt; +import gregtech.common.gui.modularui.uifactory.SelectItemUIFactory; import gtPlusPlus.core.lib.CORE; import gtPlusPlus.core.util.minecraft.ItemUtils; import gtPlusPlus.core.util.minecraft.PlayerUtils; import java.util.List; -import net.minecraft.client.Minecraft; import net.minecraft.entity.player.EntityPlayer; -import net.minecraft.entity.player.InventoryPlayer; import net.minecraft.item.ItemStack; import net.minecraft.util.StatCollector; @@ -46,16 +45,6 @@ public class GT_MetaTileEntity_SuperBus_Input extends GT_MetaTileEntity_Hatch_In } @Override - public Object getServerGUI(int aID, InventoryPlayer aPlayerInventory, IGregTechTileEntity aBaseMetaTileEntity) { - return null; - } - - @Override - public Object getClientGUI(int aID, InventoryPlayer aPlayerInventory, IGregTechTileEntity aBaseMetaTileEntity) { - return null; - } - - @Override public String[] getDescription() { return new String[] { "Item Input for Multiblocks", @@ -68,20 +57,21 @@ public class GT_MetaTileEntity_SuperBus_Input extends GT_MetaTileEntity_Hatch_In @Override public void onLeftclick(IGregTechTileEntity aBaseMetaTileEntity, EntityPlayer aPlayer) { - if (aBaseMetaTileEntity.isClientSide() && aPlayer.getCurrentEquippedItem() == null) openCircuitSelector(); + if (aBaseMetaTileEntity.isClientSide() && aPlayer.getCurrentEquippedItem() == null) { + openCircuitSelector(aPlayer); + } } @SideOnly(Side.CLIENT) - private void openCircuitSelector() { + private void openCircuitSelector(EntityPlayer player) { List<ItemStack> circuits = getConfigurationCircuits(); - Minecraft.getMinecraft() - .displayGuiScreen(new GT_GUIDialogSelectItem( + UIInfos.openClientUI(player, buildContext -> new SelectItemUIFactory( StatCollector.translateToLocal("GT5U.machines.select_circuit"), getStackForm(0), - null, this::onCircuitSelected, circuits, - GT_Utility.findMatchingStackInList(circuits, getStackInSlot(getCircuitSlot())))); + GT_Utility.findMatchingStackInList(circuits, getStackInSlot(getCircuitSlot()))) + .createWindow(buildContext)); } @SideOnly(Side.CLIENT) diff --git a/src/main/java/gtPlusPlus/xmod/gregtech/api/metatileentity/implementations/GT_MetaTileEntity_SuperBus_Output.java b/src/main/java/gtPlusPlus/xmod/gregtech/api/metatileentity/implementations/GT_MetaTileEntity_SuperBus_Output.java index 7fecabd5d7..544c4b9308 100644 --- a/src/main/java/gtPlusPlus/xmod/gregtech/api/metatileentity/implementations/GT_MetaTileEntity_SuperBus_Output.java +++ b/src/main/java/gtPlusPlus/xmod/gregtech/api/metatileentity/implementations/GT_MetaTileEntity_SuperBus_Output.java @@ -10,7 +10,6 @@ import gtPlusPlus.core.lib.CORE; import gtPlusPlus.core.util.minecraft.ItemUtils; import gtPlusPlus.core.util.minecraft.PlayerUtils; import net.minecraft.entity.player.EntityPlayer; -import net.minecraft.entity.player.InventoryPlayer; import net.minecraft.inventory.IInventory; import net.minecraft.item.ItemStack; import net.minecraft.nbt.NBTTagCompound; @@ -44,14 +43,6 @@ public class GT_MetaTileEntity_SuperBus_Output extends GT_MetaTileEntity_Hatch_O this.mName, this.mTier, ArrayExt.of(this.mDescription), this.mTextures); } - public Object getServerGUI(int aID, InventoryPlayer aPlayerInventory, IGregTechTileEntity aBaseMetaTileEntity) { - return null; - } - - public Object getClientGUI(int aID, InventoryPlayer aPlayerInventory, IGregTechTileEntity aBaseMetaTileEntity) { - return null; - } - public void onPostTick(IGregTechTileEntity aBaseMetaTileEntity, long aTimer) { if (aBaseMetaTileEntity.isServerSide() && aBaseMetaTileEntity.hasInventoryBeenModified()) { this.fillStacksIntoFirstSlots(); @@ -106,12 +97,6 @@ public class GT_MetaTileEntity_SuperBus_Output extends GT_MetaTileEntity_Hatch_O return aDesc; } - @Override - public boolean onRightclick( - IGregTechTileEntity aBaseMetaTileEntity, EntityPlayer aPlayer, byte aSide, float aX, float aY, float aZ) { - return super.onRightclick(aBaseMetaTileEntity, aPlayer, aSide, aX, aY, aZ); - } - public boolean onRightclick(IGregTechTileEntity aBaseMetaTileEntity, EntityPlayer aPlayer) { if (aBaseMetaTileEntity.isClientSide()) { return true; diff --git a/src/main/java/gtPlusPlus/xmod/gregtech/api/metatileentity/implementations/base/CustomMetaTileBase.java b/src/main/java/gtPlusPlus/xmod/gregtech/api/metatileentity/implementations/base/CustomMetaTileBase.java index cd4d0c0edd..89bbe99771 100644 --- a/src/main/java/gtPlusPlus/xmod/gregtech/api/metatileentity/implementations/base/CustomMetaTileBase.java +++ b/src/main/java/gtPlusPlus/xmod/gregtech/api/metatileentity/implementations/base/CustomMetaTileBase.java @@ -39,7 +39,9 @@ public abstract class CustomMetaTileBase extends MetaTileEntity { @Override public void setBaseMetaTileEntity(IGregTechTileEntity aBaseMetaTileEntity) { super.setBaseMetaTileEntity(aBaseMetaTileEntity); - if (mBaseCustomMetaTileEntity != null && aBaseMetaTileEntity == null) { + if (mBaseCustomMetaTileEntity != null + && aBaseMetaTileEntity == null + && mBaseCustomMetaTileEntity.getMetaTileEntity() != null) { mBaseCustomMetaTileEntity.getMetaTileEntity().inValidate(); mBaseCustomMetaTileEntity.setMetaTileEntity(null); } diff --git a/src/main/java/gtPlusPlus/xmod/gregtech/api/metatileentity/implementations/base/GT_MetaTileEntity_Hatch_CustomFluidBase.java b/src/main/java/gtPlusPlus/xmod/gregtech/api/metatileentity/implementations/base/GT_MetaTileEntity_Hatch_CustomFluidBase.java index f00901c45b..48c8bfba81 100644 --- a/src/main/java/gtPlusPlus/xmod/gregtech/api/metatileentity/implementations/base/GT_MetaTileEntity_Hatch_CustomFluidBase.java +++ b/src/main/java/gtPlusPlus/xmod/gregtech/api/metatileentity/implementations/base/GT_MetaTileEntity_Hatch_CustomFluidBase.java @@ -4,6 +4,7 @@ import static gregtech.api.enums.Textures.BlockIcons.FLUID_IN_SIGN; import static gregtech.api.enums.Textures.BlockIcons.OVERLAY_PIPE_IN; import gregtech.GT_Mod; +import gregtech.api.gui.modularui.GT_UIInfos; import gregtech.api.interfaces.ITexture; import gregtech.api.interfaces.tileentity.IGregTechTileEntity; import gregtech.api.metatileentity.MetaTileEntity; @@ -97,8 +98,7 @@ public class GT_MetaTileEntity_Hatch_CustomFluidBase extends GT_MetaTileEntity_H @Override public boolean onRightclick(IGregTechTileEntity aBaseMetaTileEntity, EntityPlayer aPlayer) { - if (aBaseMetaTileEntity.isClientSide()) return true; - aBaseMetaTileEntity.openGUI(aPlayer); + GT_UIInfos.openGTTileEntityUI(aBaseMetaTileEntity, aPlayer); return true; } @@ -196,4 +196,9 @@ public class GT_MetaTileEntity_Hatch_CustomFluidBase extends GT_MetaTileEntity_H return new GT_MetaTileEntity_Hatch_CustomFluidBase( this.mLockedFluid, this.mFluidCapacity, this.mName, this.mDescription, this.mTextures); } + + @Override + public boolean useModularUI() { + return true; + } } diff --git a/src/main/java/gtPlusPlus/xmod/gregtech/api/metatileentity/implementations/base/GregtechMeta_MultiBlockBase.java b/src/main/java/gtPlusPlus/xmod/gregtech/api/metatileentity/implementations/base/GregtechMeta_MultiBlockBase.java index 41045d8a5b..58b76cc407 100644 --- a/src/main/java/gtPlusPlus/xmod/gregtech/api/metatileentity/implementations/base/GregtechMeta_MultiBlockBase.java +++ b/src/main/java/gtPlusPlus/xmod/gregtech/api/metatileentity/implementations/base/GregtechMeta_MultiBlockBase.java @@ -7,12 +7,18 @@ import com.gtnewhorizon.structurelib.StructureLibAPI; import com.gtnewhorizon.structurelib.structure.AutoPlaceEnvironment; import com.gtnewhorizon.structurelib.structure.IStructureElement; import com.gtnewhorizon.structurelib.structure.StructureUtility; +import com.gtnewhorizons.modularui.api.drawable.ItemDrawable; +import com.gtnewhorizons.modularui.api.screen.ModularWindow; +import com.gtnewhorizons.modularui.api.screen.UIBuildContext; +import com.gtnewhorizons.modularui.common.widget.DrawableWidget; +import com.gtnewhorizons.modularui.common.widget.DynamicPositionedColumn; +import com.gtnewhorizons.modularui.common.widget.FakeSyncWidget; +import com.gtnewhorizons.modularui.common.widget.TextWidget; import gregtech.api.GregTech_API; import gregtech.api.enums.GT_Values; import gregtech.api.enums.Materials; import gregtech.api.enums.Textures; -import gregtech.api.gui.GT_Container_MultiMachine; -import gregtech.api.gui.GT_GUIContainer_MultiMachine; +import gregtech.api.gui.modularui.GT_UITextures; import gregtech.api.interfaces.IHatchElement; import gregtech.api.interfaces.IIconContainer; import gregtech.api.interfaces.ITexture; @@ -30,6 +36,7 @@ import gregtech.api.util.GT_Recipe; import gregtech.api.util.GT_Recipe.GT_Recipe_Map; import gregtech.api.util.GT_Utility; import gregtech.api.util.IGT_HatchAdder; +import gregtech.common.items.GT_MetaGenerated_Tool_01; import gtPlusPlus.GTplusplus; import gtPlusPlus.GTplusplus.INIT_PHASE; import gtPlusPlus.api.helpers.GregtechPlusPlus_API.Multiblock_API; @@ -46,12 +53,12 @@ import gtPlusPlus.core.util.minecraft.PlayerUtils; import gtPlusPlus.core.util.reflect.ReflectionUtils; import gtPlusPlus.preloader.CORE_Preloader; import gtPlusPlus.preloader.asm.AsmConfig; -import gtPlusPlus.xmod.gregtech.api.gui.*; import gtPlusPlus.xmod.gregtech.api.metatileentity.implementations.*; import java.lang.reflect.InvocationTargetException; import java.lang.reflect.Method; import java.util.*; import java.util.Map.Entry; +import java.util.concurrent.ConcurrentHashMap; import java.util.concurrent.TimeUnit; import java.util.function.BiConsumer; import java.util.function.BiPredicate; @@ -60,7 +67,6 @@ import java.util.stream.Collectors; import javax.annotation.Nullable; import net.minecraft.block.Block; import net.minecraft.entity.player.EntityPlayer; -import net.minecraft.entity.player.InventoryPlayer; import net.minecraft.inventory.IInventory; import net.minecraft.item.Item; import net.minecraft.item.ItemStack; @@ -159,58 +165,10 @@ public abstract class GregtechMeta_MultiBlockBase<T extends GT_MetaTileEntity_En return (tStackSize + tMaxStackSize - 1) / tMaxStackSize; } - public abstract boolean hasSlotInGUI(); - public long getTotalRuntimeInTicks() { return this.mTotalRunTime; } - @Override - public Object getServerGUI( - final int aID, final InventoryPlayer aPlayerInventory, final IGregTechTileEntity aBaseMetaTileEntity) { - if (hasSlotInGUI()) { - return new GT_Container_MultiMachine(aPlayerInventory, aBaseMetaTileEntity); - } else { - String aCustomGUI = getCustomGUIResourceName(); - if (aCustomGUI == null) { - return new CONTAINER_MultiMachine_NoPlayerInventory(aPlayerInventory, aBaseMetaTileEntity); - } else { - return new CONTAINER_MultiMachine(aPlayerInventory, aBaseMetaTileEntity); - } - } - } - - public abstract String getCustomGUIResourceName(); - - public boolean requiresVanillaGtGUI() { - return false; - } - - @Override - public Object getClientGUI( - final int aID, final InventoryPlayer aPlayerInventory, final IGregTechTileEntity aBaseMetaTileEntity) { - String aCustomGUI = getCustomGUIResourceName(); - aCustomGUI = - aCustomGUI != null ? aCustomGUI : hasSlotInGUI() ? "MultiblockDisplay" : "MultiblockDisplay_Generic"; - aCustomGUI = aCustomGUI + ".png"; - if (hasSlotInGUI()) { - if (!requiresVanillaGtGUI()) { - return new GUI_Multi_Basic_Slotted( - aPlayerInventory, aBaseMetaTileEntity, this.getLocalName(), aCustomGUI); - } else { - return new GT_GUIContainer_MultiMachine( - aPlayerInventory, aBaseMetaTileEntity, this.getLocalName(), aCustomGUI); - } - } else { - if (getCustomGUIResourceName() == null && !hasSlotInGUI()) { - return new GUI_MultiMachine(aPlayerInventory, aBaseMetaTileEntity, this.getLocalName(), aCustomGUI); - } else { - return new GUI_MultiMachine_Default( - aPlayerInventory, aBaseMetaTileEntity, this.getLocalName(), aCustomGUI); - } - } - } - public abstract String getMachineType(); public String getMachineTooltip() { @@ -220,7 +178,6 @@ public abstract class GregtechMeta_MultiBlockBase<T extends GT_MetaTileEntity_En public String[] getExtraInfoData() { return new String[0]; } - ; @Override public final String[] getInfoData() { @@ -2756,6 +2713,289 @@ public abstract class GregtechMeta_MultiBlockBase<T extends GT_MetaTileEntity_En return 0; } + @Override + public void addUIWidgets(ModularWindow.Builder builder, UIBuildContext buildContext) { + if (doesBindPlayerInventory()) { + super.addUIWidgets(builder, buildContext); + } else { + addNoPlayerInventoryUI(builder, buildContext); + } + } + + private static final Materials GOOD = Materials.Uranium; + private static final Materials BAD = Materials.Plutonium; + private static final ConcurrentHashMap<String, ItemStack> mToolStacks = new ConcurrentHashMap<>(); + + protected void addNoPlayerInventoryUI(ModularWindow.Builder builder, UIBuildContext buildContext) { + builder.widget(new DrawableWidget() + .setDrawable(GT_UITextures.PICTURE_SCREEN_BLACK) + .setPos(3, 4) + .setSize(152, 159)); + for (int i = 0; i < 9; i++) { + builder.widget(new DrawableWidget() + .setDrawable(GT_UITextures.BUTTON_STANDARD) + .setPos(155, 3 + i * 18) + .setSize(18, 18)); + } + + DynamicPositionedColumn screenElements = new DynamicPositionedColumn(); + drawTextsNoPlayerInventory(screenElements); + builder.widget(screenElements); + + setupToolDisplay(); + + builder.widget(new ItemDrawable(() -> mToolStacks.get(mWrench + "WRENCH")) + .asWidget() + .setPos(156, 58)) + .widget(new FakeSyncWidget.BooleanSyncer(() -> mWrench, val -> mWrench = val)); + builder.widget(new ItemDrawable(() -> mToolStacks.get(mCrowbar + "CROWBAR")) + .asWidget() + .setPos(156, 76)) + .widget(new FakeSyncWidget.BooleanSyncer(() -> mCrowbar, val -> mCrowbar = val)); + builder.widget(new ItemDrawable(() -> mToolStacks.get(mHardHammer + "HARDHAMMER")) + .asWidget() + .setPos(156, 94)) + .widget(new TextWidget("H") + .setDefaultColor(COLOR_TEXT_WHITE.get()) + .setPos(167, 103)) + .widget(new FakeSyncWidget.BooleanSyncer(() -> mHardHammer, val -> mHardHammer = val)); + builder.widget(new ItemDrawable(() -> mToolStacks.get(mSoftHammer + "SOFTHAMMER")) + .asWidget() + .setPos(156, 112)) + .widget(new TextWidget("M") + .setDefaultColor(COLOR_TEXT_WHITE.get()) + .setPos(167, 121)) + .widget(new FakeSyncWidget.BooleanSyncer(() -> mSoftHammer, val -> mSoftHammer = val)); + builder.widget(new ItemDrawable(() -> mToolStacks.get(mScrewdriver + "SCREWDRIVER")) + .asWidget() + .setPos(156, 130)) + .widget(new FakeSyncWidget.BooleanSyncer(() -> mScrewdriver, val -> mScrewdriver = val)); + builder.widget(new ItemDrawable(() -> mToolStacks.get(mSolderingTool + "SOLDERING_IRON_LV")) + .asWidget() + .setPos(156, 148)) + .widget(new FakeSyncWidget.BooleanSyncer(() -> mSolderingTool, val -> mSolderingTool = val)); + builder.widget(new ItemDrawable( + () -> mToolStacks.get(getBaseMetaTileEntity().isActive() + "GLASS")) + .asWidget() + .setPos(156, 22)) + .widget(TextWidget.dynamicString(() -> getBaseMetaTileEntity().isActive() ? "On" : "Off") + .setSynced(false) + .setDefaultColor(COLOR_TEXT_WHITE.get()) + .setPos(157, 31)) + .widget(new FakeSyncWidget.BooleanSyncer( + () -> getBaseMetaTileEntity().isActive(), + val -> getBaseMetaTileEntity().setActive(val))); + } + + protected void drawTextsNoPlayerInventory(DynamicPositionedColumn screenElements) { + screenElements.setSynced(false).setSpace(0).setPos(6, 7); + + screenElements + .widget(new TextWidget(GT_Utility.trans("138", "Incomplete Structure.")) + .setDefaultColor(COLOR_TEXT_WHITE.get()) + .setEnabled(widget -> !mMachine)) + .widget(new FakeSyncWidget.BooleanSyncer(() -> mMachine, val -> mMachine = val)) + .widget(TextWidget.dynamicString(() -> StatCollector.translateToLocal("GTPP.machines.input") + " " + + StatCollector.translateToLocal("GTPP.machines.tier") + ": " + EnumChatFormatting.GREEN + + GT_Values.VOLTAGE_NAMES[(int) getInputTier()]) + .setDefaultColor(COLOR_TEXT_WHITE.get()) + .setEnabled(widget -> mMachine && getInputTier() > 0)) + .widget(TextWidget.dynamicString(() -> StatCollector.translateToLocal("GTPP.machines.output") + " " + + StatCollector.translateToLocal("GTPP.machines.tier") + ": " + EnumChatFormatting.GREEN + + GT_Values.VOLTAGE_NAMES[(int) getOutputTier()]) + .setDefaultColor(COLOR_TEXT_WHITE.get()) + .setEnabled(widget -> mMachine && getOutputTier() > 0)) + .widget(TextWidget.dynamicString(() -> StatCollector.translateToLocal("GTPP.multiblock.progress") + ": " + + EnumChatFormatting.GREEN + + getBaseMetaTileEntity().getProgress() / 20 + + EnumChatFormatting.RESET + " s / " + EnumChatFormatting.YELLOW + + getBaseMetaTileEntity().getMaxProgress() / 20 + + EnumChatFormatting.RESET + " s") + .setDefaultColor(COLOR_TEXT_WHITE.get()) + .setEnabled(widget -> mMachine)) + .widget(new TextWidget(StatCollector.translateToLocal("GTPP.multiblock.energy") + ":") + .setDefaultColor(COLOR_TEXT_WHITE.get()) + .setEnabled(widget -> mMachine)) + .widget(TextWidget.dynamicString(() -> StatCollector.translateToLocal( + "" + EnumChatFormatting.GREEN + getStoredEnergyInAllEnergyHatches() + + EnumChatFormatting.RESET + " EU / " + EnumChatFormatting.YELLOW + + getMaxEnergyStorageOfAllEnergyHatches() + + EnumChatFormatting.RESET + " EU")) + .setDefaultColor(COLOR_TEXT_WHITE.get()) + .setEnabled(widget -> mMachine)) + .widget(new TextWidget(StatCollector.translateToLocal("GTPP.multiblock.usage") + ":") + .setDefaultColor(COLOR_TEXT_WHITE.get()) + .setEnabled(widget -> mMachine && getLastRecipeEU() > 0 && getLastRecipeDuration() > 0)) + .widget(TextWidget.dynamicString(() -> StatCollector.translateToLocal("" + EnumChatFormatting.RED + + -getLastRecipeEU() + EnumChatFormatting.RESET + " EU/t/parallel")) + .setDefaultColor(COLOR_TEXT_WHITE.get()) + .setEnabled(widget -> mMachine && getLastRecipeEU() > 0 && getLastRecipeDuration() > 0)) + .widget(TextWidget.dynamicString( + () -> StatCollector.translateToLocal("GTPP.multiblock.generation") + ":") + .setDefaultColor(COLOR_TEXT_WHITE.get()) + .setEnabled(widget -> mMachine && getLastRecipeEU() < 0 && getLastRecipeDuration() > 0)) + .widget(TextWidget.dynamicString(() -> StatCollector.translateToLocal("" + EnumChatFormatting.GREEN + + getLastRecipeEU() + EnumChatFormatting.RESET + " EU/t/parallel")) + .setDefaultColor(COLOR_TEXT_WHITE.get()) + .setEnabled(widget -> mMachine && getLastRecipeEU() < 0 && getLastRecipeDuration() > 0)) + .widget(TextWidget.dynamicString(() -> StatCollector.translateToLocal("GTPP.multiblock.duration") + ": " + + EnumChatFormatting.RED + getLastRecipeDuration() + EnumChatFormatting.RESET + + " ticks") + .setDefaultColor(COLOR_TEXT_WHITE.get()) + .setEnabled(widget -> mMachine && getLastRecipeEU() != 0 && getLastRecipeDuration() > 0)) + .widget(TextWidget.dynamicString(() -> StatCollector.translateToLocal("GTPP.multiblock.specialvalue") + + ": " + EnumChatFormatting.RED + getLastRecipeEU() + EnumChatFormatting.RESET + "") + .setDefaultColor(COLOR_TEXT_WHITE.get()) + .setEnabled(widget -> mMachine + && getLastRecipeEU() != 0 + && getLastRecipeDuration() > 0 + && (mLastRecipe != null ? mLastRecipe.mSpecialValue : 0) > 0)) + .widget(new TextWidget(StatCollector.translateToLocal("GTPP.multiblock.mei") + ":") + .setDefaultColor(COLOR_TEXT_WHITE.get()) + .setEnabled(widget -> mMachine)) + .widget(TextWidget.dynamicString(() -> + StatCollector.translateToLocal("" + EnumChatFormatting.YELLOW + getMaxInputVoltage() + + EnumChatFormatting.RESET + " EU/t(*2A) " + + StatCollector.translateToLocal("GTPP.machines.tier") + + ": " + EnumChatFormatting.YELLOW + + GT_Values.VN[GT_Utility.getTier(getMaxInputVoltage())] + + EnumChatFormatting.RESET)) + .setDefaultColor(COLOR_TEXT_WHITE.get()) + .setEnabled(widget -> mMachine)) + .widget(TextWidget.dynamicString(() -> StatCollector.translateToLocal("GTPP.multiblock.efficiency") + + ": " + EnumChatFormatting.YELLOW + (mEfficiency / 100.0F) + EnumChatFormatting.RESET + + " %") + .setDefaultColor(COLOR_TEXT_WHITE.get()) + .setEnabled(widget -> mMachine)) + .widget(TextWidget.dynamicString(() -> StatCollector.translateToLocal("GTPP.multiblock.pollution") + + ": " + EnumChatFormatting.RED + (getPollutionPerTick(null) * 20) + + EnumChatFormatting.RESET + "/sec") + .setDefaultColor(COLOR_TEXT_WHITE.get()) + .setEnabled(widget -> mMachine)) + .widget(TextWidget.dynamicString( + () -> StatCollector.translateToLocal("GTPP.multiblock.pollutionreduced") + ": " + + EnumChatFormatting.GREEN + getPollutionReductionForAllMufflers() + + EnumChatFormatting.RESET + " %") + .setDefaultColor(COLOR_TEXT_WHITE.get()) + .setEnabled(widget -> mMachine)) + .widget(new TextWidget("Total Time Since Built: ") + .setDefaultColor(COLOR_TEXT_WHITE.get()) + .setEnabled(widget -> mMachine)) + .widget(TextWidget.dynamicString(() -> "" + EnumChatFormatting.DARK_GREEN + getRuntimeWeeksDisplay() + + EnumChatFormatting.RESET + " Weeks,") + .setDefaultColor(COLOR_TEXT_WHITE.get()) + .setEnabled(widget -> mMachine)) + .widget(TextWidget.dynamicString(() -> "" + EnumChatFormatting.DARK_GREEN + getRuntimeDaysDisplay() + + EnumChatFormatting.RESET + " Days,") + .setDefaultColor(COLOR_TEXT_WHITE.get()) + .setEnabled(widget -> mMachine)) + .widget(TextWidget.dynamicString(() -> "" + EnumChatFormatting.DARK_GREEN + getRuntimeHoursDisplay() + + EnumChatFormatting.RESET + " Hours,") + .setDefaultColor(COLOR_TEXT_WHITE.get()) + .setEnabled(widget -> mMachine)) + .widget(TextWidget.dynamicString(() -> "" + EnumChatFormatting.DARK_GREEN + getRuntimeMinutesDisplay() + + EnumChatFormatting.RESET + " Minutes,") + .setDefaultColor(COLOR_TEXT_WHITE.get()) + .setEnabled(widget -> mMachine)) + .widget(TextWidget.dynamicString(() -> "" + EnumChatFormatting.DARK_GREEN + getRuntimeSecondsDisplay() + + EnumChatFormatting.RESET + " Seconds") + .setDefaultColor(COLOR_TEXT_WHITE.get()) + .setEnabled(widget -> mMachine)); + } + + protected int getLastRecipeEU() { + return mLastRecipe != null ? mLastRecipe.mEUt : 0; + } + + protected int getLastRecipeDuration() { + return mLastRecipe != null ? mLastRecipe.mDuration : 0; + } + + protected long getRuntimeSeconds() { + return getTotalRuntimeInTicks() / 20; + } + + protected long getRuntimeWeeksDisplay() { + return TimeUnit.SECONDS.toDays(getRuntimeSeconds()) / 7; + } + + protected long getRuntimeDaysDisplay() { + return TimeUnit.SECONDS.toDays(getRuntimeSeconds()) - 7 * getRuntimeWeeksDisplay(); + } + + protected long getRuntimeHoursDisplay() { + return TimeUnit.SECONDS.toHours(getRuntimeSeconds()) + - TimeUnit.DAYS.toHours(getRuntimeDaysDisplay()) + - TimeUnit.DAYS.toHours(7 * getRuntimeWeeksDisplay()); + } + + protected long getRuntimeMinutesDisplay() { + return TimeUnit.SECONDS.toMinutes(getRuntimeSeconds()) - (TimeUnit.SECONDS.toHours(getRuntimeSeconds()) * 60); + } + + protected long getRuntimeSecondsDisplay() { + return TimeUnit.SECONDS.toSeconds(getRuntimeSeconds()) - (TimeUnit.SECONDS.toMinutes(getRuntimeSeconds()) * 60); + } + + protected void setupToolDisplay() { + if (!mToolStacks.isEmpty()) return; + + mToolStacks.put( + true + "WRENCH", + GT_MetaGenerated_Tool_01.INSTANCE.getToolWithStats( + GT_MetaGenerated_Tool_01.WRENCH, 1, GOOD, Materials.Tungsten, null)); + mToolStacks.put( + true + "CROWBAR", + GT_MetaGenerated_Tool_01.INSTANCE.getToolWithStats( + GT_MetaGenerated_Tool_01.CROWBAR, 1, GOOD, Materials.Tungsten, null)); + mToolStacks.put( + true + "HARDHAMMER", + GT_MetaGenerated_Tool_01.INSTANCE.getToolWithStats( + GT_MetaGenerated_Tool_01.HARDHAMMER, 1, GOOD, Materials.Tungsten, null)); + mToolStacks.put( + true + "SOFTHAMMER", + GT_MetaGenerated_Tool_01.INSTANCE.getToolWithStats( + GT_MetaGenerated_Tool_01.SOFTHAMMER, 1, GOOD, Materials.Tungsten, null)); + mToolStacks.put( + true + "SCREWDRIVER", + GT_MetaGenerated_Tool_01.INSTANCE.getToolWithStats( + GT_MetaGenerated_Tool_01.SCREWDRIVER, 1, GOOD, Materials.Tungsten, null)); + mToolStacks.put( + true + "SOLDERING_IRON_LV", + GT_MetaGenerated_Tool_01.INSTANCE.getToolWithStats( + GT_MetaGenerated_Tool_01.SOLDERING_IRON_LV, 1, GOOD, Materials.Tungsten, null)); + + mToolStacks.put( + false + "WRENCH", + GT_MetaGenerated_Tool_01.INSTANCE.getToolWithStats( + GT_MetaGenerated_Tool_01.WRENCH, 1, BAD, Materials.Tungsten, null)); + mToolStacks.put( + false + "CROWBAR", + GT_MetaGenerated_Tool_01.INSTANCE.getToolWithStats( + GT_MetaGenerated_Tool_01.CROWBAR, 1, BAD, Materials.Tungsten, null)); + mToolStacks.put( + false + "HARDHAMMER", + GT_MetaGenerated_Tool_01.INSTANCE.getToolWithStats( + GT_MetaGenerated_Tool_01.HARDHAMMER, 1, BAD, Materials.Tungsten, null)); + mToolStacks.put( + false + "SOFTHAMMER", + GT_MetaGenerated_Tool_01.INSTANCE.getToolWithStats( + GT_MetaGenerated_Tool_01.SOFTHAMMER, 1, BAD, Materials.Tungsten, null)); + mToolStacks.put( + false + "SCREWDRIVER", + GT_MetaGenerated_Tool_01.INSTANCE.getToolWithStats( + GT_MetaGenerated_Tool_01.SCREWDRIVER, 1, BAD, Materials.Tungsten, null)); + mToolStacks.put( + false + "SOLDERING_IRON_LV", + GT_MetaGenerated_Tool_01.INSTANCE.getToolWithStats( + GT_MetaGenerated_Tool_01.SOLDERING_IRON_LV, 1, BAD, Materials.Tungsten, null)); + + ItemStack aGlassPane1 = ItemUtils.getItemStackOfAmountFromOreDict("paneGlassRed", 1); + ItemStack aGlassPane2 = ItemUtils.getItemStackOfAmountFromOreDict("paneGlassLime", 1); + mToolStacks.put("falseGLASS", aGlassPane1); + mToolStacks.put("trueGLASS", aGlassPane2); + } + public enum GTPPHatchElement implements IHatchElement<GregtechMeta_MultiBlockBase<?>> { AirIntake(GregtechMeta_MultiBlockBase::addAirIntakeToMachineList, GT_MetaTileEntity_Hatch_AirIntake.class) { @Override diff --git a/src/main/java/gtPlusPlus/xmod/gregtech/api/metatileentity/implementations/base/GregtechMeta_SteamMultiBase.java b/src/main/java/gtPlusPlus/xmod/gregtech/api/metatileentity/implementations/base/GregtechMeta_SteamMultiBase.java index 294bee0b05..d077c8ed78 100644 --- a/src/main/java/gtPlusPlus/xmod/gregtech/api/metatileentity/implementations/base/GregtechMeta_SteamMultiBase.java +++ b/src/main/java/gtPlusPlus/xmod/gregtech/api/metatileentity/implementations/base/GregtechMeta_SteamMultiBase.java @@ -74,16 +74,6 @@ public abstract class GregtechMeta_SteamMultiBase<T extends GregtechMeta_SteamMu } @Override - public boolean hasSlotInGUI() { - return true; - } - - @Override - public String getCustomGUIResourceName() { - return null; - } - - @Override public int getEuDiscountForParallelism() { return 0; } diff --git a/src/main/java/gtPlusPlus/xmod/gregtech/api/metatileentity/implementations/base/generators/GregtechDoubleFuelGeneratorBase.java b/src/main/java/gtPlusPlus/xmod/gregtech/api/metatileentity/implementations/base/generators/GregtechDoubleFuelGeneratorBase.java index 473b2ad538..440e59a272 100644 --- a/src/main/java/gtPlusPlus/xmod/gregtech/api/metatileentity/implementations/base/generators/GregtechDoubleFuelGeneratorBase.java +++ b/src/main/java/gtPlusPlus/xmod/gregtech/api/metatileentity/implementations/base/generators/GregtechDoubleFuelGeneratorBase.java @@ -3,6 +3,7 @@ package gtPlusPlus.xmod.gregtech.api.metatileentity.implementations.base.generat import static gregtech.api.enums.GT_Values.V; import gregtech.api.enums.Textures; +import gregtech.api.gui.modularui.GT_UIInfos; import gregtech.api.interfaces.ITexture; import gregtech.api.interfaces.tileentity.IGregTechTileEntity; import gregtech.api.util.GT_Recipe; @@ -91,7 +92,7 @@ public abstract class GregtechDoubleFuelGeneratorBase extends GT_MetaTileEntity_ } Logger.WARNING( "Entity is not Client side, opening entity Container and by extension, it's GUI, then returning true"); - aBaseMetaTileEntity.openGUI(aPlayer); + GT_UIInfos.openGTTileEntityUI(aBaseMetaTileEntity, aPlayer); return true; } @@ -476,4 +477,9 @@ public abstract class GregtechDoubleFuelGeneratorBase extends GT_MetaTileEntity_ public int getTankPressure() { return -100; } + + @Override + public boolean useModularUI() { + return true; + } } diff --git a/src/main/java/gtPlusPlus/xmod/gregtech/api/metatileentity/implementations/base/generators/GregtechMetaBoilerBase.java b/src/main/java/gtPlusPlus/xmod/gregtech/api/metatileentity/implementations/base/generators/GregtechMetaBoilerBase.java index 7333f5fb3d..5d5c28e375 100644 --- a/src/main/java/gtPlusPlus/xmod/gregtech/api/metatileentity/implementations/base/generators/GregtechMetaBoilerBase.java +++ b/src/main/java/gtPlusPlus/xmod/gregtech/api/metatileentity/implementations/base/generators/GregtechMetaBoilerBase.java @@ -3,6 +3,7 @@ package gtPlusPlus.xmod.gregtech.api.metatileentity.implementations.base.generat import gregtech.api.GregTech_API; import gregtech.api.enums.Materials; import gregtech.api.enums.OrePrefixes; +import gregtech.api.gui.modularui.GT_UIInfos; import gregtech.api.interfaces.ITexture; import gregtech.api.interfaces.tileentity.IGregTechTileEntity; import gregtech.api.metatileentity.implementations.GT_MetaTileEntity_BasicTank; @@ -114,7 +115,7 @@ public abstract class GregtechMetaBoilerBase extends GT_MetaTileEntity_BasicTank this.fill(Materials.Water.getFluid(1000 * aPlayer.getCurrentEquippedItem().stackSize), true); aPlayer.getCurrentEquippedItem().func_150996_a(Items.bucket); } else { - aBaseMetaTileEntity.openGUI(aPlayer); + GT_UIInfos.openGTTileEntityUI(aBaseMetaTileEntity, aPlayer); } } return true; diff --git a/src/main/java/gtPlusPlus/xmod/gregtech/api/metatileentity/implementations/base/generators/GregtechMetaSolarGenerator.java b/src/main/java/gtPlusPlus/xmod/gregtech/api/metatileentity/implementations/base/generators/GregtechMetaSolarGenerator.java index 258f6320ae..e4a6d4bd44 100644 --- a/src/main/java/gtPlusPlus/xmod/gregtech/api/metatileentity/implementations/base/generators/GregtechMetaSolarGenerator.java +++ b/src/main/java/gtPlusPlus/xmod/gregtech/api/metatileentity/implementations/base/generators/GregtechMetaSolarGenerator.java @@ -3,6 +3,7 @@ package gtPlusPlus.xmod.gregtech.api.metatileentity.implementations.base.generat import static gregtech.api.enums.GT_Values.V; import gregtech.api.enums.Textures; +import gregtech.api.gui.modularui.GT_UIInfos; import gregtech.api.interfaces.ITexture; import gregtech.api.interfaces.tileentity.IGregTechTileEntity; import gregtech.api.metatileentity.implementations.GT_MetaTileEntity_BasicTank; @@ -78,7 +79,7 @@ public abstract class GregtechMetaSolarGenerator extends GT_MetaTileEntity_Basic if (aBaseMetaTileEntity.isClientSide()) { return true; } - aBaseMetaTileEntity.openGUI(aPlayer); + GT_UIInfos.openGTTileEntityUI(aBaseMetaTileEntity, aPlayer); return true; } diff --git a/src/main/java/gtPlusPlus/xmod/gregtech/api/metatileentity/implementations/base/generators/GregtechRocketFuelGeneratorBase.java b/src/main/java/gtPlusPlus/xmod/gregtech/api/metatileentity/implementations/base/generators/GregtechRocketFuelGeneratorBase.java index 3c3b2840ed..db9527c144 100644 --- a/src/main/java/gtPlusPlus/xmod/gregtech/api/metatileentity/implementations/base/generators/GregtechRocketFuelGeneratorBase.java +++ b/src/main/java/gtPlusPlus/xmod/gregtech/api/metatileentity/implementations/base/generators/GregtechRocketFuelGeneratorBase.java @@ -3,6 +3,7 @@ package gtPlusPlus.xmod.gregtech.api.metatileentity.implementations.base.generat import static gregtech.api.enums.GT_Values.V; import gregtech.api.enums.Textures; +import gregtech.api.gui.modularui.GT_UIInfos; import gregtech.api.interfaces.ITexture; import gregtech.api.interfaces.tileentity.IGregTechTileEntity; import gregtech.api.metatileentity.implementations.GT_MetaTileEntity_BasicTank; @@ -92,10 +93,7 @@ public abstract class GregtechRocketFuelGeneratorBase extends GT_MetaTileEntity_ @Override public boolean onRightclick(final IGregTechTileEntity aBaseMetaTileEntity, final EntityPlayer aPlayer) { - if (aBaseMetaTileEntity.isClientSide()) { - return true; - } - aBaseMetaTileEntity.openGUI(aPlayer); + GT_UIInfos.openGTTileEntityUI(aBaseMetaTileEntity, aPlayer); return true; } @@ -400,4 +398,9 @@ public abstract class GregtechRocketFuelGeneratorBase extends GT_MetaTileEntity_ public int getTankPressure() { return -100; } + + @Override + public boolean useModularUI() { + return true; + } } diff --git a/src/main/java/gtPlusPlus/xmod/gregtech/api/metatileentity/implementations/base/machines/GregtechMetaSafeBlockBase.java b/src/main/java/gtPlusPlus/xmod/gregtech/api/metatileentity/implementations/base/machines/GregtechMetaSafeBlockBase.java index a76ed88a17..5ad0a611a5 100644 --- a/src/main/java/gtPlusPlus/xmod/gregtech/api/metatileentity/implementations/base/machines/GregtechMetaSafeBlockBase.java +++ b/src/main/java/gtPlusPlus/xmod/gregtech/api/metatileentity/implementations/base/machines/GregtechMetaSafeBlockBase.java @@ -3,6 +3,7 @@ package gtPlusPlus.xmod.gregtech.api.metatileentity.implementations.base.machine import static gregtech.api.enums.GT_Values.V; import gregtech.api.enums.Textures; +import gregtech.api.gui.modularui.GT_UIInfos; import gregtech.api.interfaces.ITexture; import gregtech.api.interfaces.tileentity.IGregTechTileEntity; import gregtech.api.metatileentity.implementations.GT_MetaTileEntity_TieredMachineBlock; @@ -244,7 +245,7 @@ public abstract class GregtechMetaSafeBlockBase extends GT_MetaTileEntity_Tiered Logger.WARNING("Accessing is: " + PlayerCache.lookupPlayerByUUID(tempUUID)); if (this.ownerUUID.equals(tempUUID)) { Logger.WARNING("Owner's UUID: " + this.ownerUUID); - aBaseMetaTileEntity.openGUI(aPlayer); + GT_UIInfos.openGTTileEntityUI(aBaseMetaTileEntity, aPlayer); // Utils.LOG_WARNING("GUI should now be open for you sir."); } else { PlayerUtils.messagePlayer(aPlayer, "Access Denied, This does not belong to you."); diff --git a/src/main/java/gtPlusPlus/xmod/gregtech/api/metatileentity/implementations/nbthandlers/GT_MetaTileEntity_Hatch_NbtConsumable.java b/src/main/java/gtPlusPlus/xmod/gregtech/api/metatileentity/implementations/nbthandlers/GT_MetaTileEntity_Hatch_NbtConsumable.java index 5d232836b4..552386e72c 100644 --- a/src/main/java/gtPlusPlus/xmod/gregtech/api/metatileentity/implementations/nbthandlers/GT_MetaTileEntity_Hatch_NbtConsumable.java +++ b/src/main/java/gtPlusPlus/xmod/gregtech/api/metatileentity/implementations/nbthandlers/GT_MetaTileEntity_Hatch_NbtConsumable.java @@ -1,6 +1,13 @@ package gtPlusPlus.xmod.gregtech.api.metatileentity.implementations.nbthandlers; +import com.gtnewhorizons.modularui.api.screen.ModularWindow; +import com.gtnewhorizons.modularui.api.screen.UIBuildContext; +import com.gtnewhorizons.modularui.common.widget.DrawableWidget; +import com.gtnewhorizons.modularui.common.widget.SlotGroup; +import com.gtnewhorizons.modularui.common.widget.TextWidget; +import gregtech.api.gui.modularui.GT_UIInfos; import gregtech.api.interfaces.ITexture; +import gregtech.api.interfaces.modularui.IAddGregtechLogo; import gregtech.api.interfaces.tileentity.IGregTechTileEntity; import gregtech.api.metatileentity.MetaTileEntity; import gregtech.api.metatileentity.implementations.GT_MetaTileEntity_Hatch; @@ -10,15 +17,13 @@ import gtPlusPlus.api.objects.Logger; import gtPlusPlus.api.objects.data.AutoMap; import gtPlusPlus.core.util.minecraft.ItemUtils; import gtPlusPlus.core.util.reflect.ReflectionUtils; -import gtPlusPlus.xmod.gregtech.api.gui.hatches.CONTAINER_HatchNbtConsumable; -import gtPlusPlus.xmod.gregtech.api.gui.hatches.GUI_HatchNbtConsumable; import gtPlusPlus.xmod.gregtech.common.StaticFields59; import java.lang.reflect.Constructor; import net.minecraft.entity.player.EntityPlayer; -import net.minecraft.entity.player.InventoryPlayer; import net.minecraft.item.ItemStack; -public abstract class GT_MetaTileEntity_Hatch_NbtConsumable extends GT_MetaTileEntity_Hatch { +public abstract class GT_MetaTileEntity_Hatch_NbtConsumable extends GT_MetaTileEntity_Hatch + implements IAddGregtechLogo { public GT_Recipe_Map mRecipeMap = null; private final int mInputslotCount; @@ -110,27 +115,10 @@ public abstract class GT_MetaTileEntity_Hatch_NbtConsumable extends GT_MetaTileE @Override public final boolean onRightclick(IGregTechTileEntity aBaseMetaTileEntity, EntityPlayer aPlayer) { - if (aBaseMetaTileEntity.isClientSide()) { - return true; - } - aBaseMetaTileEntity.openGUI(aPlayer); + GT_UIInfos.openGTTileEntityUI(aBaseMetaTileEntity, aPlayer); return true; } - @Override - public final Object getServerGUI( - int aID, InventoryPlayer aPlayerInventory, IGregTechTileEntity aBaseMetaTileEntity) { - return new CONTAINER_HatchNbtConsumable(aPlayerInventory, aBaseMetaTileEntity, mInputslotCount); - } - - @Override - public final Object getClientGUI( - int aID, InventoryPlayer aPlayerInventory, IGregTechTileEntity aBaseMetaTileEntity) { - CONTAINER_HatchNbtConsumable aContainer = - new CONTAINER_HatchNbtConsumable(aPlayerInventory, aBaseMetaTileEntity, mInputslotCount); - return new GUI_HatchNbtConsumable(aContainer, getNameGUI()); - } - public abstract String getNameGUI(); @Override @@ -317,4 +305,85 @@ public abstract class GT_MetaTileEntity_Hatch_NbtConsumable extends GT_MetaTileE } return false; } + + @Override + public boolean useModularUI() { + return true; + } + + @Override + public void addGregTechLogo(ModularWindow.Builder builder) { + switch (mTotalSlotCount) { + case 8: + case 18: + builder.widget(new DrawableWidget() + .setDrawable(getGUITextureSet().getGregTechLogo()) + .setSize(17, 17) + .setPos(152, 63)); + break; + case 32: + builder.widget(new DrawableWidget() + .setDrawable(getGUITextureSet().getGregTechLogo()) + .setSize(17, 17) + .setPos(79, 35)); + break; + } + } + + @Override + public void addUIWidgets(ModularWindow.Builder builder, UIBuildContext buildContext) { + switch (mTotalSlotCount) { + case 8: + builder.widget(SlotGroup.ofItemHandler(inventoryHandler, 2) + .startFromSlot(0) + .endAtSlot(3) + .build() + .setPos(25, 25)); + builder.widget(SlotGroup.ofItemHandler(inventoryHandler, 2) + .startFromSlot(4) + .endAtSlot(7) + .canInsert(false) + .build() + .setPos(115, 25)); + builder.widget(new TextWidget("Stock") + .setDefaultColor(COLOR_TEXT_GRAY.get()) + .setPos(25, 16)) + .widget(new TextWidget("Active") + .setDefaultColor(COLOR_TEXT_GRAY.get()) + .setPos(115, 16)); + break; + case 18: + builder.widget(SlotGroup.ofItemHandler(inventoryHandler, 3) + .startFromSlot(0) + .endAtSlot(8) + .build() + .setPos(25, 19)); + builder.widget(SlotGroup.ofItemHandler(inventoryHandler, 3) + .startFromSlot(9) + .endAtSlot(17) + .canInsert(false) + .build() + .setPos(97, 19)); + builder.widget(new TextWidget("Stock") + .setDefaultColor(COLOR_TEXT_GRAY.get()) + .setPos(25, 14)) + .widget(new TextWidget("Active") + .setDefaultColor(COLOR_TEXT_GRAY.get()) + .setPos(15, 14)); + break; + case 32: + builder.widget(SlotGroup.ofItemHandler(inventoryHandler, 4) + .startFromSlot(0) + .endAtSlot(15) + .build() + .setPos(7, 7)); + builder.widget(SlotGroup.ofItemHandler(inventoryHandler, 4) + .startFromSlot(16) + .endAtSlot(31) + .canInsert(false) + .build() + .setPos(96, 7)); + break; + } + } } diff --git a/src/main/java/gtPlusPlus/xmod/gregtech/common/covers/GTPP_Cover_Overflow.java b/src/main/java/gtPlusPlus/xmod/gregtech/common/covers/GTPP_Cover_Overflow.java index 001b840df7..4e2f758d61 100644 --- a/src/main/java/gtPlusPlus/xmod/gregtech/common/covers/GTPP_Cover_Overflow.java +++ b/src/main/java/gtPlusPlus/xmod/gregtech/common/covers/GTPP_Cover_Overflow.java @@ -1,13 +1,19 @@ package gtPlusPlus.xmod.gregtech.common.covers; -import gregtech.api.enums.GT_Values; -import gregtech.api.gui.GT_GUICover; -import gregtech.api.gui.widgets.GT_GuiIntegerTextBox; +import com.gtnewhorizons.modularui.api.drawable.Text; +import com.gtnewhorizons.modularui.api.math.MathExpression; +import com.gtnewhorizons.modularui.api.screen.ModularWindow; +import com.gtnewhorizons.modularui.common.widget.TextWidget; +import com.gtnewhorizons.modularui.common.widget.textfield.BaseTextFieldWidget; +import gregtech.api.gui.modularui.GT_CoverUIBuildContext; import gregtech.api.interfaces.tileentity.ICoverable; -import gregtech.api.net.GT_Packet_TileEntityCover; import gregtech.api.util.GT_CoverBehavior; import gregtech.api.util.GT_Utility; +import gregtech.api.util.ISerializableObject; +import gregtech.common.gui.modularui.widget.CoverDataControllerWidget; +import gregtech.common.gui.modularui.widget.CoverDataFollower_TextFieldWidget; import gtPlusPlus.core.util.minecraft.LangUtils; +import java.util.concurrent.atomic.AtomicBoolean; import net.minecraft.entity.player.EntityPlayer; import net.minecraftforge.common.util.ForgeDirection; import net.minecraftforge.fluids.Fluid; @@ -156,118 +162,72 @@ public class GTPP_Cover_Overflow extends GT_CoverBehavior { } // GUI + @Override public boolean hasCoverGUI() { return true; } @Override - public Object getClientGUI(byte aSide, int aCoverID, int coverData, ICoverable aTileEntity) { - return new GTPP_Cover_Overflow.GUI(aSide, aCoverID, coverData, aTileEntity); + public boolean useModularUI() { + return true; } - private class GUI extends GT_GUICover { - private final byte side; - private final int coverID; - private GT_GuiIntegerTextBox tBox; - private int coverVariable; + @Override + public ModularWindow createWindow(GT_CoverUIBuildContext buildContext) { + return new OverflowUIFactory(buildContext).createWindow(); + } + + private class OverflowUIFactory extends UIFactory { private static final int startX = 10; private static final int startY = 25; private static final int spaceX = 18; private static final int spaceY = 18; - private boolean warn = false; - - public GUI(byte aSide, int aCoverID, int aCoverVariable, ICoverable aTileEntity) { - super(aTileEntity, 176, 107, GT_Utility.intToStack(aCoverID)); - this.side = aSide; - this.coverID = aCoverID; - this.coverVariable = aCoverVariable; - - tBox = new GT_GuiIntegerTextBox(this, 2, startX + spaceX * 0, startY + spaceY * 0 + 8, spaceX * 4 - 3, 12); - tBox.setText(String.valueOf(this.coverVariable)); - tBox.setMaxStringLength(10); - } - - @Override - protected void onInitGui(int guiLeft, int guiTop, int gui_width, int gui_height) { - tBox.setFocused(true); - } - - @Override - public void drawExtras(int mouseX, int mouseY, float parTicks) { - super.drawExtras(mouseX, mouseY, parTicks); - this.getFontRenderer() - .drawString(trans("323", "L"), startX + spaceX * 4, 4 + startY + spaceY * 0 + 8, 0xFF555555); - if (warn) - this.getFontRenderer() - .drawString( - trans("325", "Max") + ": " + coverVariable + "/" + mMaxTransferRate + " " - + trans("323", "L"), - startX + spaceX * 0, - 4 + startY + spaceY * 1 + 6, - 0xffff0000); - else - this.getFontRenderer() - .drawString( - trans("324", "Now") + ": " + coverVariable + "/" + mMaxTransferRate + " " - + trans("323", "L"), - startX + spaceX * 0, - 4 + startY + spaceY * 1 + 6, - 0xFF555555); - } - - @Override - public void onMouseWheel(int x, int y, int delta) { - for (GT_GuiIntegerTextBox box : textBoxes) { - if (box.isFocused()) { - int step = Math.max(1, Math.abs(delta / 120)); - step = (isShiftKeyDown() ? 50 : isCtrlKeyDown() ? 5 : 1) * (delta > 0 ? step : -step); - long i; - try { - i = Long.parseLong(box.getText()); - } catch (NumberFormatException e) { - return; - } - if (i > (Long.MAX_VALUE - 1000)) break; - - i = i + step; - if (i <= 0) i = 0; - box.setText(String.valueOf(i)); - break; - } - } - } - - @Override - public void applyTextBox(GT_GuiIntegerTextBox box) { - long i; - String s = box.getText().trim(); - try { - i = Long.parseLong(s); - } catch (NumberFormatException e) { - resetTextBox(box); - return; - } - - warn = false; - if (box.id == 2) { - if (i > (long) mMaxTransferRate) { - i = mMaxTransferRate; - warn = true; - } else if (i < 0) { - i = 0; - } - coverVariable = (int) i; - } - box.setText(String.valueOf(i)); - GT_Values.NW.sendToServer(new GT_Packet_TileEntityCover(side, coverID, coverVariable, tile)); + public OverflowUIFactory(GT_CoverUIBuildContext buildContext) { + super(buildContext); } + @SuppressWarnings("PointlessArithmeticExpression") @Override - public void resetTextBox(GT_GuiIntegerTextBox box) { - if (box.id == 2) box.setText(String.valueOf(coverVariable)); + protected void addUIWidgets(ModularWindow.Builder builder) { + AtomicBoolean warn = new AtomicBoolean(false); + + builder.widget(new CoverDataControllerWidget<>( + this::getCoverData, this::setCoverData, GTPP_Cover_Overflow.this) + .addFollower( + new CoverDataFollower_TextFieldWidget<>(), + coverData -> String.valueOf(convert(coverData)), + (coverData, state) -> new ISerializableObject.LegacyCoverData( + (int) MathExpression.parseMathExpression(state)), + widget -> widget.setOnScrollNumbersLong(1, 5, 50) + .setNumbersLong(val -> { + warn.set(false); + if (val > mMaxTransferRate) { + val = (long) mMaxTransferRate; + warn.set(true); + } else if (val < 0) { + val = 0L; + } + return val; + }) + .setPattern(BaseTextFieldWidget.NATURAL_NUMS) + .setFocusOnGuiOpen(true) + .setPos(startX + spaceX * 0, startY + spaceY * 0 + 8) + .setSize(spaceX * 4 - 3, 12))) + .widget(new TextWidget(GT_Utility.trans("323", "L")) + .setDefaultColor(COLOR_TEXT_GRAY.get()) + .setPos(startX + spaceX * 4, 4 + startY + spaceY * 0 + 8)) + .widget(TextWidget.dynamicText(() -> new Text((warn.get() + ? GT_Utility.trans("325", "Max") + : GT_Utility.trans("324", "Now")) + + ": " + convert(getCoverData()) + + "/" + mMaxTransferRate + " " + + GT_Utility.trans("323", "L")) + .color(warn.get() ? COLOR_TEXT_WARN.get() : COLOR_TEXT_GRAY.get())) + .setSynced(false) + .setPos(startX + spaceX * 0, 4 + startY + spaceY * 1 + 6)); } } } diff --git a/src/main/java/gtPlusPlus/xmod/gregtech/common/tileentities/automation/GT_MetaTileEntity_ElectricAutoWorkbench.java b/src/main/java/gtPlusPlus/xmod/gregtech/common/tileentities/automation/GT_MetaTileEntity_ElectricAutoWorkbench.java index 79400b68e6..bf56872d52 100644 --- a/src/main/java/gtPlusPlus/xmod/gregtech/common/tileentities/automation/GT_MetaTileEntity_ElectricAutoWorkbench.java +++ b/src/main/java/gtPlusPlus/xmod/gregtech/common/tileentities/automation/GT_MetaTileEntity_ElectricAutoWorkbench.java @@ -1,10 +1,19 @@ package gtPlusPlus.xmod.gregtech.common.tileentities.automation; +import com.gtnewhorizons.modularui.api.screen.ModularWindow; +import com.gtnewhorizons.modularui.api.screen.UIBuildContext; +import com.gtnewhorizons.modularui.common.widget.CycleButtonWidget; +import com.gtnewhorizons.modularui.common.widget.DrawableWidget; +import com.gtnewhorizons.modularui.common.widget.SlotGroup; +import com.gtnewhorizons.modularui.common.widget.SlotWidget; import gregtech.api.enums.GT_Values; import gregtech.api.enums.OrePrefixes; import gregtech.api.enums.Textures; import gregtech.api.enums.Textures.BlockIcons; +import gregtech.api.gui.modularui.GT_UIInfos; +import gregtech.api.gui.modularui.GT_UITextures; import gregtech.api.interfaces.ITexture; +import gregtech.api.interfaces.modularui.IAddGregtechLogo; import gregtech.api.interfaces.tileentity.IGregTechTileEntity; import gregtech.api.metatileentity.MetaTileEntity; import gregtech.api.metatileentity.implementations.GT_MetaTileEntity_BasicTank; @@ -14,22 +23,23 @@ import gregtech.api.util.GT_ModHandler; import gregtech.api.util.GT_OreDictUnificator; import gregtech.api.util.GT_Utility; import gtPlusPlus.core.lib.CORE; -import gtPlusPlus.xmod.gregtech.api.gui.automation.GT_Container_ElectricAutoWorkbench; -import gtPlusPlus.xmod.gregtech.api.gui.automation.GT_GUIContainer_ElectricAutoWorkbench; +import gtPlusPlus.xmod.gregtech.api.gui.GTPP_UITextures; import gtPlusPlus.xmod.gregtech.common.blocks.textures.TexturesGtBlock; import java.util.ArrayList; import net.minecraft.entity.player.EntityPlayer; -import net.minecraft.entity.player.InventoryPlayer; import net.minecraft.item.ItemStack; import net.minecraft.nbt.NBTTagCompound; import net.minecraftforge.oredict.OreDictionary; -public class GT_MetaTileEntity_ElectricAutoWorkbench extends GT_MetaTileEntity_BasicTank { +public class GT_MetaTileEntity_ElectricAutoWorkbench extends GT_MetaTileEntity_BasicTank implements IAddGregtechLogo { public int mMode = 0, mCurrentSlot = 0, mThroughPut = 0, mTicksUntilNextUpdate = 20; public boolean mLastCraftSuccessful = false; protected String mLocalName; + private static final int MAX_MODES = 10; + private static final int MAX_THROUGHPUT = 4; + public GT_MetaTileEntity_ElectricAutoWorkbench(final int aID, final int aTier, final String aDescription) { super( aID, @@ -47,18 +57,6 @@ public class GT_MetaTileEntity_ElectricAutoWorkbench extends GT_MetaTileEntity_B } @Override - public Object getServerGUI( - final int aID, final InventoryPlayer aPlayerInventory, final IGregTechTileEntity aBaseMetaTileEntity) { - return new GT_Container_ElectricAutoWorkbench(aPlayerInventory, aBaseMetaTileEntity); - } - - @Override - public Object getClientGUI( - final int aID, final InventoryPlayer aPlayerInventory, final IGregTechTileEntity aBaseMetaTileEntity) { - return new GT_GUIContainer_ElectricAutoWorkbench(aPlayerInventory, aBaseMetaTileEntity); - } - - @Override public boolean isTransformerUpgradable() { return true; } @@ -140,10 +138,7 @@ public class GT_MetaTileEntity_ElectricAutoWorkbench extends GT_MetaTileEntity_B @Override public boolean onRightclick(final IGregTechTileEntity aBaseMetaTileEntity, final EntityPlayer aPlayer) { - if (aBaseMetaTileEntity.isClientSide()) { - return true; - } - aBaseMetaTileEntity.openGUI(aPlayer); + GT_UIInfos.openGTTileEntityUI(aBaseMetaTileEntity, aPlayer); return true; } @@ -202,27 +197,10 @@ public class GT_MetaTileEntity_ElectricAutoWorkbench extends GT_MetaTileEntity_B && aSide != getBaseMetaTileEntity().getBackFacing(); } - private static final int MAX_MODES = 10; - - public void switchModeForward() { - mMode = (mMode + 1) % MAX_MODES; - switchMode(); - } - - public void switchModeBackward() { - mMode--; - if (mMode < 0) mMode = MAX_MODES - 1; - switchMode(); - } - private void switchMode() { mInventory[28] = null; } - public void switchThrough() { - mThroughPut = (mThroughPut + 1) % 4; - } - @Override public void onPostTick(IGregTechTileEntity aBaseMetaTileEntity, long aTick) { super.onPostTick(aBaseMetaTileEntity, aTick); @@ -865,4 +843,86 @@ public class GT_MetaTileEntity_ElectricAutoWorkbench extends GT_MetaTileEntity_B new GT_RenderedTexture(TexturesGtBlock.Casing_Adv_Workbench_Crafting_Overlay) }; } + + @Override + public boolean useModularUI() { + return true; + } + + @Override + public void addGregTechLogo(ModularWindow.Builder builder) { + builder.widget(new DrawableWidget() + .setDrawable(getGUITextureSet().getGregTechLogo()) + .setSize(17, 17) + .setPos(118, 22)); + } + + @Override + public void addUIWidgets(ModularWindow.Builder builder, UIBuildContext buildContext) { + builder.widget(SlotGroup.ofItemHandler(inventoryHandler, 3) + .endAtSlot(8) + .build() + .setPos(7, 4)) + .widget(SlotGroup.ofItemHandler(inventoryHandler, 9) + .startFromSlot(9) + .endAtSlot(17) + .canInsert(false) + .background(GT_UITextures.SLOT_DARK_GRAY) + .applyForWidget(SlotWidget::disableShiftInsert) + .build() + .setPos(7, 59)) + .widget(new SlotWidget(inventoryHandler, 18) + .setAccess(true, false) + .setBackground(getGUITextureSet().getItemSlot(), GT_UITextures.OVERLAY_SLOT_OUT) + .setPos(151, 40)) + .widget(new DrawableWidget() + .setDrawable(GT_UITextures.PICTURE_SLOTS_HOLO_3BY3) + .setPos(62, 4) + .setSize(54, 54)) + .widget(SlotGroup.ofItemHandler(inventoryHandler, 3) + .startFromSlot(19) + .endAtSlot(27) + .phantom(true) + .background(GT_UITextures.TRANSPARENT) + .build() + .setPos(62, 4)) + .widget(SlotWidget.phantom(inventoryHandler, 28) + .disableInteraction() + .setBackground(getGUITextureSet().getItemSlot(), GTPP_UITextures.OVERLAY_SLOT_ARROW_4) + .setPos(151, 4)); + builder.widget(new CycleButtonWidget() + .setGetter(() -> mThroughPut) + .setSetter(val -> mThroughPut = val) + .setLength(MAX_THROUGHPUT) + .setTextureGetter(i -> GTPP_UITextures.OVERLAY_BUTTON_THROUGHPUT[i]) + .setBackground(GT_UITextures.BUTTON_STANDARD) + .setPos(120, 4) + .setSize(18, 18)); + String[] mModeText = new String[] { + "Normal Crafting Table", "???", "1x1", "2x2", "3x3", "Unifier", "Dust", "???", "Hammer?", "Circle" + }; + CycleButtonWidget modeButton = new CycleButtonWidget() + .setGetter(() -> mMode) + .setSetter(val -> { + mMode = val; + switchMode(); + }) + .setLength(MAX_MODES) + .setTextureGetter(i -> GTPP_UITextures.OVERLAY_BUTTON_MODE[i]); + for (int i = 0; i < MAX_MODES; i++) { + modeButton.addTooltip(i, "Mode: " + mModeText[i]); + } + builder.widget(modeButton + .setBackground(GT_UITextures.BUTTON_STANDARD) + .setPos(120, 40) + .setSize(18, 18)); + builder.widget(new DrawableWidget() + .setDrawable(GTPP_UITextures.PICTURE_WORKBENCH_CIRCLE) + .setPos(136, 23) + .setSize(16, 16)) + .widget(new DrawableWidget() + .setDrawable(GTPP_UITextures.PICTURE_ARROW_WHITE_DOWN) + .setPos(155, 23) + .setSize(10, 16)); + } } diff --git a/src/main/java/gtPlusPlus/xmod/gregtech/common/tileentities/automation/GT_MetaTileEntity_ElectricInventoryManager.java b/src/main/java/gtPlusPlus/xmod/gregtech/common/tileentities/automation/GT_MetaTileEntity_ElectricInventoryManager.java index ebce1fcec6..1a15c563ef 100644 --- a/src/main/java/gtPlusPlus/xmod/gregtech/common/tileentities/automation/GT_MetaTileEntity_ElectricInventoryManager.java +++ b/src/main/java/gtPlusPlus/xmod/gregtech/common/tileentities/automation/GT_MetaTileEntity_ElectricInventoryManager.java @@ -1,8 +1,21 @@ package gtPlusPlus.xmod.gregtech.common.tileentities.automation; +import com.gtnewhorizons.modularui.api.ModularUITextures; +import com.gtnewhorizons.modularui.api.drawable.IDrawable; +import com.gtnewhorizons.modularui.api.screen.ModularWindow; +import com.gtnewhorizons.modularui.api.screen.UIBuildContext; +import com.gtnewhorizons.modularui.common.internal.wrapper.BaseSlot; +import com.gtnewhorizons.modularui.common.widget.ButtonWidget; +import com.gtnewhorizons.modularui.common.widget.DrawableWidget; +import com.gtnewhorizons.modularui.common.widget.FakeSyncWidget; +import com.gtnewhorizons.modularui.common.widget.SlotWidget; import gregtech.api.enums.GT_Values; import gregtech.api.enums.Textures; +import gregtech.api.gui.modularui.GT_UIInfos; +import gregtech.api.gui.modularui.GT_UITextures; import gregtech.api.interfaces.ITexture; +import gregtech.api.interfaces.modularui.IAddGregtechLogo; +import gregtech.api.interfaces.modularui.IAddUIWidgets; import gregtech.api.interfaces.tileentity.IGregTechTileEntity; import gregtech.api.metatileentity.MetaTileEntity; import gregtech.api.metatileentity.implementations.GT_MetaTileEntity_TieredMachineBlock; @@ -10,17 +23,17 @@ import gregtech.api.objects.GT_ItemStack; import gregtech.api.objects.GT_RenderedTexture; import gregtech.api.util.GT_Utility; import gtPlusPlus.core.lib.CORE; -import gtPlusPlus.xmod.gregtech.api.gui.automation.GT_Container_ElectricInventoryManager; -import gtPlusPlus.xmod.gregtech.api.gui.automation.GT_GUIContainer_ElectricInventoryManager; +import gtPlusPlus.xmod.gregtech.api.gui.GTPP_UITextures; import gtPlusPlus.xmod.gregtech.common.blocks.textures.TexturesGtBlock; import java.util.ArrayList; import net.minecraft.entity.player.EntityPlayer; -import net.minecraft.entity.player.InventoryPlayer; import net.minecraft.inventory.IInventory; import net.minecraft.item.ItemStack; import net.minecraft.nbt.NBTTagCompound; +import net.minecraftforge.oredict.OreDictionary; -public class GT_MetaTileEntity_ElectricInventoryManager extends GT_MetaTileEntity_TieredMachineBlock { +public class GT_MetaTileEntity_ElectricInventoryManager extends GT_MetaTileEntity_TieredMachineBlock + implements IAddGregtechLogo, IAddUIWidgets { public int[] mSlotRange = new int[4]; public boolean mWorkedLastTick = false; @@ -43,18 +56,6 @@ public class GT_MetaTileEntity_ElectricInventoryManager extends GT_MetaTileEntit } @Override - public Object getServerGUI( - final int aID, final InventoryPlayer aPlayerInventory, final IGregTechTileEntity aBaseMetaTileEntity) { - return new GT_Container_ElectricInventoryManager(aPlayerInventory, aBaseMetaTileEntity); - } - - @Override - public Object getClientGUI( - final int aID, final InventoryPlayer aPlayerInventory, final IGregTechTileEntity aBaseMetaTileEntity) { - return new GT_GUIContainer_ElectricInventoryManager(aPlayerInventory, aBaseMetaTileEntity); - } - - @Override public boolean isTransformerUpgradable() { return true; } @@ -146,10 +147,7 @@ public class GT_MetaTileEntity_ElectricInventoryManager extends GT_MetaTileEntit @Override public boolean onRightclick(final IGregTechTileEntity aBaseMetaTileEntity, final EntityPlayer aPlayer) { - if (aBaseMetaTileEntity.isClientSide()) { - return true; - } - aBaseMetaTileEntity.openGUI(aPlayer); + GT_UIInfos.openGTTileEntityUI(aBaseMetaTileEntity, aPlayer); return true; } @@ -600,4 +598,167 @@ public class GT_MetaTileEntity_ElectricInventoryManager extends GT_MetaTileEntit new GT_RenderedTexture(TexturesGtBlock.Casing_InventoryManagaer_Yellow_Redstone) }; } + + @Override + public boolean useModularUI() { + return true; + } + + @Override + public void addGregTechLogo(ModularWindow.Builder builder) { + builder.widget(new DrawableWidget() + .setDrawable(getGUITextureSet().getGregTechLogo()) + .setSize(17, 17) + .setPos(154, 59)); + } + + // Internal copy of values stored in this tile. Client will use these to render stuff. + private final int[] mTargetDirections = new int[12]; + private final int[] mRangeDirections = new int[4]; + private final boolean[] mTargetInOut = new boolean[12]; + private final boolean[] mTargetEnergy = new boolean[4]; + + @Override + public void addUIWidgets(ModularWindow.Builder builder, UIBuildContext buildContext) { + for (int i = 0; i < 3; i++) { + builder.widget(new SlotWidget(inventoryHandler, i) + .setBackground(getGUITextureSet().getItemSlot(), GTPP_UITextures.OVERLAY_SLOT_CHEST) + .setPos(154, 4 + i * 18)); + } + + int[] slotXPositions = new int[] {4, 60, 79, 135}; + for (int i = 0; i < 12; i++) { + final int index = i; + builder.widget( + new SlotWidget(new BaseSlot(inventoryHandler, i + 3, true)) { + @Override + protected void phantomClick(ClickData clickData, ItemStack cursorStack) { + super.phantomClick(clickData, cursorStack); + if (clickData.mouseButton != 0 + && cursorStack != null + && getMcSlot().getHasStack()) { + getMcSlot().getStack().setItemDamage(OreDictionary.WILDCARD_VALUE); + } + } + }.setControlsAmount(true) + .disableShiftInsert() + .setBackground(() -> { + if (index % 3 == 0) { + return new IDrawable[] { + GTPP_UITextures.SLOT_INVENTORY_MANAGER[mRangeDirections[index / 3]], + GTPP_UITextures.OVERLAY_SLOT_INVENTORY_MANAGER_COLOR[ + mRangeDirections[index / 3]] + }; + } else if (index % 3 == 1) { + return new IDrawable[] { + GTPP_UITextures.SLOT_INVENTORY_MANAGER[mRangeDirections[index / 3]], + GTPP_UITextures.OVERLAY_SLOT_INVENTORY_MANAGER_ARROW[ + mRangeDirections[index / 3]] + }; + } else { + return new IDrawable[] { + GTPP_UITextures.SLOT_INVENTORY_MANAGER[mRangeDirections[index / 3]] + }; + } + }) + .setPos(slotXPositions[i / 3], 4 + (i % 3) * 18)); + } + for (int i = 0; i < 4; i++) { + final int index = i; + builder.widget(new ButtonWidget() + .setOnClick((clickData, widget) -> switchRangeEnergy(index)) + .setBackground(() -> new IDrawable[] { + mTargetEnergy[index] ? ModularUITextures.ITEM_SLOT : GT_UITextures.BUTTON_STANDARD, + GT_UITextures.OVERLAY_BUTTON_EMIT_ENERGY + }) + .setPos(slotXPositions[i], 59) + .setSize(18, 18)); + } + + int[] buttonXPositions = new int[] {23, 41, 98, 116}; + for (int i = 0; i < 12; i++) { + final int index = i; + builder.widget(new ButtonWidget() + .setOnClick((clickData, widget) -> { + if (index % 3 == 0) { + if (clickData.mouseButton != 0) { + switchSlot1InOut(index / 3); + } else { + iterateSlot1Direction(index / 3); + } + } else if (index % 3 == 1) { + if (clickData.mouseButton != 0) { + switchSlot2InOut(index / 3); + } else { + iterateSlot2Direction(index / 3); + } + } else { + if (clickData.mouseButton != 0) { + switchSlot3InOut(index / 3); + } else { + iterateSlot3Direction(index / 3); + } + } + }) + .setBackground(() -> new IDrawable[] { + GT_UITextures.BUTTON_STANDARD, + GTPP_UITextures.OVERLAY_BUTTON_DIRECTION[mTargetDirections[index]], + mTargetInOut[index] + ? GTPP_UITextures.OVERLAY_BUTTON_TIP_RED + : GTPP_UITextures.OVERLAY_BUTTON_TIP_GREEN + }) + .setPos(buttonXPositions[i / 3], 4 + (i % 3) * 18) + .setSize(18, 18)); + } + for (int i = 0; i < 4; i++) { + final int index = i; + builder.widget(new ButtonWidget() + .setOnClick((clickData, widget) -> iterateRangeDirection(index)) + .setBackground(() -> new IDrawable[] { + GT_UITextures.BUTTON_STANDARD, + GTPP_UITextures.OVERLAY_BUTTON_DIRECTION_GRAY[mRangeDirections[index]] + }) + .setPos(buttonXPositions[i], 59) + .setSize(18, 18)); + } + + for (int i = 0; i < mTargetDirections.length; i++) { + final int index = i; + builder.widget(new FakeSyncWidget.ByteSyncer( + () -> { + if (index % 3 == 0) { + return getSlot1Direction(index / 3); + } else if (index % 3 == 1) { + return getSlot2Direction(index / 3); + } else { + return getSlot3Direction(index / 3); + } + }, + val -> mTargetDirections[index] = val)); + } + for (int i = 0; i < mRangeDirections.length; i++) { + final int index = i; + builder.widget(new FakeSyncWidget.ByteSyncer( + () -> getRangeDirection(index), val -> mRangeDirections[index] = val)); + } + for (int i = 0; i < mTargetInOut.length; i++) { + final int index = i; + builder.widget(new FakeSyncWidget.BooleanSyncer( + () -> { + if (index % 3 == 0) { + return getSlot1InOut(index / 3); + } else if (index % 3 == 1) { + return getSlot2InOut(index / 3); + } else { + return getSlot3InOut(index / 3); + } + }, + val -> mTargetInOut[index] = val)); + } + for (int i = 0; i < mTargetEnergy.length; i++) { + final int index = i; + builder.widget( + new FakeSyncWidget.BooleanSyncer(() -> getRangeEnergy(index), val -> mTargetEnergy[index] = val)); + } + } } diff --git a/src/main/java/gtPlusPlus/xmod/gregtech/common/tileentities/generators/GT_MetaTileEntity_Boiler_Base.java b/src/main/java/gtPlusPlus/xmod/gregtech/common/tileentities/generators/GT_MetaTileEntity_Boiler_Base.java index 5bd16c7fb2..277fc8d873 100644 --- a/src/main/java/gtPlusPlus/xmod/gregtech/common/tileentities/generators/GT_MetaTileEntity_Boiler_Base.java +++ b/src/main/java/gtPlusPlus/xmod/gregtech/common/tileentities/generators/GT_MetaTileEntity_Boiler_Base.java @@ -1,9 +1,13 @@ package gtPlusPlus.xmod.gregtech.common.tileentities.generators; +import com.gtnewhorizons.modularui.api.drawable.IDrawable; +import com.gtnewhorizons.modularui.api.drawable.UITexture; import cpw.mods.fml.common.registry.GameRegistry; import gregtech.api.enums.Materials; import gregtech.api.enums.OrePrefixes; import gregtech.api.enums.Textures; +import gregtech.api.gui.modularui.GT_UITextures; +import gregtech.api.gui.modularui.GUITextureSet; import gregtech.api.interfaces.ITexture; import gregtech.api.interfaces.tileentity.IGregTechTileEntity; import gregtech.api.metatileentity.MetaTileEntity; @@ -13,9 +17,7 @@ import gregtech.api.util.GT_OreDictUnificator; import gregtech.api.util.GT_Utility; import gregtech.common.tileentities.boilers.GT_MetaTileEntity_Boiler; import gtPlusPlus.core.lib.CORE; -import gtPlusPlus.xmod.gregtech.api.gui.CONTAINER_AdvancedBoiler; -import gtPlusPlus.xmod.gregtech.api.gui.GUI_AdvancedBoiler; -import net.minecraft.entity.player.InventoryPlayer; +import gtPlusPlus.xmod.gregtech.api.gui.GTPP_UITextures; import net.minecraft.item.ItemStack; import net.minecraft.tileentity.TileEntityFurnace; import net.minecraftforge.common.util.ForgeDirection; @@ -253,16 +255,6 @@ public class GT_MetaTileEntity_Boiler_Base extends GT_MetaTileEntity_Boiler { } @Override - public Object getServerGUI(int aID, InventoryPlayer aPlayerInventory, IGregTechTileEntity aBaseMetaTileEntity) { - return new CONTAINER_AdvancedBoiler(aPlayerInventory, aBaseMetaTileEntity); - } - - @Override - public Object getClientGUI(int aID, InventoryPlayer aPlayerInventory, IGregTechTileEntity aBaseMetaTileEntity) { - return new GUI_AdvancedBoiler(aPlayerInventory, aBaseMetaTileEntity, "AdvancedBoiler.png"); - } - - @Override public MetaTileEntity newMetaEntity(IGregTechTileEntity aTileEntity) { return new GT_MetaTileEntity_Boiler_Base(this.mName, tier, this.mDescription, this.mTextures); } @@ -306,4 +298,49 @@ public class GT_MetaTileEntity_Boiler_Base extends GT_MetaTileEntity_Boiler { } return super.allowCoverOnSide(aSide, aCover); } + + @Override + public GUITextureSet getGUITextureSet() { + return GUITextureSet.DEFAULT; + } + + @Override + protected IDrawable[] getFuelSlotBackground() { + return new IDrawable[] {getGUITextureSet().getItemSlot(), GTPP_UITextures.OVERLAY_SLOT_COAL}; + } + + @Override + protected IDrawable[] getAshSlotBackground() { + return new IDrawable[] {getGUITextureSet().getItemSlot(), GT_UITextures.OVERLAY_SLOT_DUST}; + } + + @Override + public int getTitleColor() { + return COLOR_TITLE.get(); + } + + @Override + protected IDrawable getOverlaySlotIn() { + return GT_UITextures.OVERLAY_SLOT_IN; + } + + @Override + protected IDrawable getOverlaySlotOut() { + return GT_UITextures.OVERLAY_SLOT_OUT; + } + + @Override + protected IDrawable getOverlaySlotCanister() { + return GTPP_UITextures.OVERLAY_SLOT_CANISTER_DARK; + } + + @Override + protected UITexture getProgressbarEmpty() { + return GTPP_UITextures.PROGRESSBAR_BOILER_EMPTY; + } + + @Override + protected UITexture getProgressbarFuel() { + return GTPP_UITextures.PROGRESSBAR_FUEL; + } } diff --git a/src/main/java/gtPlusPlus/xmod/gregtech/common/tileentities/generators/GT_MetaTileEntity_Boiler_Solar.java b/src/main/java/gtPlusPlus/xmod/gregtech/common/tileentities/generators/GT_MetaTileEntity_Boiler_Solar.java index ba6b037d76..888cb6a195 100644 --- a/src/main/java/gtPlusPlus/xmod/gregtech/common/tileentities/generators/GT_MetaTileEntity_Boiler_Solar.java +++ b/src/main/java/gtPlusPlus/xmod/gregtech/common/tileentities/generators/GT_MetaTileEntity_Boiler_Solar.java @@ -9,9 +9,6 @@ import gregtech.api.objects.GT_RenderedTexture; import gregtech.api.util.GT_ModHandler; import gregtech.common.tileentities.boilers.GT_MetaTileEntity_Boiler; import gtPlusPlus.core.lib.CORE; -import gtPlusPlus.xmod.gregtech.api.gui.CONTAINER_AdvancedBoiler; -import gtPlusPlus.xmod.gregtech.api.gui.GUI_AdvancedBoiler; -import net.minecraft.entity.player.InventoryPlayer; import net.minecraft.nbt.NBTTagCompound; import net.minecraftforge.common.util.ForgeDirection; import net.minecraftforge.fluids.FluidStack; @@ -81,18 +78,6 @@ public class GT_MetaTileEntity_Boiler_Solar extends GT_MetaTileEntity_Boiler { } @Override - public Object getServerGUI( - final int aID, final InventoryPlayer aPlayerInventory, final IGregTechTileEntity aBaseMetaTileEntity) { - return new CONTAINER_AdvancedBoiler(aPlayerInventory, aBaseMetaTileEntity); - } - - @Override - public Object getClientGUI( - final int aID, final InventoryPlayer aPlayerInventory, final IGregTechTileEntity aBaseMetaTileEntity) { - return new GUI_AdvancedBoiler(aPlayerInventory, aBaseMetaTileEntity, "SolarBoiler.png"); - } - - @Override public MetaTileEntity newMetaEntity(final IGregTechTileEntity aTileEntity) { return new GT_MetaTileEntity_Boiler_Solar(this.mName, this.mTier, this.mDescription, this.mTextures); } diff --git a/src/main/java/gtPlusPlus/xmod/gregtech/common/tileentities/generators/GT_MetaTileEntity_RfConvertor.java b/src/main/java/gtPlusPlus/xmod/gregtech/common/tileentities/generators/GT_MetaTileEntity_RfConvertor.java index 340a97fccf..e077d5ef90 100644 --- a/src/main/java/gtPlusPlus/xmod/gregtech/common/tileentities/generators/GT_MetaTileEntity_RfConvertor.java +++ b/src/main/java/gtPlusPlus/xmod/gregtech/common/tileentities/generators/GT_MetaTileEntity_RfConvertor.java @@ -23,7 +23,6 @@ import gtPlusPlus.core.util.minecraft.PlayerUtils; import gtPlusPlus.xmod.gregtech.common.blocks.textures.TexturesGtBlock; import gtPlusPlus.xmod.gregtech.common.tileentities.storage.GregtechMetaEnergyBuffer; import net.minecraft.entity.player.EntityPlayer; -import net.minecraft.entity.player.InventoryPlayer; import net.minecraft.item.ItemStack; import net.minecraft.nbt.NBTTagCompound; import net.minecraft.tileentity.TileEntity; @@ -156,18 +155,6 @@ public class GT_MetaTileEntity_RfConvertor extends GregtechMetaEnergyBuffer impl } @Override - public Object getServerGUI( - final int aID, final InventoryPlayer aPlayerInventory, final IGregTechTileEntity aBaseMetaTileEntity) { - return null; - } - - @Override - public Object getClientGUI( - final int aID, final InventoryPlayer aPlayerInventory, final IGregTechTileEntity aBaseMetaTileEntity) { - return null; - } - - @Override public void onPostTick(final IGregTechTileEntity aBaseMetaTileEntity, final long aTick) { if (aBaseMetaTileEntity.isServerSide()) { if (!aBaseMetaTileEntity.isActive()) { diff --git a/src/main/java/gtPlusPlus/xmod/gregtech/common/tileentities/generators/GregtechMetaTileEntityGeothermalGenerator.java b/src/main/java/gtPlusPlus/xmod/gregtech/common/tileentities/generators/GregtechMetaTileEntityGeothermalGenerator.java index ba63952baf..520f960ec9 100644 --- a/src/main/java/gtPlusPlus/xmod/gregtech/common/tileentities/generators/GregtechMetaTileEntityGeothermalGenerator.java +++ b/src/main/java/gtPlusPlus/xmod/gregtech/common/tileentities/generators/GregtechMetaTileEntityGeothermalGenerator.java @@ -5,6 +5,7 @@ import gregtech.api.GregTech_API; import gregtech.api.enums.ConfigCategories; import gregtech.api.enums.ItemList; import gregtech.api.enums.Textures; +import gregtech.api.gui.modularui.GT_UIInfos; import gregtech.api.interfaces.ITexture; import gregtech.api.interfaces.tileentity.IGregTechTileEntity; import gregtech.api.metatileentity.MetaTileEntity; @@ -46,10 +47,7 @@ public class GregtechMetaTileEntityGeothermalGenerator extends GT_MetaTileEntity @Override public boolean onRightclick(final IGregTechTileEntity aBaseMetaTileEntity, final EntityPlayer aPlayer) { - if (aBaseMetaTileEntity.isClientSide()) { - return true; - } - aBaseMetaTileEntity.openGUI(aPlayer); + GT_UIInfos.openGTTileEntityUI(aBaseMetaTileEntity, aPlayer); return true; } diff --git a/src/main/java/gtPlusPlus/xmod/gregtech/common/tileentities/generators/GregtechMetaTileEntitySolarGenerator.java b/src/main/java/gtPlusPlus/xmod/gregtech/common/tileentities/generators/GregtechMetaTileEntitySolarGenerator.java index 660fdb50b6..73c8f0adab 100644 --- a/src/main/java/gtPlusPlus/xmod/gregtech/common/tileentities/generators/GregtechMetaTileEntitySolarGenerator.java +++ b/src/main/java/gtPlusPlus/xmod/gregtech/common/tileentities/generators/GregtechMetaTileEntitySolarGenerator.java @@ -2,19 +2,22 @@ package gtPlusPlus.xmod.gregtech.common.tileentities.generators; import static gregtech.api.enums.GT_Values.V; +import com.gtnewhorizons.modularui.api.screen.ModularWindow; +import com.gtnewhorizons.modularui.api.screen.UIBuildContext; +import com.gtnewhorizons.modularui.common.widget.ProgressBar; import gregtech.api.GregTech_API; import gregtech.api.enums.ConfigCategories; +import gregtech.api.enums.SteamVariant; import gregtech.api.enums.Textures; +import gregtech.api.gui.modularui.GT_UITextures; +import gregtech.api.gui.modularui.GUITextureSet; import gregtech.api.interfaces.ITexture; import gregtech.api.interfaces.tileentity.IGregTechTileEntity; import gregtech.api.metatileentity.MetaTileEntity; import gregtech.api.objects.GT_RenderedTexture; import gtPlusPlus.api.objects.Logger; import gtPlusPlus.core.lib.CORE; -import gtPlusPlus.xmod.gregtech.api.gui.CONTAINER_SolarGenerator; -import gtPlusPlus.xmod.gregtech.api.gui.GUI_SolarGenerator; import gtPlusPlus.xmod.gregtech.api.metatileentity.implementations.base.generators.GregtechMetaSolarGenerator; -import net.minecraft.entity.player.InventoryPlayer; public class GregtechMetaTileEntitySolarGenerator extends GregtechMetaSolarGenerator { @@ -46,18 +49,6 @@ public class GregtechMetaTileEntitySolarGenerator extends GregtechMetaSolarGener } @Override - public Object getServerGUI( - final int aID, final InventoryPlayer aPlayerInventory, final IGregTechTileEntity aBaseMetaTileEntity) { - return new CONTAINER_SolarGenerator(aPlayerInventory, aBaseMetaTileEntity); - } - - @Override - public Object getClientGUI( - final int aID, final InventoryPlayer aPlayerInventory, final IGregTechTileEntity aBaseMetaTileEntity) { - return new GUI_SolarGenerator(aPlayerInventory, aBaseMetaTileEntity, "SolarBoiler.png"); - } - - @Override public MetaTileEntity newMetaEntity(final IGregTechTileEntity aTileEntity) { return new GregtechMetaTileEntitySolarGenerator(this.mName, this.mTier, this.mDescription, this.mTextures); } @@ -223,4 +214,67 @@ public class GregtechMetaTileEntitySolarGenerator extends GregtechMetaSolarGener super.getSidesActive(aColor)[0], new GT_RenderedTexture(Textures.BlockIcons.MACHINE_CASING_MAGIC_ACTIVE) }; } + + @Override + public SteamVariant getSteamVariant() { + return SteamVariant.BRONZE; + } + + @Override + public boolean useModularUI() { + return true; + } + + @Override + public void addUIWidgets(ModularWindow.Builder builder, UIBuildContext buildContext) { + builder.widget(new ProgressBar() + .setProgress(() -> (float) mProcessingEnergy / 1000) + .setTexture( + GT_UITextures.PROGRESSBAR_BOILER_EMPTY_STEAM.get(getSteamVariant()), + GT_UITextures.PROGRESSBAR_BOILER_STEAM, + 10) + .setDirection(ProgressBar.Direction.UP) + .setPos(70, 25) + .setSize(10, 54)) + .widget(new ProgressBar() + .setProgress(() -> (float) getBaseMetaTileEntity().getStoredEU()) + .setTexture( + GT_UITextures.PROGRESSBAR_BOILER_EMPTY_STEAM.get(getSteamVariant()), + GT_UITextures.PROGRESSBAR_BOILER_WATER, + 10) + .setDirection(ProgressBar.Direction.UP) + .setPos(83, 25) + .setSize(10, 54)) + .widget(new ProgressBar() + .setProgress(() -> (float) mSolarCharge / maxProgresstime()) + .setTexture( + GT_UITextures.PROGRESSBAR_BOILER_EMPTY_STEAM.get(getSteamVariant()), + GT_UITextures.PROGRESSBAR_BOILER_HEAT, + 10) + .setDirection(ProgressBar.Direction.UP) + .setPos(96, 25) + .setSize(10, 54)) + .widget(new ProgressBar() + .setProgress(() -> (float) mProcessingEnergy / 1000) + .setTexture(GT_UITextures.PROGRESSBAR_FUEL_STEAM.get(getSteamVariant()), 14) + .setDirection(ProgressBar.Direction.UP) + .setPos(116, 45) + .setSize(14, 14)); + } + + @Override + public GUITextureSet getGUITextureSet() { + return new GUITextureSet() + .setMainBackground(GT_UITextures.BACKGROUND_STEAM.get(getSteamVariant())) + .setItemSlot(GT_UITextures.SLOT_ITEM_STEAM.get(getSteamVariant())) + .setCoverTab( + GT_UITextures.TAB_COVER_STEAM_NORMAL.get(getSteamVariant()), + GT_UITextures.TAB_COVER_STEAM_HIGHLIGHT.get(getSteamVariant()), + GT_UITextures.TAB_COVER_STEAM_DISABLED.get(getSteamVariant())) + .setTitleTab( + GT_UITextures.TAB_TITLE_STEAM.getAdaptable(getSteamVariant()), + GT_UITextures.TAB_TITLE_DARK_STEAM.getAdaptable(getSteamVariant()), + GT_UITextures.TAB_TITLE_ANGULAR_STEAM.getAdaptable(getSteamVariant())) + .setGregTechLogo(GT_UITextures.PICTURE_GT_LOGO_17x17_TRANSPARENT_STEAM.get(getSteamVariant())); + } } diff --git a/src/main/java/gtPlusPlus/xmod/gregtech/common/tileentities/generators/creative/GregtechMetaCreativeEnergyBuffer.java b/src/main/java/gtPlusPlus/xmod/gregtech/common/tileentities/generators/creative/GregtechMetaCreativeEnergyBuffer.java index fb2af1cd44..9bfaa40972 100644 --- a/src/main/java/gtPlusPlus/xmod/gregtech/common/tileentities/generators/creative/GregtechMetaCreativeEnergyBuffer.java +++ b/src/main/java/gtPlusPlus/xmod/gregtech/common/tileentities/generators/creative/GregtechMetaCreativeEnergyBuffer.java @@ -21,7 +21,6 @@ import gtPlusPlus.xmod.gregtech.common.tileentities.storage.GregtechMetaEnergyBu import java.lang.reflect.Field; import java.lang.reflect.Modifier; import net.minecraft.entity.player.EntityPlayer; -import net.minecraft.entity.player.InventoryPlayer; import net.minecraft.item.ItemStack; import net.minecraft.nbt.NBTTagCompound; import net.minecraft.util.EnumChatFormatting; @@ -166,18 +165,6 @@ public class GregtechMetaCreativeEnergyBuffer extends GregtechMetaEnergyBuffer { } @Override - public Object getServerGUI( - final int aID, final InventoryPlayer aPlayerInventory, final IGregTechTileEntity aBaseMetaTileEntity) { - return null; - } - - @Override - public Object getClientGUI( - final int aID, final InventoryPlayer aPlayerInventory, final IGregTechTileEntity aBaseMetaTileEntity) { - return null; - } - - @Override public void onPostTick(final IGregTechTileEntity aBaseMetaTileEntity, final long aTick) { if (aBaseMetaTileEntity.isServerSide()) { aBaseMetaTileEntity.increaseStoredEnergyUnits(Integer.MAX_VALUE, true); diff --git a/src/main/java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/basic/GT_MetaTileEntity_CropHarvestor.java b/src/main/java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/basic/GT_MetaTileEntity_CropHarvestor.java index 417833a2ef..40425646c3 100644 --- a/src/main/java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/basic/GT_MetaTileEntity_CropHarvestor.java +++ b/src/main/java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/basic/GT_MetaTileEntity_CropHarvestor.java @@ -1,7 +1,15 @@ package gtPlusPlus.xmod.gregtech.common.tileentities.machines.basic; import com.gtnewhorizon.gtnhlib.util.map.ItemStackMap; +import com.gtnewhorizons.modularui.api.screen.ModularWindow; +import com.gtnewhorizons.modularui.api.screen.UIBuildContext; +import com.gtnewhorizons.modularui.common.widget.CycleButtonWidget; +import com.gtnewhorizons.modularui.common.widget.FakeSyncWidget; +import com.gtnewhorizons.modularui.common.widget.ProgressBar; +import com.gtnewhorizons.modularui.common.widget.SlotGroup; import gregtech.api.enums.*; +import gregtech.api.gui.modularui.GT_UIInfos; +import gregtech.api.gui.modularui.GT_UITextures; import gregtech.api.interfaces.ITexture; import gregtech.api.interfaces.tileentity.IGregTechTileEntity; import gregtech.api.metatileentity.MetaTileEntity; @@ -12,7 +20,7 @@ import gtPlusPlus.api.objects.Logger; import gtPlusPlus.core.lib.CORE; import gtPlusPlus.core.util.math.MathUtils; import gtPlusPlus.core.util.minecraft.ItemUtils; -import gtPlusPlus.xmod.gregtech.api.gui.basic.*; +import gtPlusPlus.xmod.gregtech.api.gui.GTPP_UITextures; import gtPlusPlus.xmod.gregtech.common.blocks.textures.TexturesGtBlock; import ic2.api.crops.*; import ic2.core.item.DamageHandler; @@ -25,8 +33,6 @@ import net.minecraft.tileentity.TileEntity; public class GT_MetaTileEntity_CropHarvestor extends GT_MetaTileEntity_BasicTank { - protected String mLocalName; - private static final int SLOT_WEEDEX_1 = 1; private static final int SLOT_WEEDEX_2 = 2; private static final int SLOT_FERT_1 = 3; @@ -43,25 +49,11 @@ public class GT_MetaTileEntity_CropHarvestor extends GT_MetaTileEntity_BasicTank aTier, 21, aDescription); - this.mLocalName = "Crop Manager (" + GT_Values.VN[aTier] + ")"; } public GT_MetaTileEntity_CropHarvestor( final String aName, final int aTier, final String aDescription, final ITexture[][][] aTextures) { super(aName, aTier, 21, aDescription, aTextures); - this.mLocalName = "Crop Manager (" + GT_Values.VN[aTier] + ")"; - } - - @Override - public Object getServerGUI( - final int aID, final InventoryPlayer aPlayerInventory, final IGregTechTileEntity aBaseMetaTileEntity) { - return new GT_Container_CropHarvestor(aPlayerInventory, aBaseMetaTileEntity); - } - - @Override - public Object getClientGUI( - final int aID, final InventoryPlayer aPlayerInventory, final IGregTechTileEntity aBaseMetaTileEntity) { - return new GT_GUIContainer_CropHarvestor(aPlayerInventory, aBaseMetaTileEntity, this.mLocalName); } @Override @@ -131,10 +123,7 @@ public class GT_MetaTileEntity_CropHarvestor extends GT_MetaTileEntity_BasicTank @Override public boolean onRightclick(final IGregTechTileEntity aBaseMetaTileEntity, final EntityPlayer aPlayer) { - if (aBaseMetaTileEntity.isClientSide()) { - return true; - } - aBaseMetaTileEntity.openGUI(aPlayer); + GT_UIInfos.openGTTileEntityUI(aBaseMetaTileEntity, aPlayer); return true; } @@ -683,4 +672,55 @@ public class GT_MetaTileEntity_CropHarvestor extends GT_MetaTileEntity_BasicTank super.loadNBTData(aNBT); this.mModeAlternative = aNBT.getBoolean("mModeAlternative"); } + + @Override + public boolean useModularUI() { + return true; + } + + @Override + public void addUIWidgets(ModularWindow.Builder builder, UIBuildContext buildContext) { + builder.widget(new CycleButtonWidget() + .setToggle(() -> mModeAlternative, val -> mModeAlternative = val) + .setTexture(GTPP_UITextures.OVERLAY_BUTTON_HARVESTER_MODE) + .addTooltip(0, "Enable Hydration/Fertilizing/Weed-EX") + .addTooltip(1, "Disable Hydration/Fertilizing/Weed-EX") + .setBackground(GT_UITextures.BUTTON_STANDARD) + .setPos(47, 63) + .setSize(18, 18)); + builder.widget(SlotGroup.ofItemHandler(inventoryHandler, 2) + .startFromSlot(SLOT_WEEDEX_1) + .endAtSlot(SLOT_WEEDEX_2) + .applyForWidget(widget -> widget.setFilter(stack -> stack != null + && stack.getItem().getUnlocalizedName().equals("ic2.itemWeedEx")) + .setBackground(getGUITextureSet().getItemSlot(), GTPP_UITextures.OVERLAY_SLOT_WEED_EX)) + .build() + .setPos(7, 13)) + .widget(SlotGroup.ofItemHandler(inventoryHandler, 2) + .startFromSlot(SLOT_FERT_1) + .endAtSlot(SLOT_FERT_4) + .applyForWidget(widget -> widget.setFilter(stack -> stack != null + && stack.getItem().getUnlocalizedName().equals("ic2.itemFertilizer")) + .setBackground( + getGUITextureSet().getItemSlot(), GTPP_UITextures.OVERLAY_SLOT_FERTILIZER)) + .build() + .setPos(7, 31)) + .widget(SlotGroup.ofItemHandler(inventoryHandler, 6) + .startFromSlot(SLOT_OUTPUT_START) + .endAtSlot(SLOT_OUTPUT_START + 6 * 3) + .canInsert(false) + .build() + .setPos(61, 7)); + builder.widget(new ProgressBar() + .setTexture( + GTPP_UITextures.PROGRESSBAR_BOILER_EMPTY, GT_UITextures.PROGRESSBAR_BOILER_WATER, 54) + .setDirection(ProgressBar.Direction.UP) + .setProgress(() -> (float) getFluidAmount() / getCapacity()) + .setSynced(false, false) + .dynamicTooltip(() -> + Collections.singletonList("Water: " + getFluidAmount() + "L / " + getCapacity() + "L")) + .setPos(47, 7) + .setSize(10, 54)) + .widget(new FakeSyncWidget.FluidStackSyncer(this::getDrainableStack, this::setDrainableStack)); + } } diff --git a/src/main/java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/basic/GregtechMetaAtmosphericReconditioner.java b/src/main/java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/basic/GregtechMetaAtmosphericReconditioner.java index 23263bd9fd..19994896e8 100644 --- a/src/main/java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/basic/GregtechMetaAtmosphericReconditioner.java +++ b/src/main/java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/basic/GregtechMetaAtmosphericReconditioner.java @@ -2,9 +2,15 @@ package gtPlusPlus.xmod.gregtech.common.tileentities.machines.basic; import static gregtech.api.enums.GT_Values.V; +import com.gtnewhorizons.modularui.api.screen.ModularWindow; +import com.gtnewhorizons.modularui.api.screen.UIBuildContext; +import com.gtnewhorizons.modularui.common.widget.DrawableWidget; +import com.gtnewhorizons.modularui.common.widget.FakeSyncWidget; +import com.gtnewhorizons.modularui.common.widget.SlotWidget; import gregtech.api.GregTech_API; import gregtech.api.enums.Materials; import gregtech.api.enums.Textures; +import gregtech.api.gui.modularui.GT_UITextures; import gregtech.api.interfaces.ITexture; import gregtech.api.interfaces.tileentity.IGregTechTileEntity; import gregtech.api.items.GT_MetaGenerated_Tool; @@ -19,15 +25,16 @@ import gtPlusPlus.api.objects.Logger; import gtPlusPlus.api.objects.data.AutoMap; import gtPlusPlus.core.item.general.ItemAirFilter; import gtPlusPlus.core.item.general.ItemBasicScrubberTurbine; +import gtPlusPlus.core.recipe.common.CI; import gtPlusPlus.core.util.Utils; import gtPlusPlus.core.util.math.MathUtils; import gtPlusPlus.core.util.minecraft.PlayerUtils; import gtPlusPlus.core.util.minecraft.gregtech.PollutionUtils; -import gtPlusPlus.xmod.gregtech.api.gui.basic.CONTAINER_PollutionCleaner; -import gtPlusPlus.xmod.gregtech.api.gui.basic.GUI_PollutionCleaner; +import gtPlusPlus.xmod.gregtech.api.gui.GTPP_UITextures; import gtPlusPlus.xmod.gregtech.common.blocks.textures.TexturesGtBlock; +import java.util.Collections; +import java.util.HashMap; import net.minecraft.entity.player.EntityPlayer; -import net.minecraft.entity.player.InventoryPlayer; import net.minecraft.item.ItemStack; import net.minecraft.nbt.NBTTagCompound; import net.minecraft.world.World; @@ -46,6 +53,14 @@ public class GregtechMetaAtmosphericReconditioner extends GT_MetaTileEntity_Basi protected boolean mSaveRotor = false; + private static final HashMap<Byte, ItemStack> mConveyorMap = new HashMap<>(); + + static { + for (byte i = 0; i < 9; i++) { + mConveyorMap.put(i, CI.getConveyor(i, 1)); + } + } + public GregtechMetaAtmosphericReconditioner(int aID, String aName, String aNameRegional, int aTier) { super( aID, @@ -713,18 +728,6 @@ public class GregtechMetaAtmosphericReconditioner extends GT_MetaTileEntity_Basi } @Override - public Object getServerGUI( - final int aID, final InventoryPlayer aPlayerInventory, final IGregTechTileEntity aBaseMetaTileEntity) { - return new CONTAINER_PollutionCleaner(aPlayerInventory, aBaseMetaTileEntity); - } - - @Override - public Object getClientGUI( - final int aID, final InventoryPlayer aPlayerInventory, final IGregTechTileEntity aBaseMetaTileEntity) { - return new GUI_PollutionCleaner(aPlayerInventory, aBaseMetaTileEntity, this.getLocalName(), this.mGUIName); - } - - @Override public boolean canInsertItem(int aIndex, ItemStack aStack, int aSide) { if (aIndex == SLOT_FILTER) { if (aStack.getItem() instanceof ItemAirFilter) { @@ -893,4 +896,40 @@ public class GregtechMetaAtmosphericReconditioner extends GT_MetaTileEntity_Basi * GT_MetaGenerated_Tool.getPrimaryMaterial(aStackRotor).mToolSpeed * 50); } + + @Override + public boolean useModularUI() { + return true; + } + + @Override + public void addUIWidgets(ModularWindow.Builder builder, UIBuildContext buildContext) { + builder.widget(new SlotWidget(inventoryHandler, SLOT_ROTOR) + .setFilter(stack -> { + if (stack.getItem() instanceof ItemBasicScrubberTurbine) { + return true; + } + return stack.getItem() instanceof GT_MetaGenerated_Tool + && stack.getItemDamage() >= 170 + && stack.getItemDamage() <= 179; + }) + .setBackground(getGUITextureSet().getItemSlot(), GTPP_UITextures.OVERLAY_SLOT_TURBINE) + .setPos(52, 24)) + .widget(new SlotWidget(inventoryHandler, SLOT_FILTER) + .setFilter(stack -> stack.getItem() instanceof ItemAirFilter) + .setBackground(getGUITextureSet().getItemSlot(), GT_UITextures.OVERLAY_SLOT_RECYCLE) + .setPos(106, 24)) + .widget(new SlotWidget(inventoryHandler, 7) + .setFilter(stack -> GT_Utility.areStacksEqual(stack, mConveyorMap.get(mTier), true)) + .setPos(124, 62)); + builder.widget(new DrawableWidget() + .setDrawable(GT_UITextures.PICTURE_INFORMATION) + .dynamicTooltip(() -> Collections.singletonList("Reduction: " + mPollutionReduction + "/s")) + .attachSyncer( + new FakeSyncWidget.IntegerSyncer(() -> mPollutionReduction, val -> mPollutionReduction = val), + builder, + (widget, val) -> widget.notifyTooltipChange()) + .setPos(163, 5) + .setSize(7, 18)); + } } diff --git a/src/main/java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/basic/GregtechMetaCondensor.java b/src/main/java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/basic/GregtechMetaCondensor.java index 531c7c5694..17edfd0d4d 100644 --- a/src/main/java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/basic/GregtechMetaCondensor.java +++ b/src/main/java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/basic/GregtechMetaCondensor.java @@ -1,8 +1,15 @@ package gtPlusPlus.xmod.gregtech.common.tileentities.machines.basic; +import com.gtnewhorizons.modularui.api.screen.ModularWindow; +import com.gtnewhorizons.modularui.api.screen.UIBuildContext; +import com.gtnewhorizons.modularui.common.widget.DrawableWidget; +import com.gtnewhorizons.modularui.common.widget.ProgressBar; +import com.gtnewhorizons.modularui.common.widget.SlotWidget; import gregtech.api.enums.Dyes; import gregtech.api.enums.Textures; +import gregtech.api.gui.modularui.GT_UITextures; import gregtech.api.interfaces.ITexture; +import gregtech.api.interfaces.modularui.IAddGregtechLogo; import gregtech.api.interfaces.tileentity.IGregTechTileEntity; import gregtech.api.metatileentity.MetaTileEntity; import gregtech.api.objects.GT_RenderedTexture; @@ -10,15 +17,13 @@ import gregtech.api.util.GT_ModHandler; import gtPlusPlus.core.lib.CORE; import gtPlusPlus.core.util.Utils; import gtPlusPlus.core.util.math.MathUtils; -import gtPlusPlus.xmod.gregtech.api.gui.CONTAINER_SteamCondenser; -import gtPlusPlus.xmod.gregtech.api.gui.GUI_SteamCondenser; +import gtPlusPlus.xmod.gregtech.api.gui.GTPP_UITextures; import gtPlusPlus.xmod.gregtech.api.metatileentity.implementations.base.generators.GregtechMetaBoilerBase; -import net.minecraft.entity.player.InventoryPlayer; import net.minecraftforge.common.util.ForgeDirection; import net.minecraftforge.fluids.FluidStack; import net.minecraftforge.fluids.IFluidHandler; -public class GregtechMetaCondensor extends GregtechMetaBoilerBase { +public class GregtechMetaCondensor extends GregtechMetaBoilerBase implements IAddGregtechLogo { public GregtechMetaCondensor(final int aID, final String aName, final String aNameRegional) { super(aID, aName, aNameRegional, "A Steam condenser - [IC2->Steam]", new ITexture[0]); @@ -77,18 +82,6 @@ public class GregtechMetaCondensor extends GregtechMetaBoilerBase { } @Override - public Object getServerGUI( - final int aID, final InventoryPlayer aPlayerInventory, final IGregTechTileEntity aBaseMetaTileEntity) { - return new CONTAINER_SteamCondenser(aPlayerInventory, aBaseMetaTileEntity); - } - - @Override - public Object getClientGUI( - final int aID, final InventoryPlayer aPlayerInventory, final IGregTechTileEntity aBaseMetaTileEntity) { - return new GUI_SteamCondenser(aPlayerInventory, aBaseMetaTileEntity, "SteelBoiler.png"); - } - - @Override public MetaTileEntity newMetaEntity(final IGregTechTileEntity aTileEntity) { return new GregtechMetaCondensor(this.mName, this.mTier, this.mDescription, this.mTextures); } @@ -177,4 +170,60 @@ public class GregtechMetaCondensor extends GregtechMetaBoilerBase { } return super.fill(aFluid, doFill); } + + @Override + public boolean useModularUI() { + return true; + } + + @Override + public void addGregTechLogo(ModularWindow.Builder builder) {} + + @Override + public void addUIWidgets(ModularWindow.Builder builder, UIBuildContext buildContext) { + builder.widget(new SlotWidget(inventoryHandler, 0) + .setPos(43, 25) + .setBackground(getGUITextureSet().getItemSlot(), GT_UITextures.OVERLAY_SLOT_IN)) + .widget(new SlotWidget(inventoryHandler, 1) + .setPos(43, 61) + .setBackground(getGUITextureSet().getItemSlot(), GT_UITextures.OVERLAY_SLOT_OUT)) + .widget(new SlotWidget(inventoryHandler, 2) + .setPos(115, 61) + .setBackground(getGUITextureSet().getItemSlot(), GTPP_UITextures.OVERLAY_SLOT_COAL)) + .widget(new SlotWidget(inventoryHandler, 3) + .setPos(115, 25) + .setBackground(getGUITextureSet().getItemSlot(), GT_UITextures.OVERLAY_SLOT_DUST)) + .widget(new ProgressBar() + .setProgress(() -> mSteam == null ? 0 : (float) mSteam.amount / getCapacity()) + .setTexture( + GTPP_UITextures.PROGRESSBAR_BOILER_EMPTY, GT_UITextures.PROGRESSBAR_BOILER_STEAM, 10) + .setDirection(ProgressBar.Direction.UP) + .setPos(70, 25) + .setSize(10, 54)) + .widget(new ProgressBar() + .setProgress(() -> mFluid == null ? 0 : (float) mFluid.amount / getCapacity()) + .setTexture( + GTPP_UITextures.PROGRESSBAR_BOILER_EMPTY, GT_UITextures.PROGRESSBAR_BOILER_WATER, 10) + .setDirection(ProgressBar.Direction.UP) + .setPos(83, 25) + .setSize(10, 54)) + .widget(new ProgressBar() + .setProgress(() -> (float) mTemperature / maxProgresstime()) + .setTexture(GTPP_UITextures.PROGRESSBAR_BOILER_EMPTY, GT_UITextures.PROGRESSBAR_BOILER_HEAT, 10) + .setDirection(ProgressBar.Direction.UP) + .setPos(96, 25) + .setSize(10, 54)) + .widget(new ProgressBar() + // cap minimum so that one can easily see there's fuel remaining + .setProgress( + () -> mProcessingEnergy > 0 ? Math.max((float) mProcessingEnergy / 1000, 1f / 5) : 0) + .setTexture(GTPP_UITextures.PROGRESSBAR_FUEL, 14) + .setDirection(ProgressBar.Direction.UP) + .setPos(116, 45) + .setSize(14, 14)) + .widget(new DrawableWidget() + .setDrawable(GTPP_UITextures.OVERLAY_SLOT_CANISTER_DARK) + .setPos(43, 43) + .setSize(18, 18)); + } } diff --git a/src/main/java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/basic/GregtechMetaTileEntity_ChemicalReactor.java b/src/main/java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/basic/GregtechMetaTileEntity_ChemicalReactor.java index 2ae5e1e54a..b8df5ae9ff 100644 --- a/src/main/java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/basic/GregtechMetaTileEntity_ChemicalReactor.java +++ b/src/main/java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/basic/GregtechMetaTileEntity_ChemicalReactor.java @@ -10,11 +10,8 @@ import gregtech.api.util.GT_Recipe; import gregtech.api.util.GT_Utility; import gtPlusPlus.core.lib.CORE; import gtPlusPlus.core.slots.SlotChemicalPlantInput; -import gtPlusPlus.xmod.gregtech.api.gui.fluidreactor.Container_FluidReactor; -import gtPlusPlus.xmod.gregtech.api.gui.fluidreactor.GUI_FluidReactor; import gtPlusPlus.xmod.gregtech.common.blocks.textures.TexturesGtBlock; import java.util.List; -import net.minecraft.entity.player.InventoryPlayer; import net.minecraft.item.ItemStack; import net.minecraft.nbt.NBTTagCompound; import net.minecraft.tileentity.TileEntity; @@ -83,29 +80,6 @@ public class GregtechMetaTileEntity_ChemicalReactor extends GT_MetaTileEntity_Ba } @Override - public Object getServerGUI(int aID, InventoryPlayer aPlayerInventory, IGregTechTileEntity aBaseMetaTileEntity) { - try { - Container_FluidReactor y = new Container_FluidReactor(aPlayerInventory, aBaseMetaTileEntity); - return y; - } catch (Throwable t) { - t.printStackTrace(); - } - return null; - } - - @Override - public Object getClientGUI(int aID, InventoryPlayer aPlayerInventory, IGregTechTileEntity aBaseMetaTileEntity) { - return new GUI_FluidReactor( - aPlayerInventory, - aBaseMetaTileEntity, - this.getLocalName(), - this.mGUIName, - GT_Utility.isStringValid(this.mNEIName) - ? this.mNEIName - : (this.getRecipeList() != null ? this.getRecipeList().mUnlocalizedName : "")); - } - - @Override public GT_Recipe.GT_Recipe_Map getRecipeList() { return null; } diff --git a/src/main/java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/basic/GregtechMetaTileEntity_CompactFusionReactor.java b/src/main/java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/basic/GregtechMetaTileEntity_CompactFusionReactor.java index eb52042b9b..39c6bb53dd 100644 --- a/src/main/java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/basic/GregtechMetaTileEntity_CompactFusionReactor.java +++ b/src/main/java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/basic/GregtechMetaTileEntity_CompactFusionReactor.java @@ -17,7 +17,6 @@ import gtPlusPlus.xmod.gregtech.common.blocks.textures.TexturesGtBlock; import java.util.ArrayList; import java.util.Random; import net.minecraft.entity.player.EntityPlayer; -import net.minecraft.entity.player.InventoryPlayer; import net.minecraft.item.ItemStack; import net.minecraft.nbt.NBTTagCompound; import net.minecraftforge.common.util.ForgeDirection; @@ -681,18 +680,6 @@ public class GregtechMetaTileEntity_CompactFusionReactor extends GT_MetaTileEnti } @Override - public Object getServerGUI(int aID, InventoryPlayer aPlayerInventory, IGregTechTileEntity aBaseMetaTileEntity) { - // TODO Auto-generated method stub - return super.getServerGUI(aID, aPlayerInventory, aBaseMetaTileEntity); - } - - @Override - public void onScrewdriverRightClick(byte aSide, EntityPlayer aPlayer, float aX, float aY, float aZ) { - // TODO Auto-generated method stub - super.onScrewdriverRightClick(aSide, aPlayer, aX, aY, aZ); - } - - @Override public boolean allowPutStack(IGregTechTileEntity aBaseMetaTileEntity, int aIndex, byte aSide, ItemStack aStack) { return false; } diff --git a/src/main/java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/basic/GregtechMetaTileEntity_PocketFusion.java b/src/main/java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/basic/GregtechMetaTileEntity_PocketFusion.java index 08c9934db8..6ac99404ed 100644 --- a/src/main/java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/basic/GregtechMetaTileEntity_PocketFusion.java +++ b/src/main/java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/basic/GregtechMetaTileEntity_PocketFusion.java @@ -18,7 +18,6 @@ import gtPlusPlus.xmod.gregtech.common.blocks.textures.TexturesGtBlock; import java.util.ArrayList; import java.util.Random; import net.minecraft.entity.player.EntityPlayer; -import net.minecraft.entity.player.InventoryPlayer; import net.minecraft.item.ItemStack; import net.minecraft.nbt.NBTTagCompound; import net.minecraftforge.common.util.ForgeDirection; @@ -685,18 +684,6 @@ public class GregtechMetaTileEntity_PocketFusion extends GT_MetaTileEntity_Delux } @Override - public Object getServerGUI(int aID, InventoryPlayer aPlayerInventory, IGregTechTileEntity aBaseMetaTileEntity) { - // TODO Auto-generated method stub - return super.getServerGUI(aID, aPlayerInventory, aBaseMetaTileEntity); - } - - @Override - public void onScrewdriverRightClick(byte aSide, EntityPlayer aPlayer, float aX, float aY, float aZ) { - // TODO Auto-generated method stub - super.onScrewdriverRightClick(aSide, aPlayer, aX, aY, aZ); - } - - @Override public boolean allowPutStack(IGregTechTileEntity aBaseMetaTileEntity, int aIndex, byte aSide, ItemStack aStack) { return false; } diff --git a/src/main/java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/misc/GMTE_AmazonPackager.java b/src/main/java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/misc/GMTE_AmazonPackager.java index 286a76f11b..4030f7cc11 100644 --- a/src/main/java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/misc/GMTE_AmazonPackager.java +++ b/src/main/java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/misc/GMTE_AmazonPackager.java @@ -62,16 +62,6 @@ public class GMTE_AmazonPackager extends GregtechMeta_MultiBlockBase<GMTE_Amazon } @Override - public boolean hasSlotInGUI() { - return true; - } - - @Override - public String getCustomGUIResourceName() { - return "Generic3By3"; - } - - @Override public IStructureDefinition<GMTE_AmazonPackager> getStructureDefinition() { if (STRUCTURE_DEFINITION == null) { STRUCTURE_DEFINITION = StructureDefinition.<GMTE_AmazonPackager>builder() diff --git a/src/main/java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/misc/GregtechMTE_TeslaTower.java b/src/main/java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/misc/GregtechMTE_TeslaTower.java index 8b8d12dbd5..1805c3dba4 100644 --- a/src/main/java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/misc/GregtechMTE_TeslaTower.java +++ b/src/main/java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/misc/GregtechMTE_TeslaTower.java @@ -75,16 +75,6 @@ public class GregtechMTE_TeslaTower extends GregtechMeta_MultiBlockBase<Gregtech return "Weaponized Lighting Rod"; } - @Override - public boolean hasSlotInGUI() { - return false; - } - - @Override - public String getCustomGUIResourceName() { - return null; - } - /*@Override public String[] getTooltip() { String casings = getCasingBlockItem().get(0).getDisplayName(); @@ -513,4 +503,9 @@ public class GregtechMTE_TeslaTower extends GregtechMeta_MultiBlockBase<Gregtech // TODO Auto-generated method stub return null; } + + @Override + public boolean doesBindPlayerInventory() { + return false; + } } diff --git a/src/main/java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/processing/GregtechMetaTileEntity_IndustrialAlloySmelter.java b/src/main/java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/processing/GregtechMetaTileEntity_IndustrialAlloySmelter.java index cf0ac58ec8..2100ec132a 100644 --- a/src/main/java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/processing/GregtechMetaTileEntity_IndustrialAlloySmelter.java +++ b/src/main/java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/processing/GregtechMetaTileEntity_IndustrialAlloySmelter.java @@ -15,7 +15,6 @@ import com.gtnewhorizon.structurelib.structure.StructureDefinition; import gregtech.api.enums.HeatingCoilLevel; import gregtech.api.enums.TAE; import gregtech.api.enums.Textures; -import gregtech.api.gui.GT_GUIContainer_MultiMachine; import gregtech.api.interfaces.IIconContainer; import gregtech.api.interfaces.metatileentity.IMetaTileEntity; import gregtech.api.interfaces.tileentity.IGregTechTileEntity; @@ -29,7 +28,6 @@ import gtPlusPlus.core.lib.CORE; import gtPlusPlus.xmod.gregtech.api.metatileentity.implementations.base.GregtechMeta_MultiBlockBase; import java.util.ArrayList; import java.util.List; -import net.minecraft.entity.player.InventoryPlayer; import net.minecraft.item.ItemStack; import net.minecraftforge.fluids.FluidStack; import org.apache.commons.lang3.ArrayUtils; @@ -73,11 +71,6 @@ public class GregtechMetaTileEntity_IndustrialAlloySmelter return CASING_TEXTURE_ID; } - public Object getClientGUI(int aID, InventoryPlayer aPlayerInventory, IGregTechTileEntity aBaseMetaTileEntity) { - return new GT_GUIContainer_MultiMachine( - aPlayerInventory, aBaseMetaTileEntity, getLocalName(), "MultiFurnace.png"); - } - public GT_Recipe.GT_Recipe_Map getRecipeMap() { return GT_Recipe.GT_Recipe_Map.sAlloySmelterRecipes; } @@ -103,16 +96,6 @@ public class GregtechMetaTileEntity_IndustrialAlloySmelter } @Override - public boolean hasSlotInGUI() { - return false; - } - - @Override - public String getCustomGUIResourceName() { - return null; - } - - @Override public String getMachineType() { return "Alloy Smelter"; } diff --git a/src/main/java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/processing/GregtechMetaTileEntity_IndustrialArcFurnace.java b/src/main/java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/processing/GregtechMetaTileEntity_IndustrialArcFurnace.java index 48ad4eb7cd..2d9574a315 100644 --- a/src/main/java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/processing/GregtechMetaTileEntity_IndustrialArcFurnace.java +++ b/src/main/java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/processing/GregtechMetaTileEntity_IndustrialArcFurnace.java @@ -195,16 +195,6 @@ public class GregtechMetaTileEntity_IndustrialArcFurnace } @Override - public boolean hasSlotInGUI() { - return false; - } - - @Override - public String getCustomGUIResourceName() { - return "IndustrialExtruder"; - } - - @Override public GT_Recipe.GT_Recipe_Map getRecipeMap() { return mPlasmaMode ? GT_Recipe.GT_Recipe_Map.sPlasmaArcFurnaceRecipes diff --git a/src/main/java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/processing/GregtechMetaTileEntity_IndustrialCentrifuge.java b/src/main/java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/processing/GregtechMetaTileEntity_IndustrialCentrifuge.java index 77766449cc..cf41c87018 100644 --- a/src/main/java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/processing/GregtechMetaTileEntity_IndustrialCentrifuge.java +++ b/src/main/java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/processing/GregtechMetaTileEntity_IndustrialCentrifuge.java @@ -144,16 +144,6 @@ public class GregtechMetaTileEntity_IndustrialCentrifuge } @Override - public boolean hasSlotInGUI() { - return false; - } - - @Override - public String getCustomGUIResourceName() { - return "IndustrialCentrifuge"; - } - - @Override public GT_Recipe.GT_Recipe_Map getRecipeMap() { return GTPP_Recipe.GTPP_Recipe_Map.sMultiblockCentrifugeRecipes_GT; } diff --git a/src/main/java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/processing/GregtechMetaTileEntity_IndustrialChisel.java b/src/main/java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/processing/GregtechMetaTileEntity_IndustrialChisel.java index 64a57a24e1..1f12e10fca 100644 --- a/src/main/java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/processing/GregtechMetaTileEntity_IndustrialChisel.java +++ b/src/main/java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/processing/GregtechMetaTileEntity_IndustrialChisel.java @@ -133,21 +133,6 @@ public class GregtechMetaTileEntity_IndustrialChisel return 90; } - @Override - public boolean hasSlotInGUI() { - return true; - } - - @Override - public String getCustomGUIResourceName() { - return "ImplosionCompressor"; - } - - @Override - public boolean requiresVanillaGtGUI() { - return true; - } - public GT_Recipe.GT_Recipe_Map getRecipeMap() { return null; } diff --git a/src/main/java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/processing/GregtechMetaTileEntity_IndustrialCokeOven.java b/src/main/java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/processing/GregtechMetaTileEntity_IndustrialCokeOven.java index d2828aa880..95a0024284 100644 --- a/src/main/java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/processing/GregtechMetaTileEntity_IndustrialCokeOven.java +++ b/src/main/java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/processing/GregtechMetaTileEntity_IndustrialCokeOven.java @@ -168,16 +168,6 @@ public class GregtechMetaTileEntity_IndustrialCokeOven } @Override - public boolean hasSlotInGUI() { - return false; - } - - @Override - public String getCustomGUIResourceName() { - return "CokeOven"; - } - - @Override public GT_Recipe.GT_Recipe_Map getRecipeMap() { return GTPP_Recipe.GTPP_Recipe_Map.sCokeOvenRecipes; } diff --git a/src/main/java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/processing/GregtechMetaTileEntity_IndustrialCuttingMachine.java b/src/main/java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/processing/GregtechMetaTileEntity_IndustrialCuttingMachine.java index 23abe86ee1..9f1ba02076 100644 --- a/src/main/java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/processing/GregtechMetaTileEntity_IndustrialCuttingMachine.java +++ b/src/main/java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/processing/GregtechMetaTileEntity_IndustrialCuttingMachine.java @@ -133,16 +133,6 @@ public class GregtechMetaTileEntity_IndustrialCuttingMachine } @Override - public boolean hasSlotInGUI() { - return false; - } - - @Override - public String getCustomGUIResourceName() { - return "IndustrialCuttingMachine"; - } - - @Override public GT_Recipe.GT_Recipe_Map getRecipeMap() { return mCuttingMode ? GT_Recipe.GT_Recipe_Map.sCutterRecipes : GT_Recipe.GT_Recipe_Map.sSlicerRecipes; } diff --git a/src/main/java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/processing/GregtechMetaTileEntity_IndustrialDehydrator.java b/src/main/java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/processing/GregtechMetaTileEntity_IndustrialDehydrator.java index f6d9de7345..d29c9d13e8 100644 --- a/src/main/java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/processing/GregtechMetaTileEntity_IndustrialDehydrator.java +++ b/src/main/java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/processing/GregtechMetaTileEntity_IndustrialDehydrator.java @@ -169,11 +169,6 @@ public class GregtechMetaTileEntity_IndustrialDehydrator } @Override - public boolean hasSlotInGUI() { - return true; - } - - @Override public String getMachineType() { return "Vacuum Furnace / Dehydrator"; } @@ -188,16 +183,6 @@ public class GregtechMetaTileEntity_IndustrialDehydrator return 50; } - @Override - public boolean requiresVanillaGtGUI() { - return true; - } - - @Override - public String getCustomGUIResourceName() { - return "ElectricBlastFurnace"; - } - public boolean checkRecipe(ItemStack aStack) { return checkRecipeGeneric(getMaxParallelRecipes(), getEuDiscountForParallelism(), 120); } diff --git a/src/main/java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/processing/GregtechMetaTileEntity_IndustrialElectrolyzer.java b/src/main/java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/processing/GregtechMetaTileEntity_IndustrialElectrolyzer.java index 95130a4218..00cb08ec32 100644 --- a/src/main/java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/processing/GregtechMetaTileEntity_IndustrialElectrolyzer.java +++ b/src/main/java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/processing/GregtechMetaTileEntity_IndustrialElectrolyzer.java @@ -128,16 +128,6 @@ public class GregtechMetaTileEntity_IndustrialElectrolyzer } @Override - public boolean hasSlotInGUI() { - return false; - } - - @Override - public String getCustomGUIResourceName() { - return "IndustrialElectrolyzer"; - } - - @Override public GT_Recipe.GT_Recipe_Map getRecipeMap() { return gregtech.api.util.GTPP_Recipe.GTPP_Recipe_Map.sMultiblockElectrolyzerRecipes_GT; } diff --git a/src/main/java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/processing/GregtechMetaTileEntity_IndustrialExtruder.java b/src/main/java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/processing/GregtechMetaTileEntity_IndustrialExtruder.java index ba69ebed0a..972f180321 100644 --- a/src/main/java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/processing/GregtechMetaTileEntity_IndustrialExtruder.java +++ b/src/main/java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/processing/GregtechMetaTileEntity_IndustrialExtruder.java @@ -137,16 +137,6 @@ public class GregtechMetaTileEntity_IndustrialExtruder } @Override - public boolean hasSlotInGUI() { - return false; - } - - @Override - public String getCustomGUIResourceName() { - return "IndustrialExtruder"; - } - - @Override public GT_Recipe.GT_Recipe_Map getRecipeMap() { return GT_Recipe.GT_Recipe_Map.sExtruderRecipes; } diff --git a/src/main/java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/processing/GregtechMetaTileEntity_IndustrialFluidHeater.java b/src/main/java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/processing/GregtechMetaTileEntity_IndustrialFluidHeater.java index 7f22ee5057..a4e5b15b61 100644 --- a/src/main/java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/processing/GregtechMetaTileEntity_IndustrialFluidHeater.java +++ b/src/main/java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/processing/GregtechMetaTileEntity_IndustrialFluidHeater.java @@ -143,16 +143,6 @@ public class GregtechMetaTileEntity_IndustrialFluidHeater } @Override - public boolean hasSlotInGUI() { - return false; - } - - @Override - public String getCustomGUIResourceName() { - return "IndustrialThermalCentrifuge"; - } - - @Override public GT_Recipe.GT_Recipe_Map getRecipeMap() { return GT_Recipe.GT_Recipe_Map.sFluidHeaterRecipes; } diff --git a/src/main/java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/processing/GregtechMetaTileEntity_IndustrialForgeHammer.java b/src/main/java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/processing/GregtechMetaTileEntity_IndustrialForgeHammer.java index e37d473f05..ea3402efb6 100644 --- a/src/main/java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/processing/GregtechMetaTileEntity_IndustrialForgeHammer.java +++ b/src/main/java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/processing/GregtechMetaTileEntity_IndustrialForgeHammer.java @@ -168,16 +168,6 @@ public class GregtechMetaTileEntity_IndustrialForgeHammer } @Override - public boolean hasSlotInGUI() { - return false; - } - - @Override - public String getCustomGUIResourceName() { - return "MaterialPress"; - } - - @Override public GT_Recipe.GT_Recipe_Map getRecipeMap() { return GT_Recipe.GT_Recipe_Map.sHammerRecipes; } diff --git a/src/main/java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/processing/GregtechMetaTileEntity_IndustrialMacerator.java b/src/main/java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/processing/GregtechMetaTileEntity_IndustrialMacerator.java index 68241f7001..5aa487344a 100644 --- a/src/main/java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/processing/GregtechMetaTileEntity_IndustrialMacerator.java +++ b/src/main/java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/processing/GregtechMetaTileEntity_IndustrialMacerator.java @@ -187,16 +187,6 @@ public class GregtechMetaTileEntity_IndustrialMacerator } @Override - public boolean hasSlotInGUI() { - return false; - } - - @Override - public String getCustomGUIResourceName() { - return "MacerationStack"; - } - - @Override public GT_Recipe.GT_Recipe_Map getRecipeMap() { return GT_Recipe.GT_Recipe_Map.sMaceratorRecipes; } diff --git a/src/main/java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/processing/GregtechMetaTileEntity_IndustrialMixer.java b/src/main/java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/processing/GregtechMetaTileEntity_IndustrialMixer.java index 60898f1dc9..2e687e1e25 100644 --- a/src/main/java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/processing/GregtechMetaTileEntity_IndustrialMixer.java +++ b/src/main/java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/processing/GregtechMetaTileEntity_IndustrialMixer.java @@ -142,16 +142,6 @@ public class GregtechMetaTileEntity_IndustrialMixer } @Override - public boolean hasSlotInGUI() { - return false; - } - - @Override - public String getCustomGUIResourceName() { - return "IndustrialMixer"; - } - - @Override public GT_Recipe.GT_Recipe_Map getRecipeMap() { return gregtech.api.util.GTPP_Recipe.GTPP_Recipe_Map.sMultiblockMixerRecipes_GT; } diff --git a/src/main/java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/processing/GregtechMetaTileEntity_IndustrialMolecularTransformer.java b/src/main/java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/processing/GregtechMetaTileEntity_IndustrialMolecularTransformer.java index 82d42c0bc0..29650598e7 100644 --- a/src/main/java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/processing/GregtechMetaTileEntity_IndustrialMolecularTransformer.java +++ b/src/main/java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/processing/GregtechMetaTileEntity_IndustrialMolecularTransformer.java @@ -187,21 +187,6 @@ public class GregtechMetaTileEntity_IndustrialMolecularTransformer return 44; } - @Override - public boolean hasSlotInGUI() { - return true; - } - - @Override - public boolean requiresVanillaGtGUI() { - return true; - } - - @Override - public String getCustomGUIResourceName() { - return null; - } - public GT_Recipe.GT_Recipe_Map getRecipeMap() { return GTPP_Recipe_Map.sMolecularTransformerRecipes; } diff --git a/src/main/java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/processing/GregtechMetaTileEntity_IndustrialMultiMachine.java b/src/main/java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/processing/GregtechMetaTileEntity_IndustrialMultiMachine.java index 145d82f671..4885270bb7 100644 --- a/src/main/java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/processing/GregtechMetaTileEntity_IndustrialMultiMachine.java +++ b/src/main/java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/processing/GregtechMetaTileEntity_IndustrialMultiMachine.java @@ -174,16 +174,6 @@ public class GregtechMetaTileEntity_IndustrialMultiMachine } @Override - public boolean hasSlotInGUI() { - return false; - } - - @Override - public String getCustomGUIResourceName() { - return "Generic3By3"; - } - - @Override public boolean checkRecipe(final ItemStack aStack) { ArrayList<FluidStack> tFluids = getStoredFluids(); // Logger.MACHINE_INFO("1"); diff --git a/src/main/java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/processing/GregtechMetaTileEntity_IndustrialPlatePress.java b/src/main/java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/processing/GregtechMetaTileEntity_IndustrialPlatePress.java index 074ea2bbf6..86a9c517a0 100644 --- a/src/main/java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/processing/GregtechMetaTileEntity_IndustrialPlatePress.java +++ b/src/main/java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/processing/GregtechMetaTileEntity_IndustrialPlatePress.java @@ -139,16 +139,6 @@ public class GregtechMetaTileEntity_IndustrialPlatePress } @Override - public boolean hasSlotInGUI() { - return false; - } - - @Override - public String getCustomGUIResourceName() { - return "MaterialPress"; - } - - @Override public GT_Recipe.GT_Recipe_Map getRecipeMap() { return mFormingMode ? GT_Recipe.GT_Recipe_Map.sPressRecipes : GT_Recipe.GT_Recipe_Map.sBenderRecipes; } diff --git a/src/main/java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/processing/GregtechMetaTileEntity_IndustrialSifter.java b/src/main/java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/processing/GregtechMetaTileEntity_IndustrialSifter.java index 5f4ad64a21..3a7fc25f11 100644 --- a/src/main/java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/processing/GregtechMetaTileEntity_IndustrialSifter.java +++ b/src/main/java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/processing/GregtechMetaTileEntity_IndustrialSifter.java @@ -130,16 +130,6 @@ public class GregtechMetaTileEntity_IndustrialSifter } @Override - public boolean hasSlotInGUI() { - return false; - } - - @Override - public String getCustomGUIResourceName() { - return "IndustrialSifter"; - } - - @Override public GT_Recipe.GT_Recipe_Map getRecipeMap() { return GT_Recipe.GT_Recipe_Map.sSifterRecipes; } diff --git a/src/main/java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/processing/GregtechMetaTileEntity_IndustrialSinter.java b/src/main/java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/processing/GregtechMetaTileEntity_IndustrialSinter.java index 91698e4a0c..95672d5e48 100644 --- a/src/main/java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/processing/GregtechMetaTileEntity_IndustrialSinter.java +++ b/src/main/java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/processing/GregtechMetaTileEntity_IndustrialSinter.java @@ -45,11 +45,6 @@ extends GT_MetaTileEntity_MultiBlockBase { } @Override - public Object getClientGUI(final int aID, final InventoryPlayer aPlayerInventory, final IGregTechTileEntity aBaseMetaTileEntity) { - return new GUI_MultiMachine(aPlayerInventory, aBaseMetaTileEntity, this.getLocalName(), "WireFactory.png"); - } - - @Override public GT_Recipe.GT_Recipe_Map getRecipeMap() { return GT_Recipe.GT_Recipe_Map.sWiremillRecipes; } diff --git a/src/main/java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/processing/GregtechMetaTileEntity_IndustrialThermalCentrifuge.java b/src/main/java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/processing/GregtechMetaTileEntity_IndustrialThermalCentrifuge.java index f8c1d0d64d..6359679149 100644 --- a/src/main/java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/processing/GregtechMetaTileEntity_IndustrialThermalCentrifuge.java +++ b/src/main/java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/processing/GregtechMetaTileEntity_IndustrialThermalCentrifuge.java @@ -135,16 +135,6 @@ public class GregtechMetaTileEntity_IndustrialThermalCentrifuge } @Override - public boolean hasSlotInGUI() { - return false; - } - - @Override - public String getCustomGUIResourceName() { - return "IndustrialThermalCentrifuge"; - } - - @Override public GT_Recipe.GT_Recipe_Map getRecipeMap() { return GT_Recipe.GT_Recipe_Map.sThermalCentrifugeRecipes; } diff --git a/src/main/java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/processing/GregtechMetaTileEntity_IndustrialVacuumFreezer.java b/src/main/java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/processing/GregtechMetaTileEntity_IndustrialVacuumFreezer.java index 301e1996cd..ecd1f2403c 100644 --- a/src/main/java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/processing/GregtechMetaTileEntity_IndustrialVacuumFreezer.java +++ b/src/main/java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/processing/GregtechMetaTileEntity_IndustrialVacuumFreezer.java @@ -184,21 +184,6 @@ public class GregtechMetaTileEntity_IndustrialVacuumFreezer return CASING_TEXTURE_ID; } - @Override - public boolean hasSlotInGUI() { - return true; - } - - @Override - public boolean requiresVanillaGtGUI() { - return true; - } - - @Override - public String getCustomGUIResourceName() { - return "VacuumFreezer"; - } - public GT_Recipe.GT_Recipe_Map getRecipeMap() { return GTPP_Recipe.GTPP_Recipe_Map.sAdvFreezerRecipes_GT; } diff --git a/src/main/java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/processing/GregtechMetaTileEntity_IndustrialWashPlant.java b/src/main/java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/processing/GregtechMetaTileEntity_IndustrialWashPlant.java index e5cb30d41b..fe8329bf5f 100644 --- a/src/main/java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/processing/GregtechMetaTileEntity_IndustrialWashPlant.java +++ b/src/main/java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/processing/GregtechMetaTileEntity_IndustrialWashPlant.java @@ -149,16 +149,6 @@ public class GregtechMetaTileEntity_IndustrialWashPlant } @Override - public boolean hasSlotInGUI() { - return false; - } - - @Override - public String getCustomGUIResourceName() { - return "IndustrialWashPlant"; - } - - @Override public GT_Recipe.GT_Recipe_Map getRecipeMap() { return mMode == 0 ? GT_Recipe.GT_Recipe_Map.sOreWasherRecipes diff --git a/src/main/java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/processing/GregtechMetaTileEntity_IndustrialWireMill.java b/src/main/java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/processing/GregtechMetaTileEntity_IndustrialWireMill.java index 7107e09bdb..f6bade9ab1 100644 --- a/src/main/java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/processing/GregtechMetaTileEntity_IndustrialWireMill.java +++ b/src/main/java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/processing/GregtechMetaTileEntity_IndustrialWireMill.java @@ -140,16 +140,6 @@ public class GregtechMetaTileEntity_IndustrialWireMill } @Override - public boolean hasSlotInGUI() { - return false; - } - - @Override - public String getCustomGUIResourceName() { - return "IndustrialWireFactory"; - } - - @Override public GT_Recipe.GT_Recipe_Map getRecipeMap() { return GT_Recipe.GT_Recipe_Map.sWiremillRecipes; } diff --git a/src/main/java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/processing/GregtechMetaTileEntity_IronBlastFurnace.java b/src/main/java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/processing/GregtechMetaTileEntity_IronBlastFurnace.java index 439ab234cf..03c6f813fc 100644 --- a/src/main/java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/processing/GregtechMetaTileEntity_IronBlastFurnace.java +++ b/src/main/java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/processing/GregtechMetaTileEntity_IronBlastFurnace.java @@ -1,10 +1,17 @@ package gtPlusPlus.xmod.gregtech.common.tileentities.machines.multi.processing; +import com.gtnewhorizons.modularui.api.screen.ModularWindow; +import com.gtnewhorizons.modularui.api.screen.UIBuildContext; +import com.gtnewhorizons.modularui.common.widget.ProgressBar; +import com.gtnewhorizons.modularui.common.widget.SlotWidget; import gregtech.GT_Mod; import gregtech.api.GregTech_API; import gregtech.api.enums.Materials; import gregtech.api.enums.OrePrefixes; +import gregtech.api.gui.modularui.GT_UIInfos; +import gregtech.api.gui.modularui.GT_UITextures; import gregtech.api.interfaces.ITexture; +import gregtech.api.interfaces.modularui.IAddUIWidgets; import gregtech.api.interfaces.tileentity.IGregTechTileEntity; import gregtech.api.metatileentity.MetaTileEntity; import gregtech.api.objects.GT_ItemStack; @@ -13,18 +20,16 @@ import gregtech.api.util.GT_OreDictUnificator; import gregtech.api.util.GT_Utility; import gtPlusPlus.core.block.ModBlocks; import gtPlusPlus.core.lib.CORE; -import gtPlusPlus.xmod.gregtech.api.gui.CONTAINER_IronBlastFurnace; -import gtPlusPlus.xmod.gregtech.api.gui.GUI_IronBlastFurnace; +import gtPlusPlus.xmod.gregtech.api.gui.GTPP_UITextures; import gtPlusPlus.xmod.gregtech.common.blocks.textures.TexturesGtBlock; import net.minecraft.entity.player.EntityPlayer; -import net.minecraft.entity.player.InventoryPlayer; import net.minecraft.init.Blocks; import net.minecraft.init.Items; import net.minecraft.item.ItemStack; import net.minecraft.nbt.NBTTagCompound; import net.minecraftforge.common.util.ForgeDirection; -public class GregtechMetaTileEntity_IronBlastFurnace extends MetaTileEntity { +public class GregtechMetaTileEntity_IronBlastFurnace extends MetaTileEntity implements IAddUIWidgets { private static final ITexture[] FACING_SIDE = {new GT_RenderedTexture(TexturesGtBlock.Casing_Machine_Simple_Top)}; private static final ITexture[] FACING_FRONT = {new GT_RenderedTexture(TexturesGtBlock.Casing_Machine_Redstone_Off) }; @@ -189,25 +194,10 @@ public class GregtechMetaTileEntity_IronBlastFurnace extends MetaTileEntity { @Override public boolean onRightclick(final IGregTechTileEntity aBaseMetaTileEntity, final EntityPlayer aPlayer) { - if (aBaseMetaTileEntity.isClientSide()) { - return true; - } - aBaseMetaTileEntity.openGUI(aPlayer); + GT_UIInfos.openGTTileEntityUI(aBaseMetaTileEntity, aPlayer); return true; } - @Override - public Object getServerGUI( - final int aID, final InventoryPlayer aPlayerInventory, final IGregTechTileEntity aBaseMetaTileEntity) { - return new CONTAINER_IronBlastFurnace(aPlayerInventory, aBaseMetaTileEntity); - } - - @Override - public Object getClientGUI( - final int aID, final InventoryPlayer aPlayerInventory, final IGregTechTileEntity aBaseMetaTileEntity) { - return new GUI_IronBlastFurnace(aPlayerInventory, aBaseMetaTileEntity); - } - private boolean checkMachine() { final int xDir = ForgeDirection.getOrientation(this.getBaseMetaTileEntity().getBackFacing()).offsetX; @@ -534,4 +524,32 @@ public class GregtechMetaTileEntity_IronBlastFurnace extends MetaTileEntity { public byte getTileEntityBaseType() { return 0; } + + @Override + public boolean useModularUI() { + return true; + } + + @Override + public void addUIWidgets(ModularWindow.Builder builder, UIBuildContext buildContext) { + builder.widget(new SlotWidget(inventoryHandler, 0) + .setBackground(getGUITextureSet().getItemSlot(), GTPP_UITextures.OVERLAY_SLOT_INGOT) + .setPos(33, 15)) + .widget(new SlotWidget(inventoryHandler, 1) + .setBackground(getGUITextureSet().getItemSlot(), GT_UITextures.OVERLAY_SLOT_FURNACE) + .setPos(33, 33)) + .widget(new SlotWidget(inventoryHandler, 2) + .setAccess(true, false) + .setBackground(getGUITextureSet().getItemSlot(), GTPP_UITextures.OVERLAY_SLOT_INGOT) + .setPos(85, 24)) + .widget(new SlotWidget(inventoryHandler, 3) + .setAccess(true, false) + .setBackground(getGUITextureSet().getItemSlot(), GT_UITextures.OVERLAY_SLOT_DUST) + .setPos(103, 24)) + .widget(new ProgressBar() + .setTexture(GTPP_UITextures.PROGRESSBAR_ARROW_2, 20) + .setProgress(() -> (float) mProgresstime / mMaxProgresstime) + .setPos(58, 24) + .setSize(20, 18)); + } } diff --git a/src/main/java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/processing/GregtechMetaTileEntity_IsaMill.java b/src/main/java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/processing/GregtechMetaTileEntity_IsaMill.java index a4cba60885..d887e64579 100644 --- a/src/main/java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/processing/GregtechMetaTileEntity_IsaMill.java +++ b/src/main/java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/processing/GregtechMetaTileEntity_IsaMill.java @@ -417,16 +417,6 @@ public class GregtechMetaTileEntity_IsaMill extends GregtechMeta_MultiBlockBase< } @Override - public boolean hasSlotInGUI() { - return true; - } - - @Override - public String getCustomGUIResourceName() { - return null; - } - - @Override public String getMachineType() { return "Grinding Machine"; } diff --git a/src/main/java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/processing/GregtechMetaTileEntity_SpargeTower.java b/src/main/java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/processing/GregtechMetaTileEntity_SpargeTower.java index 7755dc925a..09a2fdf83d 100644 --- a/src/main/java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/processing/GregtechMetaTileEntity_SpargeTower.java +++ b/src/main/java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/processing/GregtechMetaTileEntity_SpargeTower.java @@ -10,7 +10,6 @@ import com.gtnewhorizon.structurelib.alignment.constructable.ISurvivalConstructa import com.gtnewhorizon.structurelib.structure.IStructureDefinition; import com.gtnewhorizon.structurelib.structure.ISurvivalBuildEnvironment; import com.gtnewhorizon.structurelib.structure.StructureDefinition; -import gregtech.api.gui.GT_GUIContainer_MultiMachine; import gregtech.api.interfaces.IHatchElement; import gregtech.api.interfaces.IIconContainer; import gregtech.api.interfaces.metatileentity.IMetaTileEntity; @@ -28,7 +27,6 @@ import gtPlusPlus.xmod.gregtech.common.blocks.textures.TexturesGtBlock; import java.util.ArrayList; import java.util.List; import net.minecraft.entity.player.EntityPlayer; -import net.minecraft.entity.player.InventoryPlayer; import net.minecraft.item.ItemStack; import net.minecraftforge.common.util.ForgeDirection; import net.minecraftforge.fluids.FluidStack; @@ -160,12 +158,6 @@ public class GregtechMetaTileEntity_SpargeTower extends GregtechMeta_MultiBlockB } @Override - public Object getClientGUI(int aID, InventoryPlayer aPlayerInventory, IGregTechTileEntity aBaseMetaTileEntity) { - return new GT_GUIContainer_MultiMachine( - aPlayerInventory, aBaseMetaTileEntity, getLocalName(), "DistillationTower.png"); - } - - @Override public GT_Recipe.GT_Recipe_Map getRecipeMap() { if (GTPP_Recipe_Map.sSpargeTowerRecipes.mRecipeList.isEmpty()) { generateRecipes(); @@ -419,21 +411,6 @@ public class GregtechMetaTileEntity_SpargeTower extends GregtechMeta_MultiBlockB } @Override - public boolean hasSlotInGUI() { - return false; - } - - @Override - public String getCustomGUIResourceName() { - return null; - } - - @Override - public boolean requiresVanillaGtGUI() { - return true; - } - - @Override public String getMachineType() { return "Gas Sparger"; } diff --git a/src/main/java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/processing/advanced/GregtechMetaTileEntity_Adv_AssemblyLine.java b/src/main/java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/processing/advanced/GregtechMetaTileEntity_Adv_AssemblyLine.java index 70551220ca..df3990530f 100644 --- a/src/main/java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/processing/advanced/GregtechMetaTileEntity_Adv_AssemblyLine.java +++ b/src/main/java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/processing/advanced/GregtechMetaTileEntity_Adv_AssemblyLine.java @@ -6,7 +6,6 @@ import gregtech.api.enums.GT_Values; import gregtech.api.enums.ItemList; import gregtech.api.enums.TAE; import gregtech.api.enums.Textures; -import gregtech.api.gui.GT_GUIContainer_MultiMachine; import gregtech.api.interfaces.IIconContainer; import gregtech.api.interfaces.metatileentity.IMetaTileEntity; import gregtech.api.interfaces.tileentity.IGregTechTileEntity; @@ -23,7 +22,6 @@ import gtPlusPlus.xmod.gregtech.api.metatileentity.implementations.base.Gregtech import java.util.ArrayList; import net.minecraft.block.Block; import net.minecraft.entity.player.EntityPlayer; -import net.minecraft.entity.player.InventoryPlayer; import net.minecraft.item.ItemStack; import net.minecraft.nbt.NBTTagCompound; import net.minecraftforge.common.util.ForgeDirection; @@ -118,11 +116,6 @@ public class GregtechMetaTileEntity_Adv_AssemblyLine return 16; } - public Object getClientGUI(int aID, InventoryPlayer aPlayerInventory, IGregTechTileEntity aBaseMetaTileEntity) { - return new GT_GUIContainer_MultiMachine( - aPlayerInventory, aBaseMetaTileEntity, getLocalName(), "AssemblyLine.png"); - } - public GT_Recipe.GT_Recipe_Map getRecipeMap() { return null; } @@ -640,16 +633,6 @@ public class GregtechMetaTileEntity_Adv_AssemblyLine } @Override - public boolean hasSlotInGUI() { - return false; - } - - @Override - public String getCustomGUIResourceName() { - return null; - } - - @Override public String getMachineType() { return "Assembly Line"; } diff --git a/src/main/java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/processing/advanced/GregtechMetaTileEntity_Adv_DistillationTower.java b/src/main/java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/processing/advanced/GregtechMetaTileEntity_Adv_DistillationTower.java index 677d90f448..24588d6d2e 100644 --- a/src/main/java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/processing/advanced/GregtechMetaTileEntity_Adv_DistillationTower.java +++ b/src/main/java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/processing/advanced/GregtechMetaTileEntity_Adv_DistillationTower.java @@ -12,7 +12,6 @@ import com.gtnewhorizon.structurelib.structure.ISurvivalBuildEnvironment; import com.gtnewhorizon.structurelib.structure.StructureDefinition; import gregtech.api.GregTech_API; import gregtech.api.enums.Textures; -import gregtech.api.gui.GT_GUIContainer_MultiMachine; import gregtech.api.interfaces.IHatchElement; import gregtech.api.interfaces.IIconContainer; import gregtech.api.interfaces.metatileentity.IMetaTileEntity; @@ -31,7 +30,6 @@ import gtPlusPlus.xmod.gregtech.api.metatileentity.implementations.base.Gregtech import java.util.ArrayList; import java.util.List; import net.minecraft.entity.player.EntityPlayer; -import net.minecraft.entity.player.InventoryPlayer; import net.minecraft.item.ItemStack; import net.minecraft.nbt.NBTTagCompound; import net.minecraftforge.common.util.ForgeDirection; @@ -262,14 +260,6 @@ public class GregtechMetaTileEntity_Adv_DistillationTower return check; } - public Object getClientGUI(int aID, InventoryPlayer aPlayerInventory, IGregTechTileEntity aBaseMetaTileEntity) { - return new GT_GUIContainer_MultiMachine( - aPlayerInventory, - aBaseMetaTileEntity, - getLocalName() + (mUpgraded ? " T2" : ""), - "MultiblockDisplay.png"); - } - public GT_Recipe.GT_Recipe_Map getRecipeMap() { return mMode.getRecipeMap(); } @@ -396,21 +386,6 @@ public class GregtechMetaTileEntity_Adv_DistillationTower } @Override - public boolean hasSlotInGUI() { - return true; - } - - @Override - public boolean requiresVanillaGtGUI() { - return true; - } - - @Override - public String getCustomGUIResourceName() { - return "DistillationTower"; - } - - @Override public String getMachineType() { return "Distillery, Distillation Tower"; } diff --git a/src/main/java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/processing/advanced/GregtechMetaTileEntity_Adv_EBF.java b/src/main/java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/processing/advanced/GregtechMetaTileEntity_Adv_EBF.java index 41a60926b2..5e2b984a69 100644 --- a/src/main/java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/processing/advanced/GregtechMetaTileEntity_Adv_EBF.java +++ b/src/main/java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/processing/advanced/GregtechMetaTileEntity_Adv_EBF.java @@ -212,21 +212,6 @@ public class GregtechMetaTileEntity_Adv_EBF extends GregtechMeta_MultiBlockBase< return CASING_TEXTURE_ID; } - @Override - public boolean hasSlotInGUI() { - return true; - } - - @Override - public boolean requiresVanillaGtGUI() { - return true; - } - - @Override - public String getCustomGUIResourceName() { - return "ElectricBlastFurnace"; - } - public GT_Recipe.GT_Recipe_Map getRecipeMap() { return GT_Recipe.GT_Recipe_Map.sBlastRecipes; } diff --git a/src/main/java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/processing/advanced/GregtechMetaTileEntity_Adv_HeatExchanger.java b/src/main/java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/processing/advanced/GregtechMetaTileEntity_Adv_HeatExchanger.java index 002cffb816..553a6a965c 100644 --- a/src/main/java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/processing/advanced/GregtechMetaTileEntity_Adv_HeatExchanger.java +++ b/src/main/java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/processing/advanced/GregtechMetaTileEntity_Adv_HeatExchanger.java @@ -8,7 +8,6 @@ import com.gtnewhorizon.structurelib.structure.IStructureDefinition; import com.gtnewhorizon.structurelib.structure.StructureDefinition; import gregtech.api.GregTech_API; import gregtech.api.enums.TAE; -import gregtech.api.gui.GT_GUIContainer_MultiMachine; import gregtech.api.interfaces.IIconContainer; import gregtech.api.interfaces.metatileentity.IMetaTileEntity; import gregtech.api.interfaces.tileentity.IGregTechTileEntity; @@ -22,7 +21,6 @@ import gtPlusPlus.core.material.ALLOY; import gtPlusPlus.xmod.gregtech.api.metatileentity.implementations.base.GregtechMeta_MultiBlockBase; import gtPlusPlus.xmod.gregtech.common.blocks.textures.TexturesGtBlock; import net.minecraft.block.Block; -import net.minecraft.entity.player.InventoryPlayer; import net.minecraft.item.ItemStack; import net.minecraft.nbt.NBTTagCompound; import net.minecraft.util.EnumChatFormatting; @@ -170,12 +168,6 @@ public class GregtechMetaTileEntity_Adv_HeatExchanger } @Override - public Object getClientGUI(int aID, InventoryPlayer aPlayerInventory, IGregTechTileEntity aBaseMetaTileEntity) { - return new GT_GUIContainer_MultiMachine( - aPlayerInventory, aBaseMetaTileEntity, getLocalName(), "LargeHeatExchanger.png"); - } - - @Override public boolean isCorrectMachinePart(ItemStack aStack) { return true; } @@ -380,16 +372,6 @@ public class GregtechMetaTileEntity_Adv_HeatExchanger } @Override - public boolean hasSlotInGUI() { - return true; - } - - @Override - public String getCustomGUIResourceName() { - return null; - } - - @Override public String getMachineType() { return "Heat Exchanger"; } diff --git a/src/main/java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/processing/advanced/GregtechMetaTileEntity_Adv_Implosion.java b/src/main/java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/processing/advanced/GregtechMetaTileEntity_Adv_Implosion.java index a005f36b1e..5f4f0466c1 100644 --- a/src/main/java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/processing/advanced/GregtechMetaTileEntity_Adv_Implosion.java +++ b/src/main/java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/processing/advanced/GregtechMetaTileEntity_Adv_Implosion.java @@ -126,21 +126,6 @@ public class GregtechMetaTileEntity_Adv_Implosion return 48; } - @Override - public boolean hasSlotInGUI() { - return true; - } - - @Override - public String getCustomGUIResourceName() { - return "ImplosionCompressor"; - } - - @Override - public boolean requiresVanillaGtGUI() { - return true; - } - public GT_Recipe.GT_Recipe_Map getRecipeMap() { return GT_Recipe.GT_Recipe_Map.sImplosionRecipes; } diff --git a/src/main/java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/production/GT4Entity_AutoCrafter.java b/src/main/java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/production/GT4Entity_AutoCrafter.java index 1cb4520d25..82631d81bf 100644 --- a/src/main/java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/production/GT4Entity_AutoCrafter.java +++ b/src/main/java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/production/GT4Entity_AutoCrafter.java @@ -635,14 +635,4 @@ public class GT4Entity_AutoCrafter extends GregtechMeta_MultiBlockBase<GT4Entity AC_Helper_Utils.removeCrafter(this); super.doExplosion(aExplosionPower); } - - @Override - public boolean hasSlotInGUI() { - return true; - } - - @Override - public String getCustomGUIResourceName() { - return "Generic3By3"; - } } diff --git a/src/main/java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/production/GT4Entity_ThermalBoiler.java b/src/main/java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/production/GT4Entity_ThermalBoiler.java index c499d01937..b21ee6b6ea 100644 --- a/src/main/java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/production/GT4Entity_ThermalBoiler.java +++ b/src/main/java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/production/GT4Entity_ThermalBoiler.java @@ -25,7 +25,6 @@ import gtPlusPlus.core.material.MISC_MATERIALS; import gtPlusPlus.core.util.minecraft.FluidUtils; import gtPlusPlus.xmod.gregtech.api.metatileentity.implementations.base.GregtechMeta_MultiBlockBase; import gtPlusPlus.xmod.gregtech.common.blocks.textures.TexturesGtBlock; -import net.minecraft.entity.player.EntityPlayer; import net.minecraft.item.Item; import net.minecraft.item.ItemStack; import net.minecraftforge.fluids.Fluid; @@ -39,10 +38,6 @@ public class GT4Entity_ThermalBoiler extends GregtechMeta_MultiBlockBase<GT4Enti private static IStructureDefinition<GT4Entity_ThermalBoiler> STRUCTURE_DEFINITION = null; private int mSuperEfficencyIncrease = 0; - public void onRightclick(EntityPlayer aPlayer) { - getBaseMetaTileEntity().openGUI(aPlayer, 158); - } - public GT4Entity_ThermalBoiler(int aID, String aName, String aNameRegional) { super(aID, aName, aNameRegional); } @@ -359,14 +354,4 @@ public class GT4Entity_ThermalBoiler extends GregtechMeta_MultiBlockBase<GT4Enti } super.onPostTick(aBaseMetaTileEntity, aTick); } - - @Override - public boolean hasSlotInGUI() { - return true; - } - - @Override - public String getCustomGUIResourceName() { - return "Generic3By3"; - } } diff --git a/src/main/java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/production/GregtechMTE_ElementalDuplicator.java b/src/main/java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/production/GregtechMTE_ElementalDuplicator.java index 235aa40fd3..c5e700d711 100644 --- a/src/main/java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/production/GregtechMTE_ElementalDuplicator.java +++ b/src/main/java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/production/GregtechMTE_ElementalDuplicator.java @@ -313,21 +313,6 @@ public class GregtechMTE_ElementalDuplicator extends GregtechMeta_MultiBlockBase return CASING_TEXTURE_ID; } - @Override - public boolean hasSlotInGUI() { - return false; - } - - @Override - public boolean requiresVanillaGtGUI() { - return false; - } - - @Override - public String getCustomGUIResourceName() { - return null; - } - public GT_Recipe.GT_Recipe_Map getRecipeMap() { return GTPP_Recipe_Map.sElementalDuplicatorRecipes; } @@ -766,4 +751,9 @@ public class GregtechMTE_ElementalDuplicator extends GregtechMeta_MultiBlockBase return false; } + + @Override + public boolean doesBindPlayerInventory() { + return false; + } } diff --git a/src/main/java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/production/GregtechMTE_FastNeutronReactor.java b/src/main/java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/production/GregtechMTE_FastNeutronReactor.java index 0d065f6e4b..69d93ce06d 100644 --- a/src/main/java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/production/GregtechMTE_FastNeutronReactor.java +++ b/src/main/java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/production/GregtechMTE_FastNeutronReactor.java @@ -24,11 +24,6 @@ extends GregtechMeta_MultiBlockBase } @Override - public String getCustomGUIResourceName() { - return null; - } - - @Override public MetaTileEntity newMetaEntity(IGregTechTileEntity aTileEntity) { return new GregtechMTE_FastNeutronReactor(this.mName); @@ -209,10 +204,5 @@ extends GregtechMeta_MultiBlockBase super.onPostTick(aBaseMetaTileEntity, aTick); } - @Override - public boolean hasSlotInGUI() { - return false; - } - } */ diff --git a/src/main/java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/production/GregtechMTE_FrothFlotationCell.java b/src/main/java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/production/GregtechMTE_FrothFlotationCell.java index bee968d0e2..d7abb28977 100644 --- a/src/main/java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/production/GregtechMTE_FrothFlotationCell.java +++ b/src/main/java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/production/GregtechMTE_FrothFlotationCell.java @@ -100,11 +100,6 @@ public class GregtechMTE_FrothFlotationCell extends GregtechMeta_MultiBlockBase< } @Override - public boolean hasSlotInGUI() { - return true; - } - - @Override public GT_Recipe.GT_Recipe_Map getRecipeMap() { return GTPP_Recipe.GTPP_Recipe_Map.sFlotationCellRecipes; } @@ -187,11 +182,6 @@ public class GregtechMTE_FrothFlotationCell extends GregtechMeta_MultiBlockBase< } @Override - public String getCustomGUIResourceName() { - return null; - } - - @Override public void onPostTick(IGregTechTileEntity aBaseMetaTileEntity, long aTick) { super.onPostTick(aBaseMetaTileEntity, aTick); } diff --git a/src/main/java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/production/GregtechMTE_LargeNaqReactor.java b/src/main/java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/production/GregtechMTE_LargeNaqReactor.java index 57529d1900..92b3729cc2 100644 --- a/src/main/java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/production/GregtechMTE_LargeNaqReactor.java +++ b/src/main/java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/production/GregtechMTE_LargeNaqReactor.java @@ -82,11 +82,6 @@ public class GregtechMTE_LargeNaqReactor extends GregtechMeta_MultiBlockBase { : new ITexture[]{BlockIcons.getCasingTextureForId(TAE.getIndexFromPage(3, 0))}; } - public Object getClientGUI(int aID, InventoryPlayer aPlayerInventory, IGregTechTileEntity aBaseMetaTileEntity) { - return new GT_GUIContainer_MultiMachine(aPlayerInventory, aBaseMetaTileEntity, this.getLocalName(), - "AssemblyLine.png"); - } - public GT_Recipe_Map getRecipeMap() { return null; } @@ -460,16 +455,6 @@ public class GregtechMTE_LargeNaqReactor extends GregtechMeta_MultiBlockBase { } @Override - public boolean hasSlotInGUI() { - return true; - } - - @Override - public String getCustomGUIResourceName() { - return null; - } - - @Override public String getMachineType() { return "Reactor"; } diff --git a/src/main/java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/production/GregtechMTE_MiniFusionPlant.java b/src/main/java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/production/GregtechMTE_MiniFusionPlant.java index 8f0a2802d4..bdbedbc36e 100644 --- a/src/main/java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/production/GregtechMTE_MiniFusionPlant.java +++ b/src/main/java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/production/GregtechMTE_MiniFusionPlant.java @@ -84,16 +84,6 @@ public class GregtechMTE_MiniFusionPlant extends GregtechMeta_MultiBlockBase { } @Override - public boolean hasSlotInGUI() { - return false; - } - - @Override - public String getCustomGUIResourceName() { - return null; - } - - @Override public String getMachineType() { return "Fusion Reactor"; } diff --git a/src/main/java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/production/GregtechMTE_NuclearReactor.java b/src/main/java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/production/GregtechMTE_NuclearReactor.java index 5e342d7451..6cc8d4fc11 100644 --- a/src/main/java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/production/GregtechMTE_NuclearReactor.java +++ b/src/main/java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/production/GregtechMTE_NuclearReactor.java @@ -171,16 +171,6 @@ public class GregtechMTE_NuclearReactor extends GregtechMeta_MultiBlockBase<Greg return new ITexture[] {Textures.BlockIcons.getCasingTextureForId(TAE.GTPP_INDEX(12))}; } - @Override - public boolean hasSlotInGUI() { - return false; - } - - @Override - public String getCustomGUIResourceName() { - return "MatterFabricator"; - } - public final boolean addNuclearReactorEdgeList(IGregTechTileEntity aTileEntity, int aBaseCasingIndex) { if (aTileEntity == null) { return false; diff --git a/src/main/java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/production/GregtechMetaTileEntityGeneratorArray.java b/src/main/java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/production/GregtechMetaTileEntityGeneratorArray.java index e4c392f8b5..279ab77b9c 100644 --- a/src/main/java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/production/GregtechMetaTileEntityGeneratorArray.java +++ b/src/main/java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/production/GregtechMetaTileEntityGeneratorArray.java @@ -88,21 +88,6 @@ public class GregtechMetaTileEntityGeneratorArray } @Override - public boolean hasSlotInGUI() { - return true; - } - - @Override - public String getCustomGUIResourceName() { - return "ProcessingArray"; - } - - @Override - public boolean requiresVanillaGtGUI() { - return true; - } - - @Override public GT_Recipe.GT_Recipe_Map getRecipeMap() { this.mMode = getModeFromInventorySlot(this.getGUIItemStack()); if (this.mMode == MODE_NONE) { diff --git a/src/main/java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/production/GregtechMetaTileEntityTreeFarm.java b/src/main/java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/production/GregtechMetaTileEntityTreeFarm.java index 51fd573dbc..f5e45fa710 100644 --- a/src/main/java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/production/GregtechMetaTileEntityTreeFarm.java +++ b/src/main/java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/production/GregtechMetaTileEntityTreeFarm.java @@ -129,21 +129,6 @@ public class GregtechMetaTileEntityTreeFarm extends GregtechMeta_MultiBlockBase< } @Override - public boolean hasSlotInGUI() { - return true; - } - - @Override - public boolean requiresVanillaGtGUI() { - return true; - } - - @Override - public String getCustomGUIResourceName() { - return "VacuumFreezer"; - } - - @Override public boolean isCorrectMachinePart(final ItemStack aStack) { // is correct part && either not powered tool or have enough power if (TreeFarmHelper.isValidForGUI(aStack) diff --git a/src/main/java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/production/GregtechMetaTileEntity_AlloyBlastSmelter.java b/src/main/java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/production/GregtechMetaTileEntity_AlloyBlastSmelter.java index 45c95d898e..b30f0c0625 100644 --- a/src/main/java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/production/GregtechMetaTileEntity_AlloyBlastSmelter.java +++ b/src/main/java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/production/GregtechMetaTileEntity_AlloyBlastSmelter.java @@ -164,21 +164,6 @@ public class GregtechMetaTileEntity_AlloyBlastSmelter } @Override - public boolean hasSlotInGUI() { - return true; - } - - @Override - public boolean requiresVanillaGtGUI() { - return true; - } - - @Override - public String getCustomGUIResourceName() { - return "ElectricBlastFurnace"; - } - - @Override public GT_Recipe.GT_Recipe_Map getRecipeMap() { return GTPP_Recipe.GTPP_Recipe_Map.sAlloyBlastSmelterRecipes; } diff --git a/src/main/java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/production/GregtechMetaTileEntity_Cyclotron.java b/src/main/java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/production/GregtechMetaTileEntity_Cyclotron.java index c111e7253f..86fd24f682 100644 --- a/src/main/java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/production/GregtechMetaTileEntity_Cyclotron.java +++ b/src/main/java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/production/GregtechMetaTileEntity_Cyclotron.java @@ -28,7 +28,6 @@ import gtPlusPlus.xmod.gregtech.api.metatileentity.implementations.base.Gregtech import gtPlusPlus.xmod.gregtech.common.blocks.textures.TexturesGtBlock; import java.util.ArrayList; import net.minecraft.block.Block; -import net.minecraft.entity.player.InventoryPlayer; import net.minecraft.item.ItemStack; import net.minecraft.nbt.NBTTagCompound; import net.minecraftforge.fluids.FluidStack; @@ -62,29 +61,6 @@ public class GregtechMetaTileEntity_Cyclotron extends GregtechMeta_MultiBlockBas } @Override - public boolean hasSlotInGUI() { - return false; - } - - @Override - public String getCustomGUIResourceName() { - return null; - } - - @Override - public Object getServerGUI(int aID, InventoryPlayer aPlayerInventory, IGregTechTileEntity aBaseMetaTileEntity) { - return super.getServerGUI(aID, aPlayerInventory, aBaseMetaTileEntity); - // return new CONTAINER_Cyclotron(aPlayerInventory, aBaseMetaTileEntity); - } - - @Override - public Object getClientGUI(int aID, InventoryPlayer aPlayerInventory, IGregTechTileEntity aBaseMetaTileEntity) { - return super.getClientGUI(aID, aPlayerInventory, aBaseMetaTileEntity); - // return new GUI_Cyclotron(aPlayerInventory, aBaseMetaTileEntity, getLocalName(), - // Recipe_GT.Gregtech_Recipe_Map.sCyclotronRecipes.mNEIName); - } - - @Override public MetaTileEntity newMetaEntity(final IGregTechTileEntity aTileEntity) { return new GregtechMetaTileEntity_Cyclotron(this.mName); } @@ -440,4 +416,9 @@ public class GregtechMetaTileEntity_Cyclotron extends GregtechMeta_MultiBlockBas } return true; } + + @Override + public boolean doesBindPlayerInventory() { + return false; + } } diff --git a/src/main/java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/production/GregtechMetaTileEntity_IndustrialFishingPond.java b/src/main/java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/production/GregtechMetaTileEntity_IndustrialFishingPond.java index 4f1aa5cf95..8fcecf8721 100644 --- a/src/main/java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/production/GregtechMetaTileEntity_IndustrialFishingPond.java +++ b/src/main/java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/production/GregtechMetaTileEntity_IndustrialFishingPond.java @@ -190,16 +190,6 @@ public class GregtechMetaTileEntity_IndustrialFishingPond } @Override - public boolean hasSlotInGUI() { - return true; - } - - @Override - public String getCustomGUIResourceName() { - return null; - } - - @Override public GT_Recipe.GT_Recipe_Map getRecipeMap() { return null; } diff --git a/src/main/java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/production/GregtechMetaTileEntity_IndustrialRockBreaker.java b/src/main/java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/production/GregtechMetaTileEntity_IndustrialRockBreaker.java index 568b59ea6a..fcd7f5b452 100644 --- a/src/main/java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/production/GregtechMetaTileEntity_IndustrialRockBreaker.java +++ b/src/main/java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/production/GregtechMetaTileEntity_IndustrialRockBreaker.java @@ -153,21 +153,6 @@ public class GregtechMetaTileEntity_IndustrialRockBreaker return TAE.GTPP_INDEX(16); } - @Override - public boolean hasSlotInGUI() { - return true; - } - - @Override - public boolean requiresVanillaGtGUI() { - return true; - } - - @Override - public String getCustomGUIResourceName() { - return "ElectricBlastFurnace"; - } - private static final GT_Recipe_Map sFakeRecipeMap = new GT_Recipe_Map( new HashSet<>(0), "gt.recipe.fakerockbreaker", @@ -518,7 +503,7 @@ public class GregtechMetaTileEntity_IndustrialRockBreaker @Override public ArrayList<ItemStack> getStoredInputs() { ArrayList<ItemStack> aInputs = super.getStoredInputs(); - if (this.hasSlotInGUI() && this.getGUIItemStack() != null) { + if (this.getGUIItemStack() != null) { aInputs.add(this.getGUIItemStack()); } return aInputs; diff --git a/src/main/java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/production/GregtechMetaTileEntity_LargeRocketEngine.java b/src/main/java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/production/GregtechMetaTileEntity_LargeRocketEngine.java index 0097422333..cf28aaf456 100644 --- a/src/main/java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/production/GregtechMetaTileEntity_LargeRocketEngine.java +++ b/src/main/java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/production/GregtechMetaTileEntity_LargeRocketEngine.java @@ -34,7 +34,6 @@ import gtPlusPlus.xmod.gregtech.api.metatileentity.implementations.base.Gregtech import gtPlusPlus.xmod.gregtech.common.blocks.textures.TexturesGtBlock; import java.util.ArrayList; import net.minecraft.block.Block; -import net.minecraft.entity.player.InventoryPlayer; import net.minecraft.item.ItemStack; import net.minecraft.nbt.NBTTagCompound; import net.minecraftforge.fluids.Fluid; @@ -194,12 +193,6 @@ public class GregtechMetaTileEntity_LargeRocketEngine return this.getMaxEfficiency(aStack) > 0; } - @Override - public Object getClientGUI( - final int aID, final InventoryPlayer aPlayerInventory, final IGregTechTileEntity aBaseMetaTileEntity) { - return super.getClientGUI(aID, aPlayerInventory, aBaseMetaTileEntity); - } - public static void setAir() { if (sAirFluidStack == null) { sAirFluidStack = FluidUtils.getFluidStack("air", 1); @@ -580,16 +573,6 @@ public class GregtechMetaTileEntity_LargeRocketEngine } @Override - public boolean hasSlotInGUI() { - return false; - } - - @Override - public String getCustomGUIResourceName() { - return null; - } - - @Override public String getMachineType() { return "Rocket Engine"; } @@ -603,4 +586,9 @@ public class GregtechMetaTileEntity_LargeRocketEngine public int getEuDiscountForParallelism() { return 0; } + + @Override + public boolean doesBindPlayerInventory() { + return false; + } } diff --git a/src/main/java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/production/GregtechMetaTileEntity_LargeSemifluidGenerator.java b/src/main/java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/production/GregtechMetaTileEntity_LargeSemifluidGenerator.java index 6ec3d7470a..523560871f 100644 --- a/src/main/java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/production/GregtechMetaTileEntity_LargeSemifluidGenerator.java +++ b/src/main/java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/production/GregtechMetaTileEntity_LargeSemifluidGenerator.java @@ -17,7 +17,6 @@ import com.gtnewhorizon.structurelib.structure.StructureDefinition; import gregtech.api.GregTech_API; import gregtech.api.enums.Materials; import gregtech.api.enums.Textures; -import gregtech.api.gui.GT_GUIContainer_MultiMachine; import gregtech.api.interfaces.IIconContainer; import gregtech.api.interfaces.metatileentity.IMetaTileEntity; import gregtech.api.interfaces.tileentity.IGregTechTileEntity; @@ -32,7 +31,6 @@ import gtPlusPlus.core.lib.CORE; import gtPlusPlus.xmod.gregtech.api.metatileentity.implementations.base.GregtechMeta_MultiBlockBase; import java.util.ArrayList; import net.minecraft.block.Block; -import net.minecraft.entity.player.InventoryPlayer; import net.minecraft.item.ItemStack; import net.minecraft.nbt.NBTTagCompound; import net.minecraftforge.fluids.FluidStack; @@ -102,11 +100,6 @@ public class GregtechMetaTileEntity_LargeSemifluidGenerator return getMaxEfficiency(aStack) > 0; } - public Object getClientGUI(int aID, InventoryPlayer aPlayerInventory, IGregTechTileEntity aBaseMetaTileEntity) { - return new GT_GUIContainer_MultiMachine( - aPlayerInventory, aBaseMetaTileEntity, getLocalName(), "LargeDieselEngine.png"); - } - @Override public boolean checkRecipe(ItemStack aStack) { ArrayList<FluidStack> tFluids = getStoredFluids(); @@ -321,16 +314,6 @@ public class GregtechMetaTileEntity_LargeSemifluidGenerator } @Override - public boolean hasSlotInGUI() { - return false; - } - - @Override - public String getCustomGUIResourceName() { - return null; - } - - @Override public String getMachineType() { return "Semifluid Generator"; } diff --git a/src/main/java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/production/GregtechMetaTileEntity_MassFabricator.java b/src/main/java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/production/GregtechMetaTileEntity_MassFabricator.java index 66c8979e9e..58ef8e52f7 100644 --- a/src/main/java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/production/GregtechMetaTileEntity_MassFabricator.java +++ b/src/main/java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/production/GregtechMetaTileEntity_MassFabricator.java @@ -11,6 +11,9 @@ import com.gtnewhorizon.structurelib.alignment.constructable.ISurvivalConstructa import com.gtnewhorizon.structurelib.structure.IStructureDefinition; import com.gtnewhorizon.structurelib.structure.ISurvivalBuildEnvironment; import com.gtnewhorizon.structurelib.structure.StructureDefinition; +import com.gtnewhorizons.modularui.common.widget.DynamicPositionedColumn; +import com.gtnewhorizons.modularui.common.widget.SlotWidget; +import com.gtnewhorizons.modularui.common.widget.TextWidget; import gregtech.api.enums.ConfigCategories; import gregtech.api.enums.Materials; import gregtech.api.enums.TAE; @@ -24,14 +27,11 @@ import gtPlusPlus.core.lib.CORE; import gtPlusPlus.core.util.minecraft.ItemUtils; import gtPlusPlus.core.util.minecraft.MaterialUtils; import gtPlusPlus.core.util.minecraft.PlayerUtils; -import gtPlusPlus.xmod.gregtech.api.gui.CONTAINER_MatterFab; -import gtPlusPlus.xmod.gregtech.api.gui.GUI_MatterFab; import gtPlusPlus.xmod.gregtech.api.metatileentity.implementations.base.GregtechMeta_MultiBlockBase; import gtPlusPlus.xmod.gregtech.common.blocks.textures.TexturesGtBlock; import java.util.ArrayList; import java.util.List; import net.minecraft.entity.player.EntityPlayer; -import net.minecraft.entity.player.InventoryPlayer; import net.minecraft.item.ItemStack; import net.minecraft.nbt.NBTTagCompound; import net.minecraftforge.fluids.FluidStack; @@ -134,27 +134,6 @@ public class GregtechMetaTileEntity_MassFabricator } @Override - public boolean hasSlotInGUI() { - return false; - } - - @Override - public String getCustomGUIResourceName() { - return "MatterFabricator"; - } - - @Override - public Object getClientGUI( - final int aID, final InventoryPlayer aPlayerInventory, final IGregTechTileEntity aBaseMetaTileEntity) { - return new GUI_MatterFab(aPlayerInventory, aBaseMetaTileEntity, this.getLocalName(), "MatterFabricator.png"); - } - - @Override - public Object getServerGUI(int aID, InventoryPlayer aPlayerInventory, IGregTechTileEntity aBaseMetaTileEntity) { - return new CONTAINER_MatterFab(aPlayerInventory, aBaseMetaTileEntity); - } - - @Override public void onConfigLoad(final GT_Config aConfig) { super.onConfigLoad(aConfig); sDurationMultiplier = aConfig.get( @@ -681,4 +660,31 @@ public class GregtechMetaTileEntity_MassFabricator mMode = aNBT.getInteger("mMode"); super.loadNBTData(aNBT); } + + @Override + protected void drawTexts(DynamicPositionedColumn screenElements, SlotWidget inventorySlot) { + super.drawTexts(screenElements, inventorySlot); + + screenElements + .widget(TextWidget.dynamicString(() -> "Scrap Made: " + mScrapProduced) + .setDefaultColor(COLOR_TEXT_WHITE.get()) + .setEnabled(widget -> getBaseMetaTileEntity().getErrorDisplayID() == 0 + && getBaseMetaTileEntity().isActive())) + .widget(TextWidget.dynamicString(() -> "Scrap Used: " + mScrapUsed) + .setDefaultColor(COLOR_TEXT_WHITE.get()) + .setEnabled(widget -> getBaseMetaTileEntity().getErrorDisplayID() == 0 + && getBaseMetaTileEntity().isActive())) + .widget(TextWidget.dynamicString(() -> "UUA Made: " + mAmplifierProduced) + .setDefaultColor(COLOR_TEXT_WHITE.get()) + .setEnabled(widget -> getBaseMetaTileEntity().getErrorDisplayID() == 0 + && getBaseMetaTileEntity().isActive())) + .widget(TextWidget.dynamicString(() -> "UUA Used: " + mAmplifierUsed) + .setDefaultColor(COLOR_TEXT_WHITE.get()) + .setEnabled(widget -> getBaseMetaTileEntity().getErrorDisplayID() == 0 + && getBaseMetaTileEntity().isActive())) + .widget(TextWidget.dynamicString(() -> "UUM Made: " + mMatterProduced) + .setDefaultColor(COLOR_TEXT_WHITE.get()) + .setEnabled(widget -> getBaseMetaTileEntity().getErrorDisplayID() == 0 + && getBaseMetaTileEntity().isActive())); + } } diff --git a/src/main/java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/production/GregtechMetaTileEntity_Refinery.java b/src/main/java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/production/GregtechMetaTileEntity_Refinery.java index 9639351fbf..b557272c82 100644 --- a/src/main/java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/production/GregtechMetaTileEntity_Refinery.java +++ b/src/main/java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/production/GregtechMetaTileEntity_Refinery.java @@ -88,16 +88,6 @@ public class GregtechMetaTileEntity_Refinery extends GregtechMeta_MultiBlockBase } @Override - public boolean hasSlotInGUI() { - return false; - } - - @Override - public String getCustomGUIResourceName() { - return "MatterFabricator"; - } - - @Override public GT_Recipe_Map getRecipeMap() { return GTPP_Recipe.GTPP_Recipe_Map.sFissionFuelProcessing; } diff --git a/src/main/java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/production/GregtechMetaTileEntity_SolarTower.java b/src/main/java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/production/GregtechMetaTileEntity_SolarTower.java index 36c6d0bfa5..9b84d2c622 100644 --- a/src/main/java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/production/GregtechMetaTileEntity_SolarTower.java +++ b/src/main/java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/production/GregtechMetaTileEntity_SolarTower.java @@ -540,16 +540,6 @@ public class GregtechMetaTileEntity_SolarTower extends GregtechMeta_MultiBlockBa } @Override - public boolean hasSlotInGUI() { - return false; - } - - @Override - public String getCustomGUIResourceName() { - return null; - } - - @Override public GT_Recipe.GT_Recipe_Map getRecipeMap() { return null; } @@ -838,4 +828,9 @@ public class GregtechMetaTileEntity_SolarTower extends GregtechMeta_MultiBlockBa "Internal Heat Level: " + this.mHeatLevel, "Connected Solar Reflectors: " + this.mSolarHeaters.size() }; } + + @Override + public boolean doesBindPlayerInventory() { + return false; + } } diff --git a/src/main/java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/production/algae/GregtechMTE_AlgaePondBase.java b/src/main/java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/production/algae/GregtechMTE_AlgaePondBase.java index 938bd969f2..bf1b923a81 100644 --- a/src/main/java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/production/algae/GregtechMTE_AlgaePondBase.java +++ b/src/main/java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/production/algae/GregtechMTE_AlgaePondBase.java @@ -223,11 +223,6 @@ public class GregtechMTE_AlgaePondBase extends GregtechMeta_MultiBlockBase<Gregt } @Override - public boolean hasSlotInGUI() { - return true; - } - - @Override public GT_Recipe.GT_Recipe_Map getRecipeMap() { return null; } @@ -342,11 +337,6 @@ public class GregtechMTE_AlgaePondBase extends GregtechMeta_MultiBlockBase<Gregt } @Override - public String getCustomGUIResourceName() { - return null; - } - - @Override public void onPostTick(IGregTechTileEntity aBaseMetaTileEntity, long aTick) { super.onPostTick(aBaseMetaTileEntity, aTick); } diff --git a/src/main/java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/production/bedrock/GregtechMetaTileEntity_BedrockMiningPlatformBase.java b/src/main/java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/production/bedrock/GregtechMetaTileEntity_BedrockMiningPlatformBase.java index 50c10bab0d..fd7ebd6044 100644 --- a/src/main/java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/production/bedrock/GregtechMetaTileEntity_BedrockMiningPlatformBase.java +++ b/src/main/java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/production/bedrock/GregtechMetaTileEntity_BedrockMiningPlatformBase.java @@ -3,7 +3,6 @@ package gtPlusPlus.xmod.gregtech.common.tileentities.machines.multi.production.b import gregtech.api.GregTech_API; import gregtech.api.enums.GT_Values; import gregtech.api.enums.Textures; -import gregtech.api.gui.GT_GUIContainer_MultiMachine; import gregtech.api.interfaces.IIconContainer; import gregtech.api.interfaces.tileentity.IGregTechTileEntity; import gregtech.api.metatileentity.implementations.GT_MetaTileEntity_Hatch_Energy; @@ -25,7 +24,6 @@ import gtPlusPlus.core.util.minecraft.OreDictUtils; import gtPlusPlus.xmod.gregtech.api.enums.GregtechItemList; import gtPlusPlus.xmod.gregtech.api.metatileentity.implementations.base.GregtechMeta_MultiBlockBase; import net.minecraft.block.Block; -import net.minecraft.entity.player.InventoryPlayer; import net.minecraft.item.ItemStack; import net.minecraft.nbt.NBTTagCompound; import net.minecraftforge.common.util.ForgeDirection; @@ -83,12 +81,6 @@ public abstract class GregtechMetaTileEntity_BedrockMiningPlatformBase extends G return this.casingTextureIndex; } - public Object getClientGUI( - final int aID, final InventoryPlayer aPlayerInventory, final IGregTechTileEntity aBaseMetaTileEntity) { - return new GT_GUIContainer_MultiMachine( - aPlayerInventory, aBaseMetaTileEntity, this.getLocalName(), "OreDrillingPlant.png"); - } - public int getAmountOfOutputs() { return 1; } @@ -613,16 +605,6 @@ public abstract class GregtechMetaTileEntity_BedrockMiningPlatformBase extends G } @Override - public boolean hasSlotInGUI() { - return true; - } - - @Override - public String getCustomGUIResourceName() { - return null; - } - - @Override public String getMachineType() { return "Miner"; } diff --git a/src/main/java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/production/chemplant/GregtechMTE_ChemicalPlant.java b/src/main/java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/production/chemplant/GregtechMTE_ChemicalPlant.java index 4bdbf5e2d6..145e3c09e9 100644 --- a/src/main/java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/production/chemplant/GregtechMTE_ChemicalPlant.java +++ b/src/main/java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/production/chemplant/GregtechMTE_ChemicalPlant.java @@ -449,11 +449,6 @@ public class GregtechMTE_ChemicalPlant extends GregtechMeta_MultiBlockBase<Gregt } @Override - public boolean hasSlotInGUI() { - return true; - } - - @Override public GT_Recipe.GT_Recipe_Map getRecipeMap() { if (GTPP_Recipe.GTPP_Recipe_Map.sChemicalPlant_GT.mRecipeList.size() == 0) { generateRecipes(); @@ -564,11 +559,6 @@ public class GregtechMTE_ChemicalPlant extends GregtechMeta_MultiBlockBase<Gregt return false; } - @Override - public String getCustomGUIResourceName() { - return null; - } - // Same speed bonus as pyro oven public int getSpeedBonus() { return 50 * (this.mCoilTier - 1); @@ -1022,7 +1012,7 @@ public class GregtechMTE_ChemicalPlant extends GregtechMeta_MultiBlockBase<Gregt @Override public ArrayList<ItemStack> getStoredInputs() { ArrayList<ItemStack> tItems = super.getStoredInputs(); - if (this.hasSlotInGUI() && this.getGUIItemStack() != null) { + if (this.getGUIItemStack() != null) { tItems.add(this.getGUIItemStack()); } for (GT_MetaTileEntity_Hatch_Catalysts tHatch : mCatalystBuses) { diff --git a/src/main/java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/production/turbines/GT_MTE_LargeTurbine_Gas.java b/src/main/java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/production/turbines/GT_MTE_LargeTurbine_Gas.java index 690ddb0919..31715246fc 100644 --- a/src/main/java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/production/turbines/GT_MTE_LargeTurbine_Gas.java +++ b/src/main/java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/production/turbines/GT_MTE_LargeTurbine_Gas.java @@ -140,11 +140,6 @@ public class GT_MTE_LargeTurbine_Gas extends GregtechMetaTileEntity_LargerTurbin } @Override - public String getCustomGUIResourceName() { - return null; - } - - @Override public String getMachineType() { return "Large Gas Turbine"; } diff --git a/src/main/java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/production/turbines/GT_MTE_LargeTurbine_Plasma.java b/src/main/java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/production/turbines/GT_MTE_LargeTurbine_Plasma.java index 13efb8e276..cb011118b8 100644 --- a/src/main/java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/production/turbines/GT_MTE_LargeTurbine_Plasma.java +++ b/src/main/java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/production/turbines/GT_MTE_LargeTurbine_Plasma.java @@ -247,11 +247,6 @@ public class GT_MTE_LargeTurbine_Plasma extends GregtechMetaTileEntity_LargerTur } @Override - public String getCustomGUIResourceName() { - return null; - } - - @Override public String getMachineType() { return "Large Plasma Turbine"; } diff --git a/src/main/java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/production/turbines/GT_MTE_LargeTurbine_SCSteam.java b/src/main/java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/production/turbines/GT_MTE_LargeTurbine_SCSteam.java index 694cdf8f6b..c5b4697b1c 100644 --- a/src/main/java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/production/turbines/GT_MTE_LargeTurbine_SCSteam.java +++ b/src/main/java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/production/turbines/GT_MTE_LargeTurbine_SCSteam.java @@ -94,11 +94,6 @@ public class GT_MTE_LargeTurbine_SCSteam extends GregtechMetaTileEntity_LargerTu } @Override - public String getCustomGUIResourceName() { - return null; - } - - @Override public String getMachineType() { return "Large Supercritical Steam Turbine"; } diff --git a/src/main/java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/production/turbines/GT_MTE_LargeTurbine_SHSteam.java b/src/main/java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/production/turbines/GT_MTE_LargeTurbine_SHSteam.java index c9fd85d00f..d913abf9a8 100644 --- a/src/main/java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/production/turbines/GT_MTE_LargeTurbine_SHSteam.java +++ b/src/main/java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/production/turbines/GT_MTE_LargeTurbine_SHSteam.java @@ -167,11 +167,6 @@ public class GT_MTE_LargeTurbine_SHSteam extends GregtechMetaTileEntity_LargerTu } @Override - public String getCustomGUIResourceName() { - return null; - } - - @Override public String getMachineType() { return "Large Super-heated Steam Turbine"; } diff --git a/src/main/java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/production/turbines/GT_MTE_LargeTurbine_Steam.java b/src/main/java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/production/turbines/GT_MTE_LargeTurbine_Steam.java index 70c34c00a6..cb58c8acc5 100644 --- a/src/main/java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/production/turbines/GT_MTE_LargeTurbine_Steam.java +++ b/src/main/java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/production/turbines/GT_MTE_LargeTurbine_Steam.java @@ -175,11 +175,6 @@ public class GT_MTE_LargeTurbine_Steam extends GregtechMetaTileEntity_LargerTurb } @Override - public String getCustomGUIResourceName() { - return null; - } - - @Override public String getMachineType() { return "Large Steam Turbine"; } diff --git a/src/main/java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/production/turbines/GregtechMetaTileEntity_LargerTurbineBase.java b/src/main/java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/production/turbines/GregtechMetaTileEntity_LargerTurbineBase.java index bc1639a052..08e0f336ce 100644 --- a/src/main/java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/production/turbines/GregtechMetaTileEntity_LargerTurbineBase.java +++ b/src/main/java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/production/turbines/GregtechMetaTileEntity_LargerTurbineBase.java @@ -12,7 +12,6 @@ import com.gtnewhorizon.structurelib.structure.ISurvivalBuildEnvironment; import com.gtnewhorizon.structurelib.structure.StructureDefinition; import gregtech.api.enums.Materials; import gregtech.api.enums.Textures; -import gregtech.api.gui.GT_GUIContainer_MultiMachine; import gregtech.api.interfaces.ITexture; import gregtech.api.interfaces.metatileentity.IMetaTileEntity; import gregtech.api.interfaces.tileentity.IGregTechTileEntity; @@ -38,7 +37,6 @@ import gtPlusPlus.xmod.gregtech.api.metatileentity.implementations.base.Gregtech import java.util.ArrayList; import net.minecraft.block.Block; import net.minecraft.entity.player.EntityPlayer; -import net.minecraft.entity.player.InventoryPlayer; import net.minecraft.item.ItemStack; import net.minecraft.nbt.NBTTagCompound; import net.minecraft.util.EnumChatFormatting; @@ -262,11 +260,6 @@ public abstract class GregtechMetaTileEntity_LargerTurbineBase return getMaxEfficiency(aStack) > 0; } - public Object getClientGUI(int aID, InventoryPlayer aPlayerInventory, IGregTechTileEntity aBaseMetaTileEntity) { - return new GT_GUIContainer_MultiMachine( - aPlayerInventory, aBaseMetaTileEntity, getLocalName(), "LargeTurbine.png"); - } - public Block getCasingBlock() { return ModBlocks.blockSpecialMultiCasings; } @@ -275,11 +268,6 @@ public abstract class GregtechMetaTileEntity_LargerTurbineBase return ModBlocks.blockSpecialMultiCasings; } - @Override - public final boolean hasSlotInGUI() { - return true; - } - public abstract int getCasingMeta(); public byte getTurbineShaftMeta() { diff --git a/src/main/java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/storage/GregtechMetaTileEntity_MultiTank.java b/src/main/java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/storage/GregtechMetaTileEntity_MultiTank.java index 4ec9d0347f..d7e4a45191 100644 --- a/src/main/java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/storage/GregtechMetaTileEntity_MultiTank.java +++ b/src/main/java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/storage/GregtechMetaTileEntity_MultiTank.java @@ -202,16 +202,6 @@ else { } @Override - public boolean hasSlotInGUI() { - return false; - } - - @Override - public String getCustomGUIResourceName() { - return null; - } - - @Override public GT_Recipe.GT_Recipe_Map getRecipeMap() { return null; } diff --git a/src/main/java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/storage/GregtechMetaTileEntity_PowerSubStationController.java b/src/main/java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/storage/GregtechMetaTileEntity_PowerSubStationController.java index b2cd2b9369..4a02190bf5 100644 --- a/src/main/java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/storage/GregtechMetaTileEntity_PowerSubStationController.java +++ b/src/main/java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/storage/GregtechMetaTileEntity_PowerSubStationController.java @@ -13,9 +13,21 @@ import com.gtnewhorizon.structurelib.StructureLibAPI; import com.gtnewhorizon.structurelib.alignment.constructable.ChannelDataAccessor; import com.gtnewhorizon.structurelib.alignment.constructable.ISurvivalConstructable; import com.gtnewhorizon.structurelib.structure.*; +import com.gtnewhorizons.modularui.api.drawable.Text; +import com.gtnewhorizons.modularui.api.forge.PlayerMainInvWrapper; +import com.gtnewhorizons.modularui.api.screen.ModularWindow; +import com.gtnewhorizons.modularui.api.screen.UIBuildContext; +import com.gtnewhorizons.modularui.common.widget.DrawableWidget; +import com.gtnewhorizons.modularui.common.widget.FakeSyncWidget; +import com.gtnewhorizons.modularui.common.widget.ProgressBar; +import com.gtnewhorizons.modularui.common.widget.SlotGroup; +import com.gtnewhorizons.modularui.common.widget.SlotWidget; +import com.gtnewhorizons.modularui.common.widget.TextWidget; import gregtech.api.enums.GT_Values; import gregtech.api.enums.TAE; import gregtech.api.enums.Textures; +import gregtech.api.gui.modularui.GT_UIInfos; +import gregtech.api.gui.modularui.GT_UITextures; import gregtech.api.interfaces.ITexture; import gregtech.api.interfaces.metatileentity.IMetaTileEntity; import gregtech.api.interfaces.tileentity.IGregTechTileEntity; @@ -36,13 +48,11 @@ import gtPlusPlus.core.util.Utils; import gtPlusPlus.core.util.math.MathUtils; import gtPlusPlus.core.util.minecraft.PlayerUtils; import gtPlusPlus.preloader.asm.AsmConfig; -import gtPlusPlus.xmod.gregtech.api.gui.CONTAINER_PowerSubStation; -import gtPlusPlus.xmod.gregtech.api.gui.GUI_PowerSubStation; +import gtPlusPlus.xmod.gregtech.api.gui.GTPP_UITextures; import gtPlusPlus.xmod.gregtech.api.metatileentity.implementations.base.GregtechMeta_MultiBlockBase; import javax.annotation.Nullable; import net.minecraft.block.Block; import net.minecraft.entity.player.EntityPlayer; -import net.minecraft.entity.player.InventoryPlayer; import net.minecraft.item.ItemStack; import net.minecraft.nbt.NBTTagCompound; import net.minecraft.util.EnumChatFormatting; @@ -141,37 +151,12 @@ public class GregtechMetaTileEntity_PowerSubStationController } @Override - public boolean hasSlotInGUI() { - return true; - } - - @Override - public String getCustomGUIResourceName() { - return null; - } - - @Override public boolean onRightclick(IGregTechTileEntity aBaseMetaTileEntity, EntityPlayer aPlayer) { // if (mBatteryCapacity <= 0) return false; - if (!aBaseMetaTileEntity.isClientSide()) { - aBaseMetaTileEntity.openGUI(aPlayer); - } + GT_UIInfos.openGTTileEntityUI(aBaseMetaTileEntity, aPlayer); return true; } - @Override - public Object getClientGUI( - final int aID, final InventoryPlayer aPlayerInventory, final IGregTechTileEntity aBaseMetaTileEntity) { - return new GUI_PowerSubStation( - aPlayerInventory, aBaseMetaTileEntity, this.getLocalName(), "Ergon Energy - Sub Station"); - } - - @Override - public Object getServerGUI( - final int aID, final InventoryPlayer aPlayerInventory, final IGregTechTileEntity aBaseMetaTileEntity) { - return new CONTAINER_PowerSubStation(aPlayerInventory, aBaseMetaTileEntity); - } - private void checkMachineProblem(String msg, int xOff, int yOff, int zOff) { final IGregTechTileEntity te = this.getBaseMetaTileEntity(); final Block tBlock = te.getBlockOffset(xOff, yOff, zOff); @@ -838,4 +823,97 @@ public class GregtechMetaTileEntity_PowerSubStationController PlayerUtils.messagePlayer(aPlayer, "Sub-Station is now inputting power into the controller."); } } + + @Override + public boolean doesBindPlayerInventory() { + return false; + } + + @Override + public int getGUIWidth() { + return 196; + } + + @Override + public int getGUIHeight() { + return 191; + } + + @Override + public void addGregTechLogo(ModularWindow.Builder builder) { + builder.widget(new DrawableWidget() + .setDrawable(getGUITextureSet().getGregTechLogo()) + .setSize(17, 17) + .setPos(175, 166)); + } + + @Override + public void addUIWidgets(ModularWindow.Builder builder, UIBuildContext buildContext) { + builder.widget(new DrawableWidget() + .setDrawable(GT_UITextures.PICTURE_SCREEN_BLACK) + .setPos(4, 4) + .setSize(149, 149)) + .widget(new SlotWidget(inventoryHandler, 0).setPos(154, 4)) + .widget(new SlotWidget(inventoryHandler, 1) + .setAccess(true, false) + .setPos(154, 22)) + .widget(SlotGroup.ofItemHandler(new PlayerMainInvWrapper(buildContext.getPlayer().inventory), 9) + .endAtSlot(8) + .build() + .setPos(7, 166)) + .widget(TextWidget.dynamicString(() -> getBaseMetaTileEntity().getErrorDisplayID() == 0 + ? getBaseMetaTileEntity().isActive() ? "Running perfectly" : "Turn on with Mallet" + : "") + .setSynced(false) + .setDefaultColor(COLOR_TEXT_WHITE.get()) + .setPos(10, 8)) + .widget(new FakeSyncWidget.BooleanSyncer( + () -> getBaseMetaTileEntity().isActive(), + val -> getBaseMetaTileEntity().setActive(val))) + .widget(new FakeSyncWidget.IntegerSyncer( + () -> getBaseMetaTileEntity().getErrorDisplayID(), + val -> getBaseMetaTileEntity().setErrorDisplayID(val))) + .widget(new TextWidget("In") + .setDefaultColor(COLOR_TEXT_WHITE.get()) + .setPos(178, 10)) + .widget(new TextWidget("Out") + .setDefaultColor(COLOR_TEXT_WHITE.get()) + .setPos(176, 28)) + .widget(TextWidget.dynamicString( + () -> "Avg In: " + GT_Utility.formatNumbers(getAverageEuAdded()) + " EU") + .setDefaultColor(COLOR_TEXT_WHITE.get()) + .setPos(10, 20)) + .widget(TextWidget.dynamicString( + () -> "Avg Out: " + GT_Utility.formatNumbers(getAverageEuConsumed()) + " EU") + .setDefaultColor(COLOR_TEXT_WHITE.get()) + .setPos(10, 30)) + .widget(new DrawableWidget() + .setDrawable(GTPP_UITextures.PICTURE_ENERGY_FRAME) + .setPos(4, 155) + .setSize(149, 7)) + .widget(new ProgressBar() + .setProgress(this::getProgress) + .setTexture(GTPP_UITextures.PROGRESSBAR_PSS_ENERGY, 147) + .setDirection(ProgressBar.Direction.RIGHT) + .setPos(5, 156) + .setSize(147, 5)) + .widget(new TextWidget("Stored:") + .setDefaultColor(COLOR_TEXT_WHITE.get()) + .setPos(10, 132)) + .widget(TextWidget.dynamicText(() -> { + int colorScale = (int) (getProgress() * 100 * 2.55); + return new Text(GT_Utility.formatNumbers( + getBaseMetaTileEntity().getStoredEU()) + " EU") + .color(Utils.rgbtoHexValue((255 - colorScale), colorScale, 0)); + }) + .setPos(10, 142)) + .widget(TextWidget.dynamicString(() -> GT_Utility.formatNumbers(getProgress()) + "%") + .setDefaultColor(COLOR_TEXT_WHITE.get()) + .setPos(70, 155)); + } + + private float getProgress() { + return (float) getBaseMetaTileEntity().getStoredEU() + / getBaseMetaTileEntity().getEUCapacity(); + } } diff --git a/src/main/java/gtPlusPlus/xmod/gregtech/common/tileentities/misc/GT_TileEntity_ComputerCube.java b/src/main/java/gtPlusPlus/xmod/gregtech/common/tileentities/misc/GT_TileEntity_ComputerCube.java index 4a24de7c5a..6aec31dc1b 100644 --- a/src/main/java/gtPlusPlus/xmod/gregtech/common/tileentities/misc/GT_TileEntity_ComputerCube.java +++ b/src/main/java/gtPlusPlus/xmod/gregtech/common/tileentities/misc/GT_TileEntity_ComputerCube.java @@ -4,10 +4,24 @@ import static gregtech.api.enums.GT_Values.V; import static gregtech.api.util.GT_Recipe.GT_Recipe_Map.sScannerFakeRecipes; import Ic2ExpReactorPlanner.SimulationData; +import com.gtnewhorizons.modularui.api.ModularUITextures; +import com.gtnewhorizons.modularui.api.forge.IItemHandlerModifiable; +import com.gtnewhorizons.modularui.api.screen.ModularWindow; +import com.gtnewhorizons.modularui.api.screen.UIBuildContext; +import com.gtnewhorizons.modularui.common.internal.wrapper.BaseSlot; +import com.gtnewhorizons.modularui.common.widget.ButtonWidget; +import com.gtnewhorizons.modularui.common.widget.DrawableWidget; +import com.gtnewhorizons.modularui.common.widget.FakeSyncWidget; +import com.gtnewhorizons.modularui.common.widget.ProgressBar; +import com.gtnewhorizons.modularui.common.widget.SlotWidget; +import com.gtnewhorizons.modularui.common.widget.TextWidget; import cpw.mods.fml.common.FMLCommonHandler; import gregtech.api.GregTech_API; import gregtech.api.enums.*; +import gregtech.api.gui.modularui.GT_UIInfos; +import gregtech.api.gui.modularui.GT_UITextures; import gregtech.api.interfaces.ITexture; +import gregtech.api.interfaces.modularui.IAddGregtechLogo; import gregtech.api.interfaces.tileentity.IGregTechTileEntity; import gregtech.api.metatileentity.MetaTileEntity; import gregtech.api.metatileentity.implementations.GT_MetaTileEntity_BasicTank; @@ -17,24 +31,27 @@ import gregtech.api.util.GT_Recipe.GT_Recipe_Map; import gregtech.common.items.behaviors.Behaviour_DataOrb; import gtPlusPlus.api.objects.Logger; import gtPlusPlus.core.lib.CORE; +import gtPlusPlus.core.util.Utils; import gtPlusPlus.core.util.math.MathUtils; -import gtPlusPlus.xmod.gregtech.api.gui.computer.GT_Container_ComputerCube; -import gtPlusPlus.xmod.gregtech.api.gui.computer.GT_GUIContainer_ComputerCube; +import gtPlusPlus.xmod.gregtech.api.gui.GTPP_UITextures; +import gtPlusPlus.xmod.gregtech.api.gui.widget.DataStickSlotWidget; import gtPlusPlus.xmod.gregtech.common.blocks.textures.TexturesGtBlock; import gtPlusPlus.xmod.gregtech.common.computer.GT_Computercube_Description; import gtPlusPlus.xmod.gregtech.common.computer.GT_Computercube_Simulator; import java.util.ArrayList; import java.util.Collections; +import java.util.List; +import java.util.stream.Collectors; import net.minecraft.entity.Entity; import net.minecraft.entity.item.EntityItem; import net.minecraft.entity.player.EntityPlayer; -import net.minecraft.entity.player.InventoryPlayer; import net.minecraft.init.Items; +import net.minecraft.inventory.Slot; import net.minecraft.item.ItemStack; import net.minecraft.nbt.NBTTagCompound; import net.minecraft.world.World; -public class GT_TileEntity_ComputerCube extends GT_MetaTileEntity_BasicTank { +public class GT_TileEntity_ComputerCube extends GT_MetaTileEntity_BasicTank implements IAddGregtechLogo { public static int MODE_MAIN = 0; public static int MODE_REACTOR_PLANNER = 1; @@ -92,20 +109,6 @@ public class GT_TileEntity_ComputerCube extends GT_MetaTileEntity_BasicTank { } @Override - public Object getServerGUI( - final int aID, final InventoryPlayer aPlayerInventory, final IGregTechTileEntity aBaseMetaTileEntity) { - Logger.INFO("CC-Sever ID: " + aID); - return new GT_Container_ComputerCube(aPlayerInventory, aBaseMetaTileEntity, mMode); - } - - @Override - public Object getClientGUI( - final int aID, final InventoryPlayer aPlayerInventory, final IGregTechTileEntity aBaseMetaTileEntity) { - Logger.INFO("CC-Client ID: " + aID); - return new GT_GUIContainer_ComputerCube(aPlayerInventory, aBaseMetaTileEntity, mMode); - } - - @Override public String[] getDescription() { return new String[] { this.mDescription, @@ -119,10 +122,7 @@ public class GT_TileEntity_ComputerCube extends GT_MetaTileEntity_BasicTank { @Override public boolean onRightclick(final IGregTechTileEntity aBaseMetaTileEntity, final EntityPlayer aPlayer) { - if (aBaseMetaTileEntity.isClientSide()) { - return true; - } - aBaseMetaTileEntity.openGUI(aPlayer, mMode); + GT_UIInfos.openGTTileEntityUI(aBaseMetaTileEntity, aPlayer); return true; } @@ -1089,4 +1089,476 @@ public class GT_TileEntity_ComputerCube extends GT_MetaTileEntity_BasicTank { private ItemStack getSpecialSlot() { return this.mInventory[54]; } + + @Override + public boolean useModularUI() { + return true; + } + + @Override + public void addGregTechLogo(ModularWindow.Builder builder) {} + + @Override + public int getGUIWidth() { + return mMode == 5 ? 226 : 176; + } + + @Override + public boolean doesBindPlayerInventory() { + return mMode != 1 && mMode != 5; + } + + @Override + public void addUIWidgets(ModularWindow.Builder builder, UIBuildContext buildContext) { + switch (mMode) { + case 0: + addPage0(builder); + break; + case 1: + addPage1(builder); + break; + case 2: + addPage2(builder); + break; + case 3: + addPage3(builder); + break; + case 4: + addPage4(builder); + break; + case 5: + addPage5(builder); + break; + case 6: + addPage6(builder); + break; + } + + builder.widget(new ButtonWidget() + .setOnClick((clickData, widget) -> { + if (clickData.mouseButton == 0) { + switchModeForward(); + } else if (clickData.mouseButton == 1) { + switchModeBackward(); + } + if (!widget.isClient()) { + GT_UIInfos.openGTTileEntityUI( + getBaseMetaTileEntity(), widget.getContext().getPlayer()); + } + }) + .setBackground(GTPP_UITextures.BUTTON_STANDARD_16x16, GTPP_UITextures.OVERLAY_BUTTON_COMPUTER_MODE) + .setPos(156 + (mMode == 5 ? 50 : 0), 4) + .setSize(16, 16)); + } + + private void addPage0(ModularWindow.Builder builder) { + builder.widget(new DrawableWidget() + .setDrawable(GTPP_UITextures.PICTURE_COMPUTER_TOP) + .setPos(32, 4) + .setSize(112, 76)) + .widget(new ProgressBar() + .setProgress(() -> (float) getBaseMetaTileEntity().getStoredEU() + / getBaseMetaTileEntity().getEUCapacity()) + .setTexture(GTPP_UITextures.PROGRESSBAR_COMPUTER_ENERGY, 96) + .setDirection(ProgressBar.Direction.RIGHT) + .setPos(44, 8) + .setSize(96, 5)) + .widget(new TextWidget("Solaris 1.7.10") + .setDefaultColor(Utils.rgbtoHexValue(100, 190, 255)) + .setPos(56, 70)); + } + + private void addPage1(ModularWindow.Builder builder) { + builder.widget(new DrawableWidget() + .setDrawable(GT_UITextures.PICTURE_SCREEN_BLACK) + .setPos(4, 103) + .setSize(150, 59)) + .widget(new DrawableWidget() + .setDrawable(ModularUITextures.ITEM_SLOT) + .setPos(4, 4) + .setSize(146, 98)) + .widget(new DrawableWidget() + .setDrawable(GTPP_UITextures.PICTURE_V202) + .setPos(155, 103) + .setSize(17, 5)) + .widget(new ButtonWidget() + .setOnClick((clickData, widget) -> saveNuclearReactor()) + .setBackground(GTPP_UITextures.BUTTON_STANDARD_16x16, GTPP_UITextures.OVERLAY_BUTTON_SAVE) + .setPos(156, 54) + .setSize(16, 16)) + .widget(new ButtonWidget() + .setOnClick((clickData, widget) -> loadNuclearReactor()) + .setBackground(GTPP_UITextures.BUTTON_STANDARD_16x16, GTPP_UITextures.OVERLAY_BUTTON_LOAD) + .setPos(156, 70) + .setSize(16, 16)) + .widget(new ButtonWidget() + .setOnClick((clickData, widget) -> switchNuclearReactor()) + .setBackground( + GTPP_UITextures.BUTTON_STANDARD_16x16, GTPP_UITextures.OVERLAY_BUTTON_NUCLEAR_SWITCH) + .setPos(156, 86) + .setSize(16, 16)); + SlotWidget displaySlot = new NuclearSlotWidget(inventoryHandler, 54, null); + for (int i = 0; i < 9 * 6; i++) { + builder.widget(new NuclearSlotWidget(inventoryHandler, i, displaySlot.getMcSlot()) + .setBackground(GT_UITextures.TRANSPARENT) + .setPos(5 + (i % 9) * 16, 5 + (i / 9) * 16)); + } + builder.widget(displaySlot + .setBackground(getGUITextureSet().getItemSlot(), GTPP_UITextures.OVERLAY_SLOT_ARROW_4) + .setPos(152, 27)); + builder.widget(new TextWidget("Reactorstats:") + .setDefaultColor(COLOR_TEXT_WHITE.get()) + .setPos(7, 108)) + .widget(TextWidget.dynamicString(() -> GT_Utility.formatNumbers(mEU) + "EU at " + mEUOut + "EU/t") + .setDefaultColor(COLOR_TEXT_WHITE.get()) + .setPos(7, 120)) + .widget(TextWidget.dynamicString(() -> "HEM: " + (mHEM / 10000.0F)) + .setDefaultColor(COLOR_TEXT_WHITE.get()) + .setPos(7, 128)) + .widget(TextWidget.dynamicString(() -> + GT_Utility.formatNumbers(mHeat) + "/" + GT_Utility.formatNumbers(mMaxHeat) + "Heat") + .setDefaultColor(COLOR_TEXT_WHITE.get()) + .setPos(7, 136)) + .widget(TextWidget.dynamicString(() -> "Explosionpower: " + (mExplosionStrength / 100.0F)) + .setDefaultColor(COLOR_TEXT_WHITE.get()) + .setPos(7, 144)) + .widget(TextWidget.dynamicString(() -> "Runtime: " + ((mProgress > 0) ? (mProgress / 20) : 0) + "secs") + .setDefaultColor(COLOR_TEXT_WHITE.get()) + .setPos(7, 152)); + } + + private void addPage2(ModularWindow.Builder builder) { + builder.widget(new DrawableWidget() + .setDrawable(GT_UITextures.PICTURE_SCREEN_BLACK) + .setPos(48, 4) + .setSize(81, 67)); + builder.widget(new DataStickSlotWidget(inventoryHandler, 54).setPos(7, 27)) + .widget(new SlotWidget(inventoryHandler, 55) + .setBackground(getGUITextureSet().getItemSlot(), GT_UITextures.OVERLAY_SLOT_MICROSCOPE) + .setPos(25, 27)) + .widget(new SlotWidget(inventoryHandler, 56) + .setAccess(true, false) + .setPos(133, 27)) + .widget(new SlotWidget(inventoryHandler, 57) + .setAccess(true, false) + .setPos(151, 27)); + builder.widget(new TextWidget("Scanner") + .setDefaultColor(COLOR_TEXT_WHITE.get()) + .setEnabled(widget -> mProgress == 0) + .setPos(51, 7)) + .widget(new TextWidget("Can be used to") + .setDefaultColor(COLOR_TEXT_WHITE.get()) + .setEnabled(widget -> mProgress == 0) + .setPos(51, 24)) + .widget(new TextWidget("scan things") + .setDefaultColor(COLOR_TEXT_WHITE.get()) + .setEnabled(widget -> mProgress == 0) + .setPos(51, 32)) + .widget(new TextWidget("Currently") + .setDefaultColor(Utils.rgbtoHexValue(200, 20, 20)) + .setEnabled(widget -> mProgress == 0) + .setPos(51, 48)) + .widget(new TextWidget("Disabled") + .setDefaultColor(Utils.rgbtoHexValue(200, 20, 20)) + .setEnabled(widget -> mProgress == 0) + .setPos(51, 56)) + .widget(new TextWidget("Progress:") + .setDefaultColor(COLOR_TEXT_WHITE.get()) + .setEnabled(widget -> mProgress != 0) + .setPos(51, 24)) + .widget(TextWidget.dynamicString(() -> MathUtils.findPercentage( + mProgress, getBaseMetaTileEntity().getMaxProgress()) + + " %") + .setDefaultColor(COLOR_TEXT_WHITE.get()) + .setEnabled(widget -> mProgress != 0) + .setPos(51, 32)) + .widget(new FakeSyncWidget.IntegerSyncer(() -> mProgress, val -> mProgress = val)); + } + + private void addPage3(ModularWindow.Builder builder) { + builder.widget(new DrawableWidget() + .setDrawable(GT_UITextures.PICTURE_SCREEN_BLACK) + .setPos(4, 4) + .setSize(86, 41)) + .widget(new DrawableWidget() + .setDrawable(GTPP_UITextures.PICTURE_ARROWS_SEPARATE) + .setPos(110, 23) + .setSize(40, 40)) + .widget(new ButtonWidget() + .setOnClick((clickData, widget) -> switchCentrifugePageBackward()) + .setBackground(GTPP_UITextures.BUTTON_STANDARD_16x16, GTPP_UITextures.OVERLAY_BUTTON_ARROW_LEFT) + .setPos(88, 65) + .setSize(16, 16)) + .widget(new ButtonWidget() + .setOnClick((clickData, widget) -> switchCentrifugePageForward()) + .setBackground( + GTPP_UITextures.BUTTON_STANDARD_16x16, GTPP_UITextures.OVERLAY_BUTTON_ARROW_RIGHT) + .setPos(104, 65) + .setSize(16, 16)) + .widget(SlotWidget.phantom(inventoryHandler, 59) + .disableInteraction() + .setBackground(getGUITextureSet().getItemSlot(), GT_UITextures.OVERLAY_SLOT_CENTRIFUGE) + .setPos(121, 34)) + .widget(SlotWidget.phantom(inventoryHandler, 60) + .disableInteraction() + .setBackground(getGUITextureSet().getItemSlot(), GT_UITextures.OVERLAY_SLOT_CANISTER) + .setPos(91, 4)) + .widget(SlotWidget.phantom(inventoryHandler, 61) + .disableInteraction() + .setPos(121, 4)) + .widget(SlotWidget.phantom(inventoryHandler, 62) + .disableInteraction() + .setPos(151, 34)) + .widget(SlotWidget.phantom(inventoryHandler, 63) + .disableInteraction() + .setPos(121, 64)) + .widget(SlotWidget.phantom(inventoryHandler, 64) + .disableInteraction() + .setPos(91, 34)) + .widget(new TextWidget("Centrifuge") + .setDefaultColor(COLOR_TEXT_WHITE.get()) + .setPos(7, 7)) + .widget(TextWidget.dynamicString(() -> + "Recipe: " + (mMaxHeat + 1) + "/" + GT_Recipe_Map.sCentrifugeRecipes.mRecipeList.size()) + .setDefaultColor(COLOR_TEXT_WHITE.get()) + .setPos(7, 23)) + .widget(TextWidget.dynamicString(() -> "EU: " + GT_Utility.formatNumbers(mEU)) + .setDefaultColor(COLOR_TEXT_WHITE.get()) + .setPos(7, 31)); + } + + private void addPage4(ModularWindow.Builder builder) { + builder.widget(new DrawableWidget() + .setDrawable(GT_UITextures.PICTURE_SCREEN_BLACK) + .setPos(4, 4) + .setSize(116, 61)) + .widget(new DrawableWidget() + .setDrawable(GTPP_UITextures.PICTURE_ARROWS_FUSION) + .setPos(121, 23) + .setSize(29, 40)) + .widget(new ButtonWidget() + .setOnClick((clickData, widget) -> switchFusionPageBackward()) + .setBackground(GTPP_UITextures.BUTTON_STANDARD_16x16, GTPP_UITextures.OVERLAY_BUTTON_ARROW_LEFT) + .setPos(88, 65) + .setSize(16, 16)) + .widget(new ButtonWidget() + .setOnClick((clickData, widget) -> switchFusionPageForward()) + .setBackground( + GTPP_UITextures.BUTTON_STANDARD_16x16, GTPP_UITextures.OVERLAY_BUTTON_ARROW_RIGHT) + .setPos(104, 65) + .setSize(16, 16)) + .widget(SlotWidget.phantom(inventoryHandler, 59) + .disableInteraction() + .setPos(121, 4)) + .widget(SlotWidget.phantom(inventoryHandler, 60) + .disableInteraction() + .setPos(121, 64)) + .widget(SlotWidget.phantom(inventoryHandler, 61) + .disableInteraction() + .setPos(151, 34)) + .widget(new TextWidget("Fusionreactor") + .setDefaultColor(COLOR_TEXT_WHITE.get()) + .setPos(7, 7)) + .widget(TextWidget.dynamicString(() -> "Recipe: " + (mMaxHeat + 1) + "/" + + GT_TileEntity_ComputerCube.sFusionReactorRecipes.size()) + .setDefaultColor(COLOR_TEXT_WHITE.get()) + .setPos(7, 15)) + .widget(TextWidget.dynamicString(() -> "Start: " + GT_Utility.formatNumbers(mEU) + "EU") + .setDefaultColor(COLOR_TEXT_WHITE.get()) + .setPos(7, 23)) + .widget(TextWidget.dynamicString(() -> "EU/t: " + GT_Utility.formatNumbers(mEUOut)) + .setDefaultColor(COLOR_TEXT_WHITE.get()) + .setPos(7, 31)) + .widget(TextWidget.dynamicString(() -> GT_Utility.formatNumbers(mHeat) + " Ticks") + .setDefaultColor(COLOR_TEXT_WHITE.get()) + .setPos(7, 39)) + .widget(TextWidget.dynamicString(() -> GT_TileEntity_ComputerCube.sFusionReactorRecipes + .get(mMaxHeat) + .mFluidOutputs[0] + .getLocalizedName()) + .setDefaultColor(COLOR_TEXT_WHITE.get()) + .setPos(7, 55)) + .widget(TextWidget.dynamicString(() -> mEUOut < 0 + ? "IN: " + GT_Utility.formatNumbers(-mEUOut * mHeat) + "EU" + : "OUT: " + GT_Utility.formatNumbers(mEUOut * mHeat) + "EU") + .setDefaultColor(COLOR_TEXT_WHITE.get()) + .setPos(7, 47)); + } + + private void addPage5(ModularWindow.Builder builder) { + builder.widget(new DrawableWidget() + .setDrawable(GT_UITextures.PICTURE_SCREEN_BLACK) + .setPos(4, 4) + .setSize(200, 141)) + .widget(new DrawableWidget() + .setDrawable(() -> mExplosionStrength != 0 ? GTPP_UITextures.PICTURE_COMPUTER_GRID : null) + .setPos(152, 6) + .setSize(50, 50)) + .widget(new ButtonWidget() + .setOnClick((clickData, widget) -> switchDescriptionPageBackward()) + .setBackground(GTPP_UITextures.BUTTON_STANDARD_16x16, GTPP_UITextures.OVERLAY_BUTTON_ARROW_LEFT) + .setPos(190, 146) + .setSize(16, 16)) + .widget(new ButtonWidget() + .setOnClick((clickData, widget) -> switchDescriptionPageForward()) + .setBackground( + GTPP_UITextures.BUTTON_STANDARD_16x16, GTPP_UITextures.OVERLAY_BUTTON_ARROW_RIGHT) + .setPos(206, 146) + .setSize(16, 16)); + for (int i = 0; i < 5; i++) { + builder.widget(SlotWidget.phantom(inventoryHandler, i + 59) + .disableInteraction() + .setPos(205, 37 + i * 18)); + } + for (int i = 0; i < 9; i++) { + builder.widget(SlotWidget.phantom(inventoryHandler, i + 64) + .disableInteraction() + .setBackground(GT_UITextures.TRANSPARENT) + .setPos(152 + (i % 3) * 16, 6 + (i / 3) * 16)); + } + int descriptionMaxLines = GT_Computercube_Description.sDescriptions.stream() + .sorted((d1, d2) -> d2.mDescription.length - d1.mDescription.length) + .collect(Collectors.toList()) + .get(0) + .mDescription + .length; + for (int i = 0; i < descriptionMaxLines; i++) { + final int index = i; + builder.widget(TextWidget.dynamicString(() -> { + if (mMaxHeat >= 0 && mMaxHeat < GT_Computercube_Description.sDescriptions.size()) { + String[] descriptions = + GT_Computercube_Description.sDescriptions.get(mMaxHeat).mDescription; + if (index < descriptions.length) { + return descriptions[index]; + } + } + return ""; + }) + .setDefaultColor(COLOR_TEXT_WHITE.get()) + .setPos(7, 7 + index * 8)); + } + } + + private void addPage6(ModularWindow.Builder builder) { + builder.widget(new DrawableWidget() + .setDrawable(GT_UITextures.PICTURE_SCREEN_BLACK) + .setPos(4, 4) + .setSize(86, 41)) + .widget(new DrawableWidget() + .setDrawable(GTPP_UITextures.PICTURE_ARROWS_SEPARATE) + .setPos(110, 23) + .setSize(40, 40)) + .widget(new ButtonWidget() + .setOnClick((clickData, widget) -> switchElectrolyzerPageBackward()) + .setBackground(GTPP_UITextures.BUTTON_STANDARD_16x16, GTPP_UITextures.OVERLAY_BUTTON_ARROW_LEFT) + .setPos(88, 65) + .setSize(16, 16)) + .widget(new ButtonWidget() + .setOnClick((clickData, widget) -> switchElectrolyzerPageForward()) + .setBackground( + GTPP_UITextures.BUTTON_STANDARD_16x16, GTPP_UITextures.OVERLAY_BUTTON_ARROW_RIGHT) + .setPos(104, 65) + .setSize(16, 16)) + .widget(SlotWidget.phantom(inventoryHandler, 59) + .disableInteraction() + .setBackground(getGUITextureSet().getItemSlot(), GT_UITextures.OVERLAY_SLOT_CHARGER) + .setPos(121, 34)) + .widget(SlotWidget.phantom(inventoryHandler, 60) + .disableInteraction() + .setBackground(getGUITextureSet().getItemSlot(), GT_UITextures.OVERLAY_SLOT_CANISTER) + .setPos(91, 4)) + .widget(SlotWidget.phantom(inventoryHandler, 61) + .disableInteraction() + .setPos(121, 4)) + .widget(SlotWidget.phantom(inventoryHandler, 62) + .disableInteraction() + .setPos(151, 34)) + .widget(SlotWidget.phantom(inventoryHandler, 63) + .disableInteraction() + .setPos(121, 64)) + .widget(SlotWidget.phantom(inventoryHandler, 64) + .disableInteraction() + .setPos(91, 34)) + .widget(new TextWidget("Electrolyzer") + .setDefaultColor(COLOR_TEXT_WHITE.get()) + .setPos(7, 7)) + .widget(TextWidget.dynamicString(() -> "Recipe: " + (mMaxHeat + 1) + "/" + + GT_Recipe_Map.sElectrolyzerRecipes.mRecipeList.size()) + .setDefaultColor(COLOR_TEXT_WHITE.get()) + .setPos(7, 23)) + .widget(TextWidget.dynamicString(() -> "EU: " + GT_Utility.formatNumbers(mEU)) + .setDefaultColor(COLOR_TEXT_WHITE.get()) + .setPos(7, 31)); + } + + private class NuclearSlotWidget extends SlotWidget { + + private final Slot displaySlot; + + public NuclearSlotWidget(IItemHandlerModifiable handler, int index, Slot displaySlot) { + super(BaseSlot.phantom(handler, index)); + if (displaySlot != null) { + this.displaySlot = displaySlot; + } else { + this.displaySlot = getMcSlot(); + } + } + + @Override + protected void phantomClick(ClickData clickData, ItemStack cursorStack) { + final int aSlotIndex = getMcSlot().getSlotIndex() + 4; + final Slot tSlot = getMcSlot(); + final ItemStack tStack = tSlot.getStack(); + if (clickData.shift) { + tSlot.putStack(null); + getSimulator().slotClick(aSlotIndex, null); + return; + } + if (clickData.mouseButton == 1) { + tSlot.putStack(null); + } + if (clickData.mouseButton == 0) { + if (tStack == null) { + if (displaySlot.getStack() != null && aSlotIndex != 58) { + tSlot.putStack(displaySlot.getStack().copy()); + getSimulator() + .slotClick( + aSlotIndex, + new GT_ItemStack(displaySlot.getStack().copy())); + } else { + tSlot.putStack(new ItemStack(GT_TileEntity_ComputerCube.sReactorList.get(0).mItem, 1)); + getSimulator().slotClick(aSlotIndex, GT_TileEntity_ComputerCube.sReactorList.get(0)); + } + return; + } + for (int i = 1; i < GT_TileEntity_ComputerCube.sReactorList.size(); i++) { + if (GT_TileEntity_ComputerCube.sReactorList.get(i - 1).mItem == tStack.getItem()) { + tSlot.putStack(new ItemStack(GT_TileEntity_ComputerCube.sReactorList.get(i).mItem, 1, 0)); + getSimulator().slotClick(aSlotIndex, GT_TileEntity_ComputerCube.sReactorList.get(i)); + /*if (tSlot.getStack() != null && tSlot.getStack().getItem() == GT_ModHandler.getIC2Item("reactorIsotopeCell", 1).getItem()) { + tSlot.getStack().setItemDamage(tSlot.getStack().getMaxDamage() - 1); + }*/ + return; + } + } + tSlot.putStack(null); + getSimulator().slotClick(aSlotIndex, null); + return; + } + if (tStack == null) return; + if (tStack.stackSize < tStack.getMaxStackSize()) { + tStack.stackSize++; + return; + } + tStack.stackSize = 1; + } + + @Override + protected void handleDragAndDropServer(ClickData clickData, ItemStack draggedStack) {} + + @Override + public List<String> getExtraTooltip() { + return Collections.emptyList(); + } + } } diff --git a/src/main/java/gtPlusPlus/xmod/gregtech/common/tileentities/redstone/GT_MetaTileEntity_RedstoneBase.java b/src/main/java/gtPlusPlus/xmod/gregtech/common/tileentities/redstone/GT_MetaTileEntity_RedstoneBase.java index 2f88c6a784..9846813ba0 100644 --- a/src/main/java/gtPlusPlus/xmod/gregtech/common/tileentities/redstone/GT_MetaTileEntity_RedstoneBase.java +++ b/src/main/java/gtPlusPlus/xmod/gregtech/common/tileentities/redstone/GT_MetaTileEntity_RedstoneBase.java @@ -6,7 +6,6 @@ import gregtech.api.metatileentity.implementations.GT_MetaTileEntity_TieredMachi import gregtech.api.objects.GT_ItemStack; import gtPlusPlus.core.lib.CORE; import net.minecraft.entity.player.EntityPlayer; -import net.minecraft.entity.player.InventoryPlayer; import net.minecraft.item.ItemStack; import net.minecraft.nbt.NBTTagCompound; @@ -83,22 +82,6 @@ public abstract class GT_MetaTileEntity_RedstoneBase extends GT_MetaTileEntity_T } @Override - public Object getServerGUI( - int aID, - InventoryPlayer aPlayerInventory, - gregtech.api.interfaces.tileentity.IGregTechTileEntity aBaseMetaTileEntity) { - return null; - } - - @Override - public Object getClientGUI( - int aID, - InventoryPlayer aPlayerInventory, - gregtech.api.interfaces.tileentity.IGregTechTileEntity aBaseMetaTileEntity) { - return null; - } - - @Override public final void onOpenGUI() { super.onOpenGUI(); mOpenerCount++; diff --git a/src/main/java/gtPlusPlus/xmod/gregtech/common/tileentities/redstone/GT_MetaTileEntity_RedstoneCircuitBlock.java b/src/main/java/gtPlusPlus/xmod/gregtech/common/tileentities/redstone/GT_MetaTileEntity_RedstoneCircuitBlock.java index caba805f65..64efa84154 100644 --- a/src/main/java/gtPlusPlus/xmod/gregtech/common/tileentities/redstone/GT_MetaTileEntity_RedstoneCircuitBlock.java +++ b/src/main/java/gtPlusPlus/xmod/gregtech/common/tileentities/redstone/GT_MetaTileEntity_RedstoneCircuitBlock.java @@ -1,28 +1,38 @@ package gtPlusPlus.xmod.gregtech.common.tileentities.redstone; +import com.gtnewhorizons.modularui.api.screen.ModularWindow; +import com.gtnewhorizons.modularui.api.screen.UIBuildContext; +import com.gtnewhorizons.modularui.common.widget.ButtonWidget; +import com.gtnewhorizons.modularui.common.widget.CycleButtonWidget; +import com.gtnewhorizons.modularui.common.widget.DrawableWidget; +import com.gtnewhorizons.modularui.common.widget.FakeSyncWidget; +import com.gtnewhorizons.modularui.common.widget.SlotWidget; +import com.gtnewhorizons.modularui.common.widget.TextWidget; import gregtech.api.GregTech_API; import gregtech.api.enums.GT_Values; +import gregtech.api.gui.modularui.GT_UIInfos; +import gregtech.api.gui.modularui.GT_UITextures; import gregtech.api.interfaces.IRedstoneCircuitBlock; import gregtech.api.interfaces.ITexture; +import gregtech.api.interfaces.modularui.IAddUIWidgets; import gregtech.api.interfaces.tileentity.ICoverable; import gregtech.api.interfaces.tileentity.IGregTechTileEntity; import gregtech.api.metatileentity.MetaTileEntity; import gregtech.api.objects.GT_ItemStack; import gregtech.api.objects.GT_RenderedTexture; import gregtech.api.util.*; -import gtPlusPlus.xmod.gregtech.api.gui.computer.GT_Container_RedstoneCircuitBlock; -import gtPlusPlus.xmod.gregtech.api.gui.computer.GT_GUIContainer_RedstoneCircuitBlock; +import gtPlusPlus.xmod.gregtech.api.gui.GTPP_UITextures; import gtPlusPlus.xmod.gregtech.common.blocks.textures.TexturesGtBlock; import java.util.*; import net.minecraft.block.Block; import net.minecraft.entity.player.EntityPlayer; -import net.minecraft.entity.player.InventoryPlayer; import net.minecraft.item.ItemStack; import net.minecraft.nbt.NBTTagCompound; import net.minecraft.tileentity.TileEntity; +import net.minecraftforge.oredict.OreDictionary; public class GT_MetaTileEntity_RedstoneCircuitBlock extends GT_MetaTileEntity_RedstoneBase - implements IRedstoneCircuitBlock { + implements IRedstoneCircuitBlock, IAddUIWidgets { public int mGate = 0, mGateData[] = new int[] {0, 0, 0, 0, 0, 0, 0, 0}; public boolean bOutput = true; @@ -42,18 +52,6 @@ public class GT_MetaTileEntity_RedstoneCircuitBlock extends GT_MetaTileEntity_Re } @Override - public Object getServerGUI( - final int aID, final InventoryPlayer aPlayerInventory, final IGregTechTileEntity aBaseMetaTileEntity) { - return new GT_Container_RedstoneCircuitBlock(aPlayerInventory, aBaseMetaTileEntity); - } - - @Override - public Object getClientGUI( - final int aID, final InventoryPlayer aPlayerInventory, final IGregTechTileEntity aBaseMetaTileEntity) { - return new GT_GUIContainer_RedstoneCircuitBlock(aPlayerInventory, aBaseMetaTileEntity); - } - - @Override public boolean hasSidedRedstoneOutputBehavior() { return true; } @@ -130,10 +128,7 @@ public class GT_MetaTileEntity_RedstoneCircuitBlock extends GT_MetaTileEntity_Re @Override public boolean onRightclick(final IGregTechTileEntity aBaseMetaTileEntity, final EntityPlayer aPlayer) { - if (aBaseMetaTileEntity.isClientSide()) { - return true; - } - aBaseMetaTileEntity.openGUI(aPlayer, 147); + GT_UIInfos.openGTTileEntityUI(aBaseMetaTileEntity, aPlayer); return true; } @@ -150,10 +145,6 @@ public class GT_MetaTileEntity_RedstoneCircuitBlock extends GT_MetaTileEntity_Re if (mGateData.length != 8) mGateData = new int[] {0, 0, 0, 0, 0, 0, 0, 0}; } - public void switchOutput() { - bOutput = !bOutput; - } - public void switchGateForward(boolean aShift) { try { Set<Integer> tKeys = GregTech_API.sCircuitryBehaviors.keySet(); @@ -499,4 +490,185 @@ public class GT_MetaTileEntity_RedstoneCircuitBlock extends GT_MetaTileEntity_Re public ITexture[] getSidesActive(final byte aColor) { return new ITexture[] {getBase(), new GT_RenderedTexture(TexturesGtBlock.Casing_Redstone_Side_On)}; } + + @Override + public boolean useModularUI() { + return true; + } + + @Override + public void addUIWidgets(ModularWindow.Builder builder, UIBuildContext buildContext) { + builder.widget(new DrawableWidget() + .setDrawable(GTPP_UITextures.PICTURE_REDSTONE_CIRCUIT_SCREEN) + .setPos(43, 5) + .setSize(108, 72)); + for (int i = 0; i < 4; i++) { + final int index = i; + builder.widget(new ButtonWidget() + .setOnClick((clickData, widget) -> { + ItemStack tStack = widget.getContext() + .getPlayer() + .inventory + .getItemStack(); + if (tStack == null) { + changeGateData( + index, + clickData.mouseButton == 0 + ? clickData.shift ? +128 : +1 + : clickData.shift ? -128 : -1); + } else { + tStack = GT_Utility.copy(tStack); + if (clickData.mouseButton != 0) tStack.setItemDamage(OreDictionary.WILDCARD_VALUE); + stackGateData(index, tStack); + } + }) + .setBackground(GT_UITextures.BUTTON_STANDARD, GTPP_UITextures.OVERLAY_BUTTON_PLUS_MINUS) + .setPos(7, 5 + i * 18) + .setSize(18, 18)) + .widget(SlotWidget.phantom(inventoryHandler, i + 1) + .disableInteraction() + .setPos(25, 5 + i * 18)); + } + builder.widget(new CycleButtonWidget() + .setToggle(() -> bOutput, val -> bOutput = val) + .setVariableBackground(GT_UITextures.BUTTON_STANDARD_TOGGLE) + .setStaticTexture(GT_UITextures.OVERLAY_BUTTON_EMIT_ENERGY) + .addTooltip("Toggle EU Output") + .setPos(151, 5) + .setSize(18, 18)) + .widget(new CycleButtonWidget() + .setToggle(() -> getBaseMetaTileEntity().isActive(), val -> getBaseMetaTileEntity() + .setActive(val)) + .setVariableBackground(GT_UITextures.BUTTON_STANDARD_TOGGLE) + .setStaticTexture(GTPP_UITextures.OVERLAY_BUTTON_ACTIVE_STATE) + .addTooltip("Toggle Active State") + .setPos(151, 23) + .setSize(18, 18)) + .widget(new ButtonWidget() + .setOnClick((clickData, widget) -> { + if (clickData.mouseButton == 0) switchGateForward(clickData.shift); + else switchGateBackward(clickData.shift); + }) + .setBackground(GT_UITextures.BUTTON_STANDARD, GTPP_UITextures.OVERLAY_BUTTON_CHANGE_MODE) + .addTooltip("Change Redstone Circuit") + .setPos(151, 41) + .setSize(18, 18)); + + builder.widget(new FakeSyncWidget.IntegerSyncer(() -> mGate, val -> mGate = val)); + for (int i = 0; i < mGateData.length; i++) { + final int index = i; + builder.widget(new FakeSyncWidget.IntegerSyncer(() -> mGateData[index], val -> mGateData[index] = val)); + } + + builder.widget(new DrawableWidget() + .setDrawable(() -> { + if (getBaseMetaTileEntity().getErrorDisplayID() > 0) { + if ((getBaseMetaTileEntity().getTimer() / 5) % 2 == 0) { + return GTPP_UITextures.PICTURE_ELECTRICITY_ERROR; + } else { + return null; + } + } else { + return GTPP_UITextures.PICTURE_ELECTRICITY_FINE; + } + }) + .setPos(140, 9) + .setSize(7, 7)) + .widget(new FakeSyncWidget.IntegerSyncer( + () -> getBaseMetaTileEntity().getErrorDisplayID(), + val -> getBaseMetaTileEntity().setErrorDisplayID(val))); + + builder.widget(TextWidget.dynamicString(() -> { + GT_CircuitryBehavior tCircuit = GregTech_API.sCircuitryBehaviors.get(mGate); + if (tCircuit != null) return tCircuit.getName(); + return ""; + }) + .setSynced(false) + .setDefaultColor(COLOR_TEXT_WHITE.get()) + .setPos(46, 8)) + .widget(TextWidget.dynamicString(() -> { + GT_CircuitryBehavior tCircuit = GregTech_API.sCircuitryBehaviors.get(mGate); + if (tCircuit != null) return tCircuit.getDescription(); + return ""; + }) + .setSynced(false) + .setDefaultColor(COLOR_TEXT_WHITE.get()) + .setPos(46, 19)) + .widget(TextWidget.dynamicString(() -> { + GT_CircuitryBehavior tCircuit = GregTech_API.sCircuitryBehaviors.get(mGate); + if (tCircuit != null) return tCircuit.getDataDescription(mGateData, 0); + return ""; + }) + .setSynced(false) + .setDefaultColor(COLOR_TEXT_WHITE.get()) + .setPos(46, 33)) + .widget(TextWidget.dynamicString(() -> { + GT_CircuitryBehavior tCircuit = GregTech_API.sCircuitryBehaviors.get(mGate); + if (tCircuit != null) return tCircuit.getDataDescription(mGateData, 1); + return ""; + }) + .setSynced(false) + .setDefaultColor(COLOR_TEXT_WHITE.get()) + .setPos(46, 44)) + .widget(TextWidget.dynamicString(() -> { + GT_CircuitryBehavior tCircuit = GregTech_API.sCircuitryBehaviors.get(mGate); + if (tCircuit != null) return tCircuit.getDataDescription(mGateData, 2); + return ""; + }) + .setSynced(false) + .setDefaultColor(COLOR_TEXT_WHITE.get()) + .setPos(46, 55)) + .widget(TextWidget.dynamicString(() -> { + GT_CircuitryBehavior tCircuit = GregTech_API.sCircuitryBehaviors.get(mGate); + if (tCircuit != null) return tCircuit.getDataDescription(mGateData, 3); + return ""; + }) + .setSynced(false) + .setDefaultColor(COLOR_TEXT_WHITE.get()) + .setPos(46, 66)) + .widget(TextWidget.dynamicString(() -> { + GT_CircuitryBehavior tCircuit = GregTech_API.sCircuitryBehaviors.get(mGate); + if (tCircuit != null) { + String tString = tCircuit.getDataDisplay(mGateData, 0); + return tString == null ? GT_Utility.parseNumberToString(mGateData[0]) : tString; + } + return ""; + }) + .setSynced(false) + .setDefaultColor(COLOR_TEXT_WHITE.get()) + .setPos(99, 33)) + .widget(TextWidget.dynamicString(() -> { + GT_CircuitryBehavior tCircuit = GregTech_API.sCircuitryBehaviors.get(mGate); + if (tCircuit != null) { + String tString = tCircuit.getDataDisplay(mGateData, 1); + return tString == null ? GT_Utility.parseNumberToString(mGateData[1]) : tString; + } + return ""; + }) + .setSynced(false) + .setDefaultColor(COLOR_TEXT_WHITE.get()) + .setPos(99, 44)) + .widget(TextWidget.dynamicString(() -> { + GT_CircuitryBehavior tCircuit = GregTech_API.sCircuitryBehaviors.get(mGate); + if (tCircuit != null) { + String tString = tCircuit.getDataDisplay(mGateData, 2); + return tString == null ? GT_Utility.parseNumberToString(mGateData[2]) : tString; + } + return ""; + }) + .setSynced(false) + .setDefaultColor(COLOR_TEXT_WHITE.get()) + .setPos(99, 55)) + .widget(TextWidget.dynamicString(() -> { + GT_CircuitryBehavior tCircuit = GregTech_API.sCircuitryBehaviors.get(mGate); + if (tCircuit != null) { + String tString = tCircuit.getDataDisplay(mGateData, 3); + return tString == null ? GT_Utility.parseNumberToString(mGateData[3]) : tString; + } + return ""; + }) + .setSynced(false) + .setDefaultColor(COLOR_TEXT_WHITE.get()) + .setPos(99, 66)); + } } diff --git a/src/main/java/gtPlusPlus/xmod/gregtech/common/tileentities/storage/GT_MetaTileEntity_AdvancedCraftingTable.java b/src/main/java/gtPlusPlus/xmod/gregtech/common/tileentities/storage/GT_MetaTileEntity_AdvancedCraftingTable.java index bb9865c8e5..0b12373236 100644 --- a/src/main/java/gtPlusPlus/xmod/gregtech/common/tileentities/storage/GT_MetaTileEntity_AdvancedCraftingTable.java +++ b/src/main/java/gtPlusPlus/xmod/gregtech/common/tileentities/storage/GT_MetaTileEntity_AdvancedCraftingTable.java @@ -1,7 +1,19 @@ package gtPlusPlus.xmod.gregtech.common.tileentities.storage; +import com.gtnewhorizons.modularui.api.drawable.IDrawable; +import com.gtnewhorizons.modularui.api.screen.ModularWindow; +import com.gtnewhorizons.modularui.api.screen.UIBuildContext; +import com.gtnewhorizons.modularui.api.widget.Interactable; +import com.gtnewhorizons.modularui.common.internal.network.NetworkUtils; +import com.gtnewhorizons.modularui.common.internal.wrapper.BaseSlot; +import com.gtnewhorizons.modularui.common.widget.ButtonWidget; +import com.gtnewhorizons.modularui.common.widget.SlotGroup; +import com.gtnewhorizons.modularui.common.widget.SlotWidget; import gregtech.api.enums.GT_Values; +import gregtech.api.gui.modularui.GT_UIInfos; +import gregtech.api.gui.modularui.GT_UITextures; import gregtech.api.interfaces.ITexture; +import gregtech.api.interfaces.modularui.IAddGregtechLogo; import gregtech.api.interfaces.tileentity.IGregTechTileEntity; import gregtech.api.metatileentity.MetaTileEntity; import gregtech.api.metatileentity.implementations.GT_MetaTileEntity_BasicTank; @@ -9,20 +21,24 @@ import gregtech.api.objects.GT_RenderedTexture; import gregtech.api.util.GT_ModHandler; import gregtech.api.util.GT_Utility; import gtPlusPlus.api.objects.Logger; +import gtPlusPlus.core.interfaces.IItemBlueprint; import gtPlusPlus.core.item.general.ItemBlueprint; import gtPlusPlus.core.lib.CORE; import gtPlusPlus.core.util.math.MathUtils; -import gtPlusPlus.xmod.gregtech.api.gui.workbench.GT_Container_AdvancedWorkbench; -import gtPlusPlus.xmod.gregtech.api.gui.workbench.GT_GUIContainer_AdvancedWorkbench; +import gtPlusPlus.xmod.gregtech.api.gui.GTPP_UITextures; +import gtPlusPlus.xmod.gregtech.api.gui.widget.ElectricSlotWidget; import gtPlusPlus.xmod.gregtech.common.blocks.textures.TexturesGtBlock; +import java.io.IOException; import java.util.ArrayList; +import java.util.Collections; +import java.util.List; import net.minecraft.entity.player.EntityPlayer; -import net.minecraft.entity.player.InventoryPlayer; import net.minecraft.item.ItemStack; import net.minecraft.nbt.NBTTagCompound; import net.minecraft.nbt.NBTTagList; +import net.minecraft.network.PacketBuffer; -public class GT_MetaTileEntity_AdvancedCraftingTable extends GT_MetaTileEntity_BasicTank { +public class GT_MetaTileEntity_AdvancedCraftingTable extends GT_MetaTileEntity_BasicTank implements IAddGregtechLogo { public boolean mFlushMode = false; @@ -40,18 +56,6 @@ public class GT_MetaTileEntity_AdvancedCraftingTable extends GT_MetaTileEntity_B } @Override - public Object getServerGUI( - final int aID, final InventoryPlayer aPlayerInventory, final IGregTechTileEntity aBaseMetaTileEntity) { - return new GT_Container_AdvancedWorkbench(aPlayerInventory, aBaseMetaTileEntity); - } - - @Override - public Object getClientGUI( - final int aID, final InventoryPlayer aPlayerInventory, final IGregTechTileEntity aBaseMetaTileEntity) { - return new GT_GUIContainer_AdvancedWorkbench(aPlayerInventory, aBaseMetaTileEntity, mLocalName); - } - - @Override public boolean isTransformerUpgradable() { return true; } @@ -133,10 +137,7 @@ public class GT_MetaTileEntity_AdvancedCraftingTable extends GT_MetaTileEntity_B @Override public boolean onRightclick(final IGregTechTileEntity aBaseMetaTileEntity, final EntityPlayer aPlayer) { - if (aBaseMetaTileEntity.isClientSide()) { - return true; - } - aBaseMetaTileEntity.openGUI(aPlayer); + GT_UIInfos.openGTTileEntityUI(aBaseMetaTileEntity, aPlayer); return true; } @@ -567,4 +568,174 @@ public class GT_MetaTileEntity_AdvancedCraftingTable extends GT_MetaTileEntity_B : new GT_RenderedTexture(TexturesGtBlock.Casing_Workbench_Side) }; } + + @Override + public boolean useModularUI() { + return true; + } + + @Override + public void addGregTechLogo(ModularWindow.Builder builder) {} + + @Override + public void addUIWidgets(ModularWindow.Builder builder, UIBuildContext buildContext) { + builder.widget(SlotGroup.ofItemHandler(inventoryHandler, 4) + .endAtSlot(15) + .background(getGUITextureSet().getItemSlot()) + .build() + .setPos(7, 7)); + for (int i = 0; i < 5; i++) { + builder.widget(createElectricSlot(i + 16).setPos(81 + i * 18, 7)); + } + builder.widget(SlotGroup.ofItemHandler(inventoryHandler, 3) + .startFromSlot(21) + .endAtSlot(29) + .background(getGUITextureSet().getItemSlot()) + .applyForWidget(SlotWidget::disableShiftInsert) + .build() + .setPos(81, 27)); + builder.widget(new SlotWidget(inventoryHandler, 33) + .disableShiftInsert() + .addTooltipShift("Extraction Slot") + .addTooltipShift("Things can always be pulled from here") + .setBackground(getGUITextureSet().getItemSlot(), getArrowOverlay()) + .setPos(153, 27)) + .widget(new SlotWidget(inventoryHandler, 34) + .disableShiftInsert() + .addTooltipShift("Free Parking") + .setBackground(getGUITextureSet().getItemSlot(), getParkOverlay()) + .setPos(153, 63)); + + builder.widget( + new SlotWidget(inventoryHandler, 30) { + @Override + public ClickResult onClick(int buttonId, boolean doubleClick) { + if (buttonId == 0 && Interactable.hasShiftDown()) { + syncToServer(99, NetworkUtils.EMPTY_PACKET); + return ClickResult.SUCCESS; + } + return super.onClick(buttonId, doubleClick); + } + + @Override + public void readOnServer(int id, PacketBuffer buf) throws IOException { + if (id == 99) { + setBluePrint(null); + } else { + super.readOnServer(id, buf); + } + } + }.setFilter(stack -> stack.getItem() instanceof IItemBlueprint) + .disableShiftInsert() + .addTooltipShift("Blueprint Slot") + .addTooltipShift("Shift+Lmb Sets to crafting output") + .setBackground(getGUITextureSet().getItemSlot(), getBlueprintOverlay()) + .setPos(135, 27)); + + builder.widget( + new SlotWidget(BaseSlot.phantom(inventoryHandler, 31)) { + @Override + protected void phantomClick(ClickData clickData, ItemStack cursorStack) { + EntityPlayer aPlayer = getContext().getPlayer(); + ItemStack tStack = getMcSlot().getStack(); + if (tStack == null) return; + if (tStack.stackSize <= 0 + && !GT_Utility.areStacksEqual(tStack, aPlayer.inventory.getItemStack())) { + return; + } + ItemStack tStack2, tCraftedStack = getCraftingOutput(); + if (tCraftedStack != null) { + if (clickData.shift) { + for (byte i = 0; i < aPlayer.inventory.mainInventory.length; i++) { + for (byte j = 0; + j < tCraftedStack.getMaxStackSize() / tCraftedStack.stackSize + && canDoCraftingOutput(); + j++) { + if (!GT_Utility.areStacksEqual(tStack2 = getCraftingOutput(), tCraftedStack) + || tStack.stackSize != tStack2.stackSize) return; + aPlayer.inventory.mainInventory[i] = + consumeMaterials(aPlayer, aPlayer.inventory.mainInventory[i]); + } + } + } else { + if (clickData.mouseButton == 0) { + if (canDoCraftingOutput()) + aPlayer.inventory.setItemStack( + consumeMaterials(aPlayer, aPlayer.inventory.getItemStack())); + } else { + for (int i = 0; + i < tCraftedStack.getMaxStackSize() / tCraftedStack.stackSize + && canDoCraftingOutput(); + i++) { + if (!GT_Utility.areStacksEqual(tStack2 = getCraftingOutput(), tCraftedStack) + || tStack.stackSize != tStack2.stackSize) return; + aPlayer.inventory.setItemStack( + consumeMaterials(aPlayer, aPlayer.inventory.getItemStack())); + } + } + } + } + } + + @Override + public boolean handleDragAndDrop(ItemStack draggedStack, int button) { + return false; + } + + @Override + public List<String> getExtraTooltip() { + return Collections.emptyList(); + } + }.setAccess(false, false) + .setHandlePhantomActionClient(true) + .addTooltipShift("Output Slot") + .setBackground(getGUITextureSet().getItemSlot(), getCraftOutputOverlay()) + .setPos(135, 63)); + + builder.widget(new ButtonWidget() + .setOnClick((clickData, widget) -> sortIntoTheInputSlots()) + .addTooltipShift("Flush") + .addTooltipShift("Empty crafting grid back to storage") + .setBackground(getButtonIcon(), getFlushOverlay()) + .setPos(135, 45) + .setSize(18, 18)) + .widget(new ButtonWidget() + .setOnClick((clickData, widget) -> mFlushMode = true) + .addTooltipShift("Automation") + .addTooltipShift("Allows output while") + .addTooltipShift("crafting grid is full") + .setBackground(getButtonIcon(), GTPP_UITextures.OVERLAY_BUTTON_AUTOMATION) + .setPos(153, 45) + .setSize(18, 18)); + } + + protected SlotWidget createElectricSlot(int index) { + return (SlotWidget) new ElectricSlotWidget(inventoryHandler, index) + .setShiftClickPriority(-1) + .setBackground(getGUITextureSet().getItemSlot(), GTPP_UITextures.OVERLAY_SLOT_ELECTRIC_TOOL); + } + + protected IDrawable getArrowOverlay() { + return GTPP_UITextures.OVERLAY_SLOT_ARROW; + } + + protected IDrawable getParkOverlay() { + return GTPP_UITextures.OVERLAY_SLOT_PARK; + } + + protected IDrawable getBlueprintOverlay() { + return GT_UITextures.OVERLAY_SLOT_PAGE_PRINTED; + } + + protected IDrawable getCraftOutputOverlay() { + return GTPP_UITextures.OVERLAY_SLOT_CRAFT_OUTPUT; + } + + protected IDrawable getButtonIcon() { + return GT_UITextures.BUTTON_STANDARD; + } + + protected IDrawable getFlushOverlay() { + return GTPP_UITextures.OVERLAY_BUTTON_FLUSH; + } } diff --git a/src/main/java/gtPlusPlus/xmod/gregtech/common/tileentities/storage/GT_MetaTileEntity_BronzeCraftingTable.java b/src/main/java/gtPlusPlus/xmod/gregtech/common/tileentities/storage/GT_MetaTileEntity_BronzeCraftingTable.java index 9e21e51f07..eae9bb79ba 100644 --- a/src/main/java/gtPlusPlus/xmod/gregtech/common/tileentities/storage/GT_MetaTileEntity_BronzeCraftingTable.java +++ b/src/main/java/gtPlusPlus/xmod/gregtech/common/tileentities/storage/GT_MetaTileEntity_BronzeCraftingTable.java @@ -1,14 +1,15 @@ package gtPlusPlus.xmod.gregtech.common.tileentities.storage; +import com.gtnewhorizons.modularui.api.drawable.IDrawable; +import com.gtnewhorizons.modularui.common.widget.SlotWidget; import gregtech.api.GregTech_API; +import gregtech.api.enums.SteamVariant; +import gregtech.api.gui.modularui.GUITextureSet; import gregtech.api.interfaces.ITexture; import gregtech.api.interfaces.tileentity.IGregTechTileEntity; import gregtech.api.metatileentity.MetaTileEntity; import gregtech.api.objects.GT_ItemStack; -import gtPlusPlus.xmod.gregtech.api.gui.workbench.GT_Container_BronzeWorkbench; -import gtPlusPlus.xmod.gregtech.api.gui.workbench.GT_GUIContainer_BronzeWorkbench; -import net.minecraft.entity.player.EntityPlayer; -import net.minecraft.entity.player.InventoryPlayer; +import gtPlusPlus.xmod.gregtech.api.gui.GTPP_UITextures; public class GT_MetaTileEntity_BronzeCraftingTable extends GT_MetaTileEntity_AdvancedCraftingTable { @@ -23,18 +24,6 @@ public class GT_MetaTileEntity_BronzeCraftingTable extends GT_MetaTileEntity_Adv } @Override - public Object getServerGUI( - final int aID, final InventoryPlayer aPlayerInventory, final IGregTechTileEntity aBaseMetaTileEntity) { - return new GT_Container_BronzeWorkbench(aPlayerInventory, aBaseMetaTileEntity); - } - - @Override - public Object getClientGUI( - final int aID, final InventoryPlayer aPlayerInventory, final IGregTechTileEntity aBaseMetaTileEntity) { - return new GT_GUIContainer_BronzeWorkbench(aPlayerInventory, aBaseMetaTileEntity, mLocalName); - } - - @Override public boolean isTransformerUpgradable() { return false; } @@ -49,15 +38,6 @@ public class GT_MetaTileEntity_BronzeCraftingTable extends GT_MetaTileEntity_Adv return new GT_MetaTileEntity_BronzeCraftingTable(this.mName, this.mTier, this.mDescription, this.mTextures); } - @Override - public boolean onRightclick(final IGregTechTileEntity aBaseMetaTileEntity, final EntityPlayer aPlayer) { - if (aBaseMetaTileEntity.isClientSide()) { - return true; - } - aBaseMetaTileEntity.openGUI(aPlayer); - return true; - } - @SuppressWarnings("deprecation") @Override public boolean allowCoverOnSide(byte aSide, GT_ItemStack aStack) { @@ -83,4 +63,50 @@ public class GT_MetaTileEntity_BronzeCraftingTable extends GT_MetaTileEntity_Adv protected boolean isAdvanced() { return false; } + + @Override + public SteamVariant getSteamVariant() { + return SteamVariant.BRONZE; + } + + @Override + public GUITextureSet getGUITextureSet() { + return GUITextureSet.STEAM.apply(getSteamVariant()); + } + + @Override + protected SlotWidget createElectricSlot(int index) { + return (SlotWidget) new SlotWidget(inventoryHandler, index) + .setBackground(getGUITextureSet().getItemSlot()); + } + + @Override + protected IDrawable getArrowOverlay() { + return GTPP_UITextures.OVERLAY_SLOT_ARROW_BRONZE; + } + + @Override + protected IDrawable getParkOverlay() { + return GTPP_UITextures.OVERLAY_SLOT_PARK_BRONZE; + } + + @Override + protected IDrawable getBlueprintOverlay() { + return GTPP_UITextures.OVERLAY_SLOT_PAGE_PRINTED_BRONZE; + } + + @Override + protected IDrawable getCraftOutputOverlay() { + return GTPP_UITextures.OVERLAY_SLOT_CRAFT_OUTPUT_BRONZE; + } + + @Override + protected IDrawable getButtonIcon() { + return GTPP_UITextures.BUTTON_STANDARD_BRONZE; + } + + @Override + protected IDrawable getFlushOverlay() { + return GTPP_UITextures.OVERLAY_BUTTON_FLUSH_BRONZE; + } } diff --git a/src/main/java/gtPlusPlus/xmod/gregtech/common/tileentities/storage/GT_MetaTileEntity_ConnectableCrate.java b/src/main/java/gtPlusPlus/xmod/gregtech/common/tileentities/storage/GT_MetaTileEntity_ConnectableCrate.java index 1c0e682b62..2c29a0a00b 100644 --- a/src/main/java/gtPlusPlus/xmod/gregtech/common/tileentities/storage/GT_MetaTileEntity_ConnectableCrate.java +++ b/src/main/java/gtPlusPlus/xmod/gregtech/common/tileentities/storage/GT_MetaTileEntity_ConnectableCrate.java @@ -1,9 +1,17 @@ package gtPlusPlus.xmod.gregtech.common.tileentities.storage; +import com.gtnewhorizons.modularui.api.screen.ModularWindow; +import com.gtnewhorizons.modularui.api.screen.UIBuildContext; +import com.gtnewhorizons.modularui.common.widget.DrawableWidget; +import com.gtnewhorizons.modularui.common.widget.SlotWidget; +import com.gtnewhorizons.modularui.common.widget.TextWidget; import gregtech.api.GregTech_API; import gregtech.api.enums.Textures.BlockIcons; +import gregtech.api.gui.modularui.GT_UIInfos; +import gregtech.api.gui.modularui.GT_UITextures; import gregtech.api.interfaces.ITexture; import gregtech.api.interfaces.metatileentity.IMetaTileEntity; +import gregtech.api.interfaces.modularui.IAddUIWidgets; import gregtech.api.interfaces.tileentity.IGregTechTileEntity; import gregtech.api.metatileentity.MetaTileEntity; import gregtech.api.metatileentity.implementations.GT_MetaTileEntity_TieredMachineBlock; @@ -13,17 +21,14 @@ import gtPlusPlus.api.objects.data.AutoMap; import gtPlusPlus.api.objects.minecraft.BlockPos; import gtPlusPlus.core.lib.CORE; import gtPlusPlus.core.util.data.ArrayUtils; -import gtPlusPlus.xmod.gregtech.api.gui.CONTAINER_SuperChest; -import gtPlusPlus.xmod.gregtech.api.gui.GUI_SuperChest; import gtPlusPlus.xmod.gregtech.common.blocks.textures.TexturesGtBlock; import net.minecraft.block.Block; import net.minecraft.entity.player.EntityPlayer; -import net.minecraft.entity.player.InventoryPlayer; import net.minecraft.item.ItemStack; import net.minecraft.nbt.NBTTagCompound; import net.minecraft.tileentity.TileEntity; -public class GT_MetaTileEntity_ConnectableCrate extends GT_MetaTileEntity_TieredMachineBlock { +public class GT_MetaTileEntity_ConnectableCrate extends GT_MetaTileEntity_TieredMachineBlock implements IAddUIWidgets { /*sides.put(getUp()); sides.put(getDown()); @@ -373,20 +378,8 @@ public class GT_MetaTileEntity_ConnectableCrate extends GT_MetaTileEntity_Tiered } public boolean onRightclick(IGregTechTileEntity aBaseMetaTileEntity, EntityPlayer aPlayer) { - if (aBaseMetaTileEntity.isClientSide()) { - return true; - } else { - aBaseMetaTileEntity.openGUI(aPlayer); - return true; - } - } - - public Object getServerGUI(int aID, InventoryPlayer aPlayerInventory, IGregTechTileEntity aBaseMetaTileEntity) { - return new CONTAINER_SuperChest(aPlayerInventory, aBaseMetaTileEntity); - } - - public Object getClientGUI(int aID, InventoryPlayer aPlayerInventory, IGregTechTileEntity aBaseMetaTileEntity) { - return new GUI_SuperChest(aPlayerInventory, aBaseMetaTileEntity, this.getLocalName()); + GT_UIInfos.openGTTileEntityUI(aBaseMetaTileEntity, aPlayer); + return true; } public void onPostTick(IGregTechTileEntity aBaseMetaTileEntity, long aTimer) { @@ -566,4 +559,34 @@ public class GT_MetaTileEntity_ConnectableCrate extends GT_MetaTileEntity_Tiered // TODO Auto-generated method stub super.onMachineBlockUpdate(); } + + @Override + public boolean useModularUI() { + return true; + } + + @Override + public void addUIWidgets(ModularWindow.Builder builder, UIBuildContext buildContext) { + builder.widget(new DrawableWidget() + .setDrawable(GT_UITextures.PICTURE_SCREEN_BLACK) + .setPos(7, 16) + .setSize(71, 45)) + .widget(new SlotWidget(inventoryHandler, 0) + .setBackground(getGUITextureSet().getItemSlot(), GT_UITextures.OVERLAY_SLOT_IN) + .setPos(79, 16)) + .widget(new SlotWidget(inventoryHandler, 1) + .setAccess(true, false) + .setBackground(getGUITextureSet().getItemSlot(), GT_UITextures.OVERLAY_SLOT_OUT) + .setPos(79, 52)) + .widget(SlotWidget.phantom(inventoryHandler, 2) + .disableInteraction() + .setBackground(GT_UITextures.TRANSPARENT) + .setPos(59, 42)) + .widget(new TextWidget("Item Amount") + .setDefaultColor(COLOR_TEXT_WHITE.get()) + .setPos(10, 20)) + .widget(TextWidget.dynamicString(() -> GT_Utility.parseNumberToString(mItemCount)) + .setDefaultColor(COLOR_TEXT_WHITE.get()) + .setPos(10, 30)); + } } diff --git a/src/main/java/gtPlusPlus/xmod/gregtech/common/tileentities/storage/GT_MetaTileEntity_TieredChest.java b/src/main/java/gtPlusPlus/xmod/gregtech/common/tileentities/storage/GT_MetaTileEntity_TieredChest.java index b5dcd8cd73..eb5541ef82 100644 --- a/src/main/java/gtPlusPlus/xmod/gregtech/common/tileentities/storage/GT_MetaTileEntity_TieredChest.java +++ b/src/main/java/gtPlusPlus/xmod/gregtech/common/tileentities/storage/GT_MetaTileEntity_TieredChest.java @@ -1,21 +1,26 @@ package gtPlusPlus.xmod.gregtech.common.tileentities.storage; +import com.gtnewhorizons.modularui.api.screen.ModularWindow; +import com.gtnewhorizons.modularui.api.screen.UIBuildContext; +import com.gtnewhorizons.modularui.common.widget.DrawableWidget; +import com.gtnewhorizons.modularui.common.widget.SlotWidget; +import com.gtnewhorizons.modularui.common.widget.TextWidget; import gregtech.api.enums.Textures.BlockIcons; +import gregtech.api.gui.modularui.GT_UIInfos; +import gregtech.api.gui.modularui.GT_UITextures; import gregtech.api.interfaces.ITexture; +import gregtech.api.interfaces.modularui.IAddUIWidgets; import gregtech.api.interfaces.tileentity.IGregTechTileEntity; import gregtech.api.metatileentity.MetaTileEntity; import gregtech.api.metatileentity.implementations.GT_MetaTileEntity_TieredMachineBlock; import gregtech.api.objects.GT_RenderedTexture; import gregtech.api.util.GT_Utility; import gtPlusPlus.core.lib.CORE; -import gtPlusPlus.xmod.gregtech.api.gui.CONTAINER_SuperChest; -import gtPlusPlus.xmod.gregtech.api.gui.GUI_SuperChest; import net.minecraft.entity.player.EntityPlayer; -import net.minecraft.entity.player.InventoryPlayer; import net.minecraft.item.ItemStack; import net.minecraft.nbt.NBTTagCompound; -public class GT_MetaTileEntity_TieredChest extends GT_MetaTileEntity_TieredMachineBlock { +public class GT_MetaTileEntity_TieredChest extends GT_MetaTileEntity_TieredMachineBlock implements IAddUIWidgets { public int mItemCount = 0; public ItemStack mItemStack = null; private static final double mStorageFactor = (270000.0D / 16); @@ -65,20 +70,8 @@ public class GT_MetaTileEntity_TieredChest extends GT_MetaTileEntity_TieredMachi } public boolean onRightclick(IGregTechTileEntity aBaseMetaTileEntity, EntityPlayer aPlayer) { - if (aBaseMetaTileEntity.isClientSide()) { - return true; - } else { - aBaseMetaTileEntity.openGUI(aPlayer); - return true; - } - } - - public Object getServerGUI(int aID, InventoryPlayer aPlayerInventory, IGregTechTileEntity aBaseMetaTileEntity) { - return new CONTAINER_SuperChest(aPlayerInventory, aBaseMetaTileEntity); - } - - public Object getClientGUI(int aID, InventoryPlayer aPlayerInventory, IGregTechTileEntity aBaseMetaTileEntity) { - return new GUI_SuperChest(aPlayerInventory, aBaseMetaTileEntity, this.getLocalName()); + GT_UIInfos.openGTTileEntityUI(aBaseMetaTileEntity, aPlayer); + return true; } public void onPostTick(IGregTechTileEntity aBaseMetaTileEntity, long aTimer) { @@ -219,4 +212,34 @@ public class GT_MetaTileEntity_TieredChest extends GT_MetaTileEntity_TieredMachi public ITexture[][][] getTextureSet(ITexture[] aTextures) { return new ITexture[0][0][0]; } + + @Override + public boolean useModularUI() { + return true; + } + + @Override + public void addUIWidgets(ModularWindow.Builder builder, UIBuildContext buildContext) { + builder.widget(new DrawableWidget() + .setDrawable(GT_UITextures.PICTURE_SCREEN_BLACK) + .setPos(7, 16) + .setSize(71, 45)) + .widget(new SlotWidget(inventoryHandler, 0) + .setBackground(getGUITextureSet().getItemSlot(), GT_UITextures.OVERLAY_SLOT_IN) + .setPos(79, 16)) + .widget(new SlotWidget(inventoryHandler, 1) + .setAccess(true, false) + .setBackground(getGUITextureSet().getItemSlot(), GT_UITextures.OVERLAY_SLOT_OUT) + .setPos(79, 52)) + .widget(SlotWidget.phantom(inventoryHandler, 2) + .disableInteraction() + .setBackground(GT_UITextures.TRANSPARENT) + .setPos(59, 42)) + .widget(new TextWidget("Item Amount") + .setDefaultColor(COLOR_TEXT_WHITE.get()) + .setPos(10, 20)) + .widget(TextWidget.dynamicString(() -> GT_Utility.parseNumberToString(mItemCount)) + .setDefaultColor(COLOR_TEXT_WHITE.get()) + .setPos(10, 30)); + } } diff --git a/src/main/java/gtPlusPlus/xmod/gregtech/common/tileentities/storage/GT_MetaTileEntity_TieredTank.java b/src/main/java/gtPlusPlus/xmod/gregtech/common/tileentities/storage/GT_MetaTileEntity_TieredTank.java index f46ba27204..3bd7628e79 100644 --- a/src/main/java/gtPlusPlus/xmod/gregtech/common/tileentities/storage/GT_MetaTileEntity_TieredTank.java +++ b/src/main/java/gtPlusPlus/xmod/gregtech/common/tileentities/storage/GT_MetaTileEntity_TieredTank.java @@ -2,6 +2,7 @@ package gtPlusPlus.xmod.gregtech.common.tileentities.storage; import gregtech.api.enums.GT_Values; import gregtech.api.enums.Textures; +import gregtech.api.gui.modularui.GT_UIInfos; import gregtech.api.interfaces.ITexture; import gregtech.api.interfaces.tileentity.IGregTechTileEntity; import gregtech.api.metatileentity.MetaTileEntity; @@ -145,11 +146,7 @@ public class GT_MetaTileEntity_TieredTank extends GT_MetaTileEntity_BasicTank { @Override public boolean onRightclick(final IGregTechTileEntity aBaseMetaTileEntity, final EntityPlayer aPlayer) { - if (aBaseMetaTileEntity.isClientSide()) { - // setVars(); - return true; - } - aBaseMetaTileEntity.openGUI(aPlayer); + GT_UIInfos.openGTTileEntityUI(aBaseMetaTileEntity, aPlayer); return true; } @@ -173,4 +170,9 @@ public class GT_MetaTileEntity_TieredTank extends GT_MetaTileEntity_BasicTank { } } } + + @Override + public boolean useModularUI() { + return true; + } } diff --git a/src/main/java/gtPlusPlus/xmod/gregtech/common/tileentities/storage/GregtechMetaEnergyBuffer.java b/src/main/java/gtPlusPlus/xmod/gregtech/common/tileentities/storage/GregtechMetaEnergyBuffer.java index 04c75f52f8..ff63957696 100644 --- a/src/main/java/gtPlusPlus/xmod/gregtech/common/tileentities/storage/GregtechMetaEnergyBuffer.java +++ b/src/main/java/gtPlusPlus/xmod/gregtech/common/tileentities/storage/GregtechMetaEnergyBuffer.java @@ -3,8 +3,6 @@ package gtPlusPlus.xmod.gregtech.common.tileentities.storage; import static gregtech.api.enums.GT_Values.V; import gregtech.api.enums.Textures; -import gregtech.api.gui.GT_Container_1by1; -import gregtech.api.gui.GT_GUIContainer_1by1; import gregtech.api.interfaces.ITexture; import gregtech.api.interfaces.metatileentity.IMetaTileEntity; import gregtech.api.interfaces.tileentity.IGregTechTileEntity; @@ -17,7 +15,6 @@ import gtPlusPlus.core.util.minecraft.PlayerUtils; import gtPlusPlus.xmod.gregtech.api.metatileentity.implementations.base.GregtechMetaTileEntity; import gtPlusPlus.xmod.gregtech.common.blocks.textures.TexturesGtBlock; import net.minecraft.entity.player.EntityPlayer; -import net.minecraft.entity.player.InventoryPlayer; import net.minecraft.item.ItemStack; import net.minecraft.nbt.NBTTagCompound; import net.minecraft.world.World; @@ -357,7 +354,6 @@ public class GregtechMetaEnergyBuffer extends GregtechMetaTileEntity { Logger.WARNING("Right Click on MTE by Player"); if (aBaseMetaTileEntity.isClientSide()) { return true; - // aBaseMetaTileEntity.openGUI(aPlayer); } Logger.WARNING("MTE is Client-side"); @@ -393,18 +389,6 @@ public class GregtechMetaEnergyBuffer extends GregtechMetaTileEntity { block.getClientGuiElement(1, playerIn, worldIn, (int) playerIn.posX, (int) playerIn.posY, (int) playerIn.posZ);*/ @Override - public Object getServerGUI( - final int aID, final InventoryPlayer aPlayerInventory, final IGregTechTileEntity aBaseMetaTileEntity) { - return new GT_Container_1by1(aPlayerInventory, aBaseMetaTileEntity); - } - - @Override - public Object getClientGUI( - final int aID, final InventoryPlayer aPlayerInventory, final IGregTechTileEntity aBaseMetaTileEntity) { - return new GT_GUIContainer_1by1(aPlayerInventory, aBaseMetaTileEntity, this.getLocalName()); - } - - @Override public boolean allowPullStack( final IGregTechTileEntity aBaseMetaTileEntity, final int aIndex, final byte aSide, final ItemStack aStack) { return false; diff --git a/src/main/java/gtPlusPlus/xmod/gregtech/common/tileentities/storage/GregtechMetaSafeBlock.java b/src/main/java/gtPlusPlus/xmod/gregtech/common/tileentities/storage/GregtechMetaSafeBlock.java index 064312fae2..5115b87da7 100644 --- a/src/main/java/gtPlusPlus/xmod/gregtech/common/tileentities/storage/GregtechMetaSafeBlock.java +++ b/src/main/java/gtPlusPlus/xmod/gregtech/common/tileentities/storage/GregtechMetaSafeBlock.java @@ -1,17 +1,23 @@ package gtPlusPlus.xmod.gregtech.common.tileentities.storage; +import com.gtnewhorizons.modularui.api.screen.ModularWindow; +import com.gtnewhorizons.modularui.api.screen.UIBuildContext; +import com.gtnewhorizons.modularui.common.widget.ButtonWidget; +import com.gtnewhorizons.modularui.common.widget.FakeSyncWidget; +import com.gtnewhorizons.modularui.common.widget.SlotGroup; +import com.gtnewhorizons.modularui.common.widget.TextWidget; import gregtech.api.enums.Textures; +import gregtech.api.gui.modularui.GT_UITextures; import gregtech.api.interfaces.ITexture; import gregtech.api.interfaces.metatileentity.IMetaTileEntity; +import gregtech.api.interfaces.modularui.IAddUIWidgets; import gregtech.api.interfaces.tileentity.IGregTechTileEntity; import gregtech.api.objects.GT_RenderedTexture; import gtPlusPlus.core.lib.CORE; -import gtPlusPlus.xmod.gregtech.api.gui.CONTAINER_SafeBlock; -import gtPlusPlus.xmod.gregtech.api.gui.GUI_SafeBlock; +import gtPlusPlus.xmod.gregtech.api.gui.GTPP_UITextures; import gtPlusPlus.xmod.gregtech.api.metatileentity.implementations.base.machines.GregtechMetaSafeBlockBase; -import net.minecraft.entity.player.InventoryPlayer; -public class GregtechMetaSafeBlock extends GregtechMetaSafeBlockBase { +public class GregtechMetaSafeBlock extends GregtechMetaSafeBlockBase implements IAddUIWidgets { public GregtechMetaSafeBlock(final int aID, final String aName, final String aNameRegional, final int aTier) { super(aID, aName, aNameRegional, aTier, 28, "Protecting your items from sticky fingers."); @@ -58,14 +64,25 @@ public class GregtechMetaSafeBlock extends GregtechMetaSafeBlockBase { } @Override - public Object getServerGUI( - final int aID, final InventoryPlayer aPlayerInventory, final IGregTechTileEntity aBaseMetaTileEntity) { - return new CONTAINER_SafeBlock(aPlayerInventory, aBaseMetaTileEntity); + public boolean useModularUI() { + return true; } @Override - public Object getClientGUI( - final int aID, final InventoryPlayer aPlayerInventory, final IGregTechTileEntity aBaseMetaTileEntity) { - return new GUI_SafeBlock(aPlayerInventory, aBaseMetaTileEntity); + public void addUIWidgets(ModularWindow.Builder builder, UIBuildContext buildContext) { + builder.widget(SlotGroup.ofItemHandler(inventoryHandler, 9) + .endAtSlot(26) + .build() + .setPos(7, 4)) + .widget(new ButtonWidget() + .setOnClick((clickData, widget) -> bUnbreakable = !bUnbreakable) + .setBackground(GT_UITextures.BUTTON_STANDARD, GTPP_UITextures.OVERLAY_BUTTON_LOCK) + .setPos(43, 62) + .setSize(18, 18)) + .widget(new TextWidget("Safe Status").setPos(76, 61)) + .widget(TextWidget.dynamicString(() -> bUnbreakable ? "Locked" : "Unlocked") + .setSynced(false) + .setPos(82, 73)) + .widget(new FakeSyncWidget.BooleanSyncer(() -> bUnbreakable, val -> bUnbreakable = val)); } } diff --git a/src/main/java/gtPlusPlus/xmod/gregtech/common/tileentities/storage/creative/GT_MetaTileEntity_InfiniteItemHolder.java b/src/main/java/gtPlusPlus/xmod/gregtech/common/tileentities/storage/creative/GT_MetaTileEntity_InfiniteItemHolder.java index 1ca167925c..bff2cad086 100644 --- a/src/main/java/gtPlusPlus/xmod/gregtech/common/tileentities/storage/creative/GT_MetaTileEntity_InfiniteItemHolder.java +++ b/src/main/java/gtPlusPlus/xmod/gregtech/common/tileentities/storage/creative/GT_MetaTileEntity_InfiniteItemHolder.java @@ -8,7 +8,6 @@ import gtPlusPlus.core.util.minecraft.PlayerUtils; import gtPlusPlus.core.util.sys.KeyboardUtils; import gtPlusPlus.xmod.gregtech.common.tileentities.storage.GT_MetaTileEntity_TieredChest; import net.minecraft.entity.player.EntityPlayer; -import net.minecraft.entity.player.InventoryPlayer; import net.minecraft.item.ItemStack; public class GT_MetaTileEntity_InfiniteItemHolder extends GT_MetaTileEntity_TieredChest { @@ -63,16 +62,6 @@ public class GT_MetaTileEntity_InfiniteItemHolder extends GT_MetaTileEntity_Tier } @Override - public Object getServerGUI(int aID, InventoryPlayer aPlayerInventory, IGregTechTileEntity aBaseMetaTileEntity) { - return null; - } - - @Override - public Object getClientGUI(int aID, InventoryPlayer aPlayerInventory, IGregTechTileEntity aBaseMetaTileEntity) { - return null; - } - - @Override public void onPostTick(IGregTechTileEntity aBaseMetaTileEntity, long aTimer) { if (mItemStack != null) { setItemCount(0); diff --git a/src/main/java/gtPlusPlus/xmod/gregtech/common/tileentities/storage/shelving/GT4Entity_Shelf_Large.java b/src/main/java/gtPlusPlus/xmod/gregtech/common/tileentities/storage/shelving/GT4Entity_Shelf_Large.java index 03735ad381..15fa23bf95 100644 --- a/src/main/java/gtPlusPlus/xmod/gregtech/common/tileentities/storage/shelving/GT4Entity_Shelf_Large.java +++ b/src/main/java/gtPlusPlus/xmod/gregtech/common/tileentities/storage/shelving/GT4Entity_Shelf_Large.java @@ -1,5 +1,12 @@ package gtPlusPlus.xmod.gregtech.common.tileentities.storage.shelving; +import com.gtnewhorizons.modularui.api.screen.ModularWindow; +import com.gtnewhorizons.modularui.api.screen.UIBuildContext; +import com.gtnewhorizons.modularui.common.widget.DrawableWidget; +import com.gtnewhorizons.modularui.common.widget.SlotWidget; +import com.gtnewhorizons.modularui.common.widget.TextWidget; +import gregtech.api.gui.modularui.GT_UIInfos; +import gregtech.api.gui.modularui.GT_UITextures; import gregtech.api.interfaces.ITexture; import gregtech.api.interfaces.tileentity.IGregTechTileEntity; import gregtech.api.metatileentity.MetaTileEntity; @@ -7,10 +14,7 @@ import gregtech.api.util.GT_Utility; import gtPlusPlus.api.objects.Logger; import gtPlusPlus.core.util.minecraft.PlayerUtils; import gtPlusPlus.core.util.sys.KeyboardUtils; -import gtPlusPlus.xmod.gregtech.api.gui.CONTAINER_SuperChest; -import gtPlusPlus.xmod.gregtech.api.gui.GUI_SuperChest; import net.minecraft.entity.player.EntityPlayer; -import net.minecraft.entity.player.InventoryPlayer; import net.minecraft.item.ItemStack; import net.minecraft.nbt.NBTBase; import net.minecraft.nbt.NBTTagCompound; @@ -73,21 +77,11 @@ public class GT4Entity_Shelf_Large extends GT4Entity_Shelf { + (itemAmount.equalsIgnoreCase("bad") ? "nothing." : itemName + " x" + itemAmount + "."); PlayerUtils.messagePlayer(aPlayer, itemMessage); } else { - aBaseMetaTileEntity.openGUI(aPlayer); + GT_UIInfos.openGTTileEntityUI(aBaseMetaTileEntity, aPlayer); } return true; } - public Object getServerGUI( - final int aID, final InventoryPlayer aPlayerInventory, final IGregTechTileEntity aBaseMetaTileEntity) { - return new CONTAINER_SuperChest(aPlayerInventory, aBaseMetaTileEntity); - } - - public Object getClientGUI( - final int aID, final InventoryPlayer aPlayerInventory, final IGregTechTileEntity aBaseMetaTileEntity) { - return new GUI_SuperChest(aPlayerInventory, aBaseMetaTileEntity, this.getLocalName()); - } - @Override public void saveNBTData(NBTTagCompound aNBT) { aNBT.setInteger("mItemCount", this.mItemCount); @@ -261,4 +255,26 @@ public class GT4Entity_Shelf_Large extends GT4Entity_Shelf { } return super.canInsertItem(aIndex, aStack, aSide); } + + @Override + public boolean useModularUI() { + return true; + } + + @Override + public void addUIWidgets(ModularWindow.Builder builder, UIBuildContext buildContext) { + builder.widget(new DrawableWidget() + .setDrawable(GT_UITextures.PICTURE_SCREEN_BLACK) + .setPos(7, 16) + .setSize(71, 45)) + .widget(new SlotWidget(inventoryHandler, 0) + .setBackground(getGUITextureSet().getItemSlot(), GT_UITextures.OVERLAY_SLOT_IN) + .setPos(79, 16)) + .widget(new TextWidget("Item Amount") + .setDefaultColor(COLOR_TEXT_WHITE.get()) + .setPos(10, 20)) + .widget(TextWidget.dynamicString(() -> GT_Utility.parseNumberToString(mItemCount)) + .setDefaultColor(COLOR_TEXT_WHITE.get()) + .setPos(10, 30)); + } } diff --git a/src/main/java/gtPlusPlus/xmod/gregtech/loaders/RecipeGen_MultisUsingFluidInsteadOfCells.java b/src/main/java/gtPlusPlus/xmod/gregtech/loaders/RecipeGen_MultisUsingFluidInsteadOfCells.java index 1b0324545d..39d9456115 100644 --- a/src/main/java/gtPlusPlus/xmod/gregtech/loaders/RecipeGen_MultisUsingFluidInsteadOfCells.java +++ b/src/main/java/gtPlusPlus/xmod/gregtech/loaders/RecipeGen_MultisUsingFluidInsteadOfCells.java @@ -1,7 +1,6 @@ package gtPlusPlus.xmod.gregtech.loaders; import gregtech.api.util.GTPP_Recipe; -import gregtech.api.util.GTPP_Recipe.GTPP_Recipe_Map_Internal; import gregtech.api.util.GT_Recipe; import gregtech.api.util.GT_Recipe.GT_Recipe_Map; import gregtech.api.util.GT_Utility; @@ -66,8 +65,7 @@ public class RecipeGen_MultisUsingFluidInsteadOfCells { return null; } - public static synchronized int generateRecipesNotUsingCells( - GT_Recipe_Map aInputs, GTPP_Recipe_Map_Internal aOutputs) { + public static synchronized int generateRecipesNotUsingCells(GT_Recipe_Map aInputs, GT_Recipe_Map aOutputs) { init(); int aRecipesHandled = 0; int aInvalidRecipesToConvert = 0; @@ -158,7 +156,7 @@ public class RecipeGen_MultisUsingFluidInsteadOfCells { } // Add Recipe to map - GT_Recipe aNewRecipe = new GTPP_Recipe.GTPP_Recipe_Map_MultiNoCell.GTPP_Recipe_MultiNoCell( + GT_Recipe aNewRecipe = new GTPP_Recipe( false, aNewItemInputs, aNewItemOutputs, diff --git a/src/main/java/gtPlusPlus/xmod/gregtech/recipes/GregtechRecipeAdder.java b/src/main/java/gtPlusPlus/xmod/gregtech/recipes/GregtechRecipeAdder.java index 0a0234a752..3aab3f6d0e 100644 --- a/src/main/java/gtPlusPlus/xmod/gregtech/recipes/GregtechRecipeAdder.java +++ b/src/main/java/gtPlusPlus/xmod/gregtech/recipes/GregtechRecipeAdder.java @@ -650,7 +650,7 @@ public class GregtechRecipeAdder implements IGregtech_RecipeAdder { } } - ArrayUtils.removeNulls(aInput); + aInput = ArrayUtils.removeNulls(aInput); if (aInput.length <= 1) { return false; } |