From aed9ee9f560200a7139e1f3f80ff087cf80c0be6 Mon Sep 17 00:00:00 2001 From: Alkalus <3060479+draknyte1@users.noreply.github.com> Date: Mon, 13 Dec 2021 13:04:35 +0000 Subject: More recipe adjustments. Changed how Fluorite is handled. Change Monazite Froth output to no longer contain Praseodymium. Change Monazite Froth output to have 4x less Europium. --- .../xmod/gregtech/loaders/RecipeGen_Fluorite.java | 194 +++++++++++++++++++++ 1 file changed, 194 insertions(+) create mode 100644 src/Java/gtPlusPlus/xmod/gregtech/loaders/RecipeGen_Fluorite.java (limited to 'src/Java/gtPlusPlus/xmod/gregtech/loaders') diff --git a/src/Java/gtPlusPlus/xmod/gregtech/loaders/RecipeGen_Fluorite.java b/src/Java/gtPlusPlus/xmod/gregtech/loaders/RecipeGen_Fluorite.java new file mode 100644 index 0000000000..82d6de4498 --- /dev/null +++ b/src/Java/gtPlusPlus/xmod/gregtech/loaders/RecipeGen_Fluorite.java @@ -0,0 +1,194 @@ +package gtPlusPlus.xmod.gregtech.loaders; + +import java.util.HashSet; +import java.util.Set; + +import gregtech.api.enums.GT_Values; +import gregtech.api.util.GT_ModHandler; +import gtPlusPlus.api.interfaces.RunnableWithInfo; +import gtPlusPlus.api.objects.Logger; +import gtPlusPlus.core.material.Material; +import gtPlusPlus.core.material.MaterialGenerator; +import gtPlusPlus.core.material.nuclear.FLUORIDES; +import gtPlusPlus.core.recipe.common.CI; +import gtPlusPlus.core.util.minecraft.FluidUtils; +import gtPlusPlus.core.util.minecraft.ItemUtils; +import gtPlusPlus.core.util.minecraft.MaterialUtils; +import gtPlusPlus.core.util.minecraft.RecipeUtils; +import net.minecraft.item.ItemStack; + +public class RecipeGen_Fluorite extends RecipeGen_Base { + + public final static Set> mRecipeGenMap = new HashSet>(); + + static { + MaterialGenerator.mRecipeMapsToGenerate.put(mRecipeGenMap); + } + + public RecipeGen_Fluorite(final Material material){ + this.toGenerate = material; + mRecipeGenMap.add(this); + + + /** + * Shaped Crafting + */ + RecipeUtils.addShapedRecipe( + CI.craftingToolHammer_Hard, null, null, + material.getCrushedPurified(1), null, null, + null, null, null, + material.getDustPurified(1)); + + RecipeUtils.addShapedRecipe( + CI.craftingToolHammer_Hard, null, null, + material.getCrushed(1), null, null, + null, null, null, + material.getDustImpure(1)); + + RecipeUtils.addShapedRecipe( + CI.craftingToolHammer_Hard, null, null, + material.getCrushedCentrifuged(1), null, null, + null, null, null, + material.getDust(1)); + + + + final ItemStack normalDust = material.getDust(1); + final ItemStack smallDust = material.getSmallDust(1); + final ItemStack tinyDust = material.getTinyDust(1); + + if (RecipeUtils.addShapedRecipe( + tinyDust, tinyDust, tinyDust, + tinyDust, tinyDust, tinyDust, + tinyDust, tinyDust, tinyDust, + normalDust)){ + Logger.WARNING("9 Tiny dust to 1 Dust Recipe: "+material.getLocalizedName()+" - Success"); + } + else { + Logger.WARNING("9 Tiny dust to 1 Dust Recipe: "+material.getLocalizedName()+" - Failed"); + } + + if (RecipeUtils.addShapedRecipe( + normalDust, null, null, + null, null, null, + null, null, null, + material.getTinyDust(9))){ + Logger.WARNING("9 Tiny dust from 1 Recipe: "+material.getLocalizedName()+" - Success"); + } + else { + Logger.WARNING("9 Tiny dust from 1 Recipe: "+material.getLocalizedName()+" - Failed"); + } + + if (RecipeUtils.addShapedRecipe( + smallDust, smallDust, null, + smallDust, smallDust, null, + null, null, null, + normalDust)){ + Logger.WARNING("4 Small dust to 1 Dust Recipe: "+material.getLocalizedName()+" - Success"); + } + else { + Logger.WARNING("4 Small dust to 1 Dust Recipe: "+material.getLocalizedName()+" - Failed"); + } + + if (RecipeUtils.addShapedRecipe( + null, normalDust, null, + null, null, null, + null, null, null, + material.getSmallDust(4))){ + Logger.WARNING("4 Small dust from 1 Dust Recipe: "+material.getLocalizedName()+" - Success"); + } + else { + Logger.WARNING("4 Small dust from 1 Dust Recipe: "+material.getLocalizedName()+" - Failed"); + } + } + + @Override + public void run() { + generateRecipes(this.toGenerate); + } + + public static void generateRecipes(final Material material){ + + int tVoltageMultiplier = MaterialUtils.getVoltageForTier(material.vTier); + + final ItemStack dustStone = ItemUtils.getItemStackOfAmountFromOreDict("dustStone", 1); + + + ItemStack tinyDustA = FLUORIDES.FLUORITE.getTinyDust(1); + ItemStack tinyDustB = FLUORIDES.FLUORITE.getTinyDust(1); + ItemStack matDust = FLUORIDES.FLUORITE.getDust(1); + ItemStack matDustA = FLUORIDES.FLUORITE.getDust(1); + + /** + * Package + */ + //Allow ore dusts to be packaged + if (ItemUtils.checkForInvalidItems(material.getSmallDust(1)) && ItemUtils.checkForInvalidItems(material.getTinyDust(1))) { + RecipeGen_DustGeneration.generatePackagerRecipes(material); + } + + + /** + * Macerate + */ + //Macerate ore to Crushed + if (GT_Values.RA.addPulveriserRecipe(material.getOre(1), new ItemStack[]{material.getCrushed(2)}, new int[]{10000}, 20*20, tVoltageMultiplier/2)){ + Logger.MATERIALS("[Macerator] Added Recipe: 'Macerate ore to Crushed ore'"); + } + //Macerate Centrifuged to Pure Dust + if (GT_Values.RA.addPulveriserRecipe(material.getCrushedCentrifuged(1), new ItemStack[]{matDust, matDustA}, new int[]{10000, 1000}, 20*20, tVoltageMultiplier/2)){ + Logger.MATERIALS("[Macerator] Added Recipe: 'Macerate Centrifuged ore to Pure Dust'"); + } + if (GT_ModHandler.addThermalCentrifugeRecipe(material.getCrushedPurified(1), 200, material.getCrushedCentrifuged(1), tinyDustA, dustStone)){ + Logger.MATERIALS("[ThermalCentrifuge] Added Recipe: 'Washed ore to Centrifuged Ore' | Input: "+material.getCrushedPurified(1).getDisplayName()+" | Outputs: "+material.getCrushedCentrifuged(1).getDisplayName()+", "+tinyDustA.getDisplayName()+", "+dustStone.getDisplayName()+"."); + } + + GT_Values.RA.addChemicalBathRecipe( + FLUORIDES.FLUORITE.getCrushed(2), + FluidUtils.getFluidStack("hydrogen", 2000), + FLUORIDES.FLUORITE.getCrushedPurified(8), + FLUORIDES.FLUORITE.getDustImpure(4), + FLUORIDES.FLUORITE.getDustPurified(2), + new int[] { 10000, 5000, 1000 }, + 30 * 20, + 240); + + /** + * Forge Hammer + */ + if (GT_Values.RA.addForgeHammerRecipe(material.getCrushedCentrifuged(1), matDust, 10, tVoltageMultiplier/4)){ + Logger.MATERIALS("[ForgeHammer] Added Recipe: 'Crushed Centrifuged to Pure Dust'"); + } + + /** + * Centrifuge + */ + //Purified Dust to Clean + if (GT_Values.RA.addCentrifugeRecipe( + material.getDustPurified(1), null, + null, //In Fluid + null, //Out Fluid + matDust, tinyDustA,null, + null, null,null, + new int[]{10000, 10000}, //Chances + 5*20, //Time + tVoltageMultiplier/2)){ //Eu + Logger.MATERIALS("[Centrifuge] Added Recipe: Purified Dust to Clean Dust"); + } + + //Impure Dust to Clean + if (GT_Values.RA.addCentrifugeRecipe( + material.getDustImpure(1), null, + null, //In Fluid + null, //Out Fluid + matDust, tinyDustB,null, + null, null,null, + new int[]{10000, 10000}, //Chances + 5*20, //Time + tVoltageMultiplier/2)){ //Eu + Logger.MATERIALS("[Centrifuge] Added Recipe: Inpure Dust to Clean Dust"); + } + + } + +} -- cgit From 44815f49166572398396f3540edcc2ae71df3de0 Mon Sep 17 00:00:00 2001 From: Alkalus <3060479+draknyte1@users.noreply.github.com> Date: Mon, 13 Dec 2021 13:18:18 +0000 Subject: Re-add Dehydrator recipe for Fluorite. Adjust Thermal Centrifuge & Centrifuge recipes for GT++ ores to be inline with GT values. Time is now based on material mass. --- .../xmod/gregtech/loaders/RecipeGen_Fluorite.java | 105 ++++++++++++++++++++- .../xmod/gregtech/loaders/RecipeGen_Ore.java | 8 +- 2 files changed, 106 insertions(+), 7 deletions(-) (limited to 'src/Java/gtPlusPlus/xmod/gregtech/loaders') diff --git a/src/Java/gtPlusPlus/xmod/gregtech/loaders/RecipeGen_Fluorite.java b/src/Java/gtPlusPlus/xmod/gregtech/loaders/RecipeGen_Fluorite.java index 82d6de4498..85f239c12e 100644 --- a/src/Java/gtPlusPlus/xmod/gregtech/loaders/RecipeGen_Fluorite.java +++ b/src/Java/gtPlusPlus/xmod/gregtech/loaders/RecipeGen_Fluorite.java @@ -7,9 +7,14 @@ import gregtech.api.enums.GT_Values; import gregtech.api.util.GT_ModHandler; import gtPlusPlus.api.interfaces.RunnableWithInfo; 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.material.Material; import gtPlusPlus.core.material.MaterialGenerator; +import gtPlusPlus.core.material.MaterialStack; import gtPlusPlus.core.material.nuclear.FLUORIDES; +import gtPlusPlus.core.material.state.MaterialState; import gtPlusPlus.core.recipe.common.CI; import gtPlusPlus.core.util.minecraft.FluidUtils; import gtPlusPlus.core.util.minecraft.ItemUtils; @@ -139,7 +144,7 @@ public class RecipeGen_Fluorite extends RecipeGen_Base { if (GT_Values.RA.addPulveriserRecipe(material.getCrushedCentrifuged(1), new ItemStack[]{matDust, matDustA}, new int[]{10000, 1000}, 20*20, tVoltageMultiplier/2)){ Logger.MATERIALS("[Macerator] Added Recipe: 'Macerate Centrifuged ore to Pure Dust'"); } - if (GT_ModHandler.addThermalCentrifugeRecipe(material.getCrushedPurified(1), 200, material.getCrushedCentrifuged(1), tinyDustA, dustStone)){ + if (GT_ModHandler.addThermalCentrifugeRecipe(material.getCrushedPurified(1), (int) Math.min(5000L, Math.abs(material.getMass() * 20L)), material.getCrushedCentrifuged(1), tinyDustA, dustStone)){ Logger.MATERIALS("[ThermalCentrifuge] Added Recipe: 'Washed ore to Centrifuged Ore' | Input: "+material.getCrushedPurified(1).getDisplayName()+" | Outputs: "+material.getCrushedCentrifuged(1).getDisplayName()+", "+tinyDustA.getDisplayName()+", "+dustStone.getDisplayName()+"."); } @@ -171,7 +176,7 @@ public class RecipeGen_Fluorite extends RecipeGen_Base { matDust, tinyDustA,null, null, null,null, new int[]{10000, 10000}, //Chances - 5*20, //Time + (int) Math.max(1L, material.getMass() * 8L), //Time tVoltageMultiplier/2)){ //Eu Logger.MATERIALS("[Centrifuge] Added Recipe: Purified Dust to Clean Dust"); } @@ -184,11 +189,105 @@ public class RecipeGen_Fluorite extends RecipeGen_Base { matDust, tinyDustB,null, null, null,null, new int[]{10000, 10000}, //Chances - 5*20, //Time + (int) Math.max(1L, material.getMass() * 8L), //Time tVoltageMultiplier/2)){ //Eu Logger.MATERIALS("[Centrifuge] Added Recipe: Inpure Dust to Clean Dust"); } + AutoMap> componentMap = new AutoMap>(); + for (MaterialStack r : material.getComposites()){ + if (r != null){ + componentMap.put(new Pair(r.getPartsPerOneHundred(), r.getStackMaterial())); + } + } + + //Process Dust + if (componentMap.size() > 1 && componentMap.size() <= 9){ + Logger.MATERIALS("[Issue][Electrolyzer] "+material.getLocalizedName()+" is composed of over 6 materials, so an electrolyzer recipe for processing cannot be generated. Trying to create one for the Dehydrator instead."); + + ItemStack mInternalOutputs[] = new ItemStack[9]; + int mChances[] = new int[9]; + int mCellCount = 0; + + int mTotalCount = 0; + + int mCounter = 0; + for (Pair f : componentMap){ + if (f.getValue().getState() != MaterialState.SOLID && f.getValue().getState() != MaterialState.ORE){ + Logger.MATERIALS("[Dehydrator] Found Fluid Component, adding "+f.getKey()+" cells of "+f.getValue().getLocalizedName()+"."); + mInternalOutputs[mCounter++] = f.getValue().getCell(f.getKey()); + mCellCount += f.getKey(); + mTotalCount += f.getKey(); + Logger.MATERIALS("[Dehydrator] In total, adding "+mCellCount+" cells for "+material.getLocalizedName()+" processing."); + } + else { + Logger.MATERIALS("[Dehydrator] Found Solid Component, adding "+f.getKey()+" dusts of "+f.getValue().getLocalizedName()+"."); + mInternalOutputs[mCounter++] = f.getValue().getDust(f.getKey()); + mTotalCount += f.getKey(); + } + } + + //Build Output Array + for (int g=0;g 0){ + emptyCell = ItemUtils.getItemStackOfAmountFromOreDict("cellEmpty", mCellCount); + Logger.MATERIALS("[Dehydrator] Recipe now requires "+mCellCount+" empty cells as input."); + } + + ItemStack mainDust = material.getDust(material.smallestStackSizeWhenProcessing); + if (mainDust != null){ + Logger.MATERIALS("[Dehydrator] Recipe now requires "+material.smallestStackSizeWhenProcessing+"x "+mainDust.getDisplayName()+" as input."); + } + else { + mainDust = material.getDust(mTotalCount); + Logger.MATERIALS("[Dehydrator] Could not find valid input dust, trying alternative."); + if (mainDust != null){ + Logger.MATERIALS("[Dehydrator] Recipe now requires "+mTotalCount+"x "+mainDust.getDisplayName()+" as input."); + } + else { + Logger.MATERIALS("[Dehydrator] Could not find valid input dust, exiting."); + } + } + + for (int j=0;j Date: Mon, 13 Dec 2021 13:40:09 +0000 Subject: Fix Fluorite Dehydrator recipe. Add Tooltip to 8k/32k Volumetric Flasks to show max capacity. --- .../handler/events/GeneralTooltipEventHandler.java | 16 ++- .../gtPlusPlus/core/recipe/RECIPES_GREGTECH.java | 24 ----- .../xmod/gregtech/loaders/RecipeGen_Fluorite.java | 117 +++++---------------- 3 files changed, 37 insertions(+), 120 deletions(-) (limited to 'src/Java/gtPlusPlus/xmod/gregtech/loaders') diff --git a/src/Java/gtPlusPlus/core/handler/events/GeneralTooltipEventHandler.java b/src/Java/gtPlusPlus/core/handler/events/GeneralTooltipEventHandler.java index fda7760607..10dea8a7bf 100644 --- a/src/Java/gtPlusPlus/core/handler/events/GeneralTooltipEventHandler.java +++ b/src/Java/gtPlusPlus/core/handler/events/GeneralTooltipEventHandler.java @@ -6,8 +6,10 @@ import gtPlusPlus.GTplusplus; import gtPlusPlus.GTplusplus.INIT_PHASE; import gtPlusPlus.core.block.ModBlocks; import gtPlusPlus.core.lib.CORE; +import gtPlusPlus.core.util.math.MathUtils; import gtPlusPlus.core.util.minecraft.ItemUtils; import gtPlusPlus.core.util.sys.KeyboardUtils; +import gtPlusPlus.xmod.gregtech.api.enums.GregtechItemList; import net.minecraft.block.Block; import net.minecraft.item.ItemStack; import net.minecraft.util.EnumChatFormatting; @@ -22,7 +24,7 @@ public class GeneralTooltipEventHandler { @SubscribeEvent public void onItemTooltip(ItemTooltipEvent event){ - + if (GTplusplus.CURRENT_LOAD_PHASE != INIT_PHASE.STARTED && GTplusplus.CURRENT_LOAD_PHASE != INIT_PHASE.SERVER_START) { return; } @@ -68,8 +70,16 @@ public class GeneralTooltipEventHandler { event.toolTip.add(EnumChatFormatting.GOLD+"Capacity: "+EnumChatFormatting.AQUA+"128000L"); } } - - + + // Custom Flasks + + if (GregtechItemList.VOLUMETRIC_FLASK_8k.hasBeenSet() && event.itemStack.getItem() == GregtechItemList.VOLUMETRIC_FLASK_8k.getItem()) { + event.toolTip.add("Max Capacity: "+MathUtils.formatNumbers(8000)+"L"); + } + if (GregtechItemList.VOLUMETRIC_FLASK_32k.hasBeenSet() && event.itemStack.getItem() == GregtechItemList.VOLUMETRIC_FLASK_32k.getItem()) { + event.toolTip.add("Max Capacity: "+MathUtils.formatNumbers(32000)+"L"); + } + if (CORE.ConfigSwitches.enableAnimatedTurbines) { boolean shift = false; diff --git a/src/Java/gtPlusPlus/core/recipe/RECIPES_GREGTECH.java b/src/Java/gtPlusPlus/core/recipe/RECIPES_GREGTECH.java index c8b65bfd37..3d0e6aebfd 100644 --- a/src/Java/gtPlusPlus/core/recipe/RECIPES_GREGTECH.java +++ b/src/Java/gtPlusPlus/core/recipe/RECIPES_GREGTECH.java @@ -1290,30 +1290,6 @@ public class RECIPES_GREGTECH { 2 * 20, 500); // EU - // CaF2 + H2SO4 → CaSO4(solid) + 2 HF - FluidStack aGregtechHydro = FluidUtils.getFluidStack("hydrofluoricacid_gt5u", 16000); - if (aGregtechHydro == null) { - aGregtechHydro = FluidUtils.getFluidStack("hydrofluoricacid", 16000); - } - - CORE.RA.addDehydratorRecipe( - new ItemStack[] { - CI.getNumberedAdvancedCircuit(5), - ItemUtils.getItemStackOfAmountFromOreDict("dustFluorite", 37), - }, - FluidUtils.getFluidStack("sulfuricacid", 56 * 144), - aGregtechHydro, // Fluid output (slot 2) - new ItemStack[] { - ItemUtils.getItemStackOfAmountFromOreDict("dustCalciumSulfate", 30), - ItemUtils.getItemStackOfAmountFromOreDict("dustSilver", 1), - ItemUtils.getItemStackOfAmountFromOreDict("dustGold", 2), - ItemUtils.getItemStackOfAmountFromOreDict("dustTin", 1), - ItemUtils.getItemStackOfAmountFromOreDict("dustCopper", 2) - }, - new int[] { 10000, 100, 100, 300, 200 }, - 10 * 60 * 20, - 230); // EU - CORE.RA.addDehydratorRecipe( new ItemStack[] { diff --git a/src/Java/gtPlusPlus/xmod/gregtech/loaders/RecipeGen_Fluorite.java b/src/Java/gtPlusPlus/xmod/gregtech/loaders/RecipeGen_Fluorite.java index 85f239c12e..b285d41652 100644 --- a/src/Java/gtPlusPlus/xmod/gregtech/loaders/RecipeGen_Fluorite.java +++ b/src/Java/gtPlusPlus/xmod/gregtech/loaders/RecipeGen_Fluorite.java @@ -21,6 +21,7 @@ import gtPlusPlus.core.util.minecraft.ItemUtils; import gtPlusPlus.core.util.minecraft.MaterialUtils; import gtPlusPlus.core.util.minecraft.RecipeUtils; import net.minecraft.item.ItemStack; +import net.minecraftforge.fluids.FluidStack; public class RecipeGen_Fluorite extends RecipeGen_Base { @@ -194,99 +195,29 @@ public class RecipeGen_Fluorite extends RecipeGen_Base { Logger.MATERIALS("[Centrifuge] Added Recipe: Inpure Dust to Clean Dust"); } - AutoMap> componentMap = new AutoMap>(); - for (MaterialStack r : material.getComposites()){ - if (r != null){ - componentMap.put(new Pair(r.getPartsPerOneHundred(), r.getStackMaterial())); - } - } - - //Process Dust - if (componentMap.size() > 1 && componentMap.size() <= 9){ - Logger.MATERIALS("[Issue][Electrolyzer] "+material.getLocalizedName()+" is composed of over 6 materials, so an electrolyzer recipe for processing cannot be generated. Trying to create one for the Dehydrator instead."); - - ItemStack mInternalOutputs[] = new ItemStack[9]; - int mChances[] = new int[9]; - int mCellCount = 0; - - int mTotalCount = 0; - - int mCounter = 0; - for (Pair f : componentMap){ - if (f.getValue().getState() != MaterialState.SOLID && f.getValue().getState() != MaterialState.ORE){ - Logger.MATERIALS("[Dehydrator] Found Fluid Component, adding "+f.getKey()+" cells of "+f.getValue().getLocalizedName()+"."); - mInternalOutputs[mCounter++] = f.getValue().getCell(f.getKey()); - mCellCount += f.getKey(); - mTotalCount += f.getKey(); - Logger.MATERIALS("[Dehydrator] In total, adding "+mCellCount+" cells for "+material.getLocalizedName()+" processing."); - } - else { - Logger.MATERIALS("[Dehydrator] Found Solid Component, adding "+f.getKey()+" dusts of "+f.getValue().getLocalizedName()+"."); - mInternalOutputs[mCounter++] = f.getValue().getDust(f.getKey()); - mTotalCount += f.getKey(); - } - } - - //Build Output Array - for (int g=0;g 0){ - emptyCell = ItemUtils.getItemStackOfAmountFromOreDict("cellEmpty", mCellCount); - Logger.MATERIALS("[Dehydrator] Recipe now requires "+mCellCount+" empty cells as input."); - } - - ItemStack mainDust = material.getDust(material.smallestStackSizeWhenProcessing); - if (mainDust != null){ - Logger.MATERIALS("[Dehydrator] Recipe now requires "+material.smallestStackSizeWhenProcessing+"x "+mainDust.getDisplayName()+" as input."); - } - else { - mainDust = material.getDust(mTotalCount); - Logger.MATERIALS("[Dehydrator] Could not find valid input dust, trying alternative."); - if (mainDust != null){ - Logger.MATERIALS("[Dehydrator] Recipe now requires "+mTotalCount+"x "+mainDust.getDisplayName()+" as input."); - } - else { - Logger.MATERIALS("[Dehydrator] Could not find valid input dust, exiting."); - } - } - - for (int j=0;j Date: Mon, 13 Dec 2021 14:56:53 +0000 Subject: Fix duplicate ore generation recipes. --- src/Java/gtPlusPlus/core/item/ModItems.java | 7 ++- .../core/material/MaterialGenerator.java | 48 +++++++++++++++ .../everglades/GTplusplus_Everglades.java | 30 ---------- .../loaders/RecipeGen_MaterialProcessing.java | 68 +++++++++------------- .../xmod/gregtech/loaders/RecipeGen_Ore.java | 21 +++++-- 5 files changed, 95 insertions(+), 79 deletions(-) (limited to 'src/Java/gtPlusPlus/xmod/gregtech/loaders') diff --git a/src/Java/gtPlusPlus/core/item/ModItems.java b/src/Java/gtPlusPlus/core/item/ModItems.java index 4c6f0dc712..47278c559d 100644 --- a/src/Java/gtPlusPlus/core/item/ModItems.java +++ b/src/Java/gtPlusPlus/core/item/ModItems.java @@ -523,6 +523,9 @@ public final class ModItems { MaterialGenerator.generateNuclearMaterial(ELEMENT.getInstance().POLONIUM210, false); MaterialGenerator.generateNuclearMaterial(ELEMENT.getInstance().AMERICIUM241, false); + if (!CORE.GTNH) { + MaterialGenerator.generateOreMaterialWithAllExcessComponents(ELEMENT.getInstance().TRINIUM); + } //Custom Materials that will have standalone refinery processes MaterialGenerator.generate(ELEMENT.STANDALONE.ADVANCED_NITINOL, false); @@ -534,8 +537,8 @@ public final class ModItems { //Custom Materials that are from Runescape MaterialGenerator.generate(ELEMENT.STANDALONE.BLACK_METAL); MaterialGenerator.generate(ELEMENT.STANDALONE.WHITE_METAL); - MaterialGenerator.generate(ELEMENT.STANDALONE.GRANITE, false, false); - MaterialGenerator.generate(ELEMENT.STANDALONE.RUNITE, false); + MaterialGenerator.generateOreMaterialWithAllExcessComponents(ELEMENT.STANDALONE.GRANITE); + MaterialGenerator.generateOreMaterialWithAllExcessComponents(ELEMENT.STANDALONE.RUNITE); MaterialGenerator.generate(ELEMENT.STANDALONE.DRAGON_METAL, false); MISC_MATERIALS.run(); diff --git a/src/Java/gtPlusPlus/core/material/MaterialGenerator.java b/src/Java/gtPlusPlus/core/material/MaterialGenerator.java index 96b5d8139f..d1ea784b81 100644 --- a/src/Java/gtPlusPlus/core/material/MaterialGenerator.java +++ b/src/Java/gtPlusPlus/core/material/MaterialGenerator.java @@ -411,6 +411,54 @@ public class MaterialGenerator { t.printStackTrace(); } } + + public static boolean generateOreMaterialWithAllExcessComponents(final Material matInfo){ + try { + if (matInfo == null){ + Logger.DEBUG_MATERIALS("Invalid Material while constructing null material."); + return false; + } + final short[] C = matInfo.getRGBA(); + final Integer Colour = Utils.rgbtoHexValue(C[0], C[1], C[2]); + + tempBlock = new BlockBaseOre(matInfo, BlockTypes.ORE, Colour.intValue()); + tempBlock = new BlockBaseModular(matInfo,BlockTypes.STANDARD); + temp = new BaseItemIngot(matInfo); + temp = new BaseItemDust(matInfo); + temp = new BaseItemNugget(matInfo); + temp = new BaseItemPlate(matInfo); + temp = new BaseItemPlateDouble(matInfo); + + + temp = new BaseItemCrushedOre(matInfo); + temp = new BaseItemCentrifugedCrushedOre(matInfo); + temp = new BaseItemPurifiedCrushedOre(matInfo); + temp = new BaseItemImpureDust(matInfo); + temp = new BaseItemPurifiedDust(matInfo); + + Logger.MATERIALS("Generated all ore & base components for "+matInfo.getLocalizedName()+", now generating processing recipes."); + + new RecipeGen_Ore(matInfo, true); + new RecipeGen_AlloySmelter(matInfo); + new RecipeGen_Assembler(matInfo); + new RecipeGen_BlastSmelter(matInfo); + new RecipeGen_MetalRecipe(matInfo); + new RecipeGen_Extruder(matInfo); + new RecipeGen_Fluids(matInfo); + new RecipeGen_Plates(matInfo); + new RecipeGen_ShapedCrafting(matInfo); + new RecipeGen_MaterialProcessing(matInfo); + new RecipeGen_DustGeneration(matInfo); + new RecipeGen_Recycling(matInfo); + return true; + } + catch (final Throwable t){ + Logger.MATERIALS(""+matInfo.getLocalizedName()+" failed to generate."); + t.printStackTrace(); + return false; + } + + } } diff --git a/src/Java/gtPlusPlus/everglades/GTplusplus_Everglades.java b/src/Java/gtPlusPlus/everglades/GTplusplus_Everglades.java index 0709f0b1ff..ef8aa080c2 100644 --- a/src/Java/gtPlusPlus/everglades/GTplusplus_Everglades.java +++ b/src/Java/gtPlusPlus/everglades/GTplusplus_Everglades.java @@ -126,36 +126,6 @@ public class GTplusplus_Everglades implements ActionListener { if (LoadedMods.Big_Reactors) { MaterialGenerator.generateOreMaterial(ELEMENT.getInstance().YELLORIUM, false, false, true, new short[] {255, 242, 10}); } - - if (!CORE.GTNH) { - MaterialGenerator.generateOreMaterial( - ELEMENT.getInstance().TRINIUM, - true, - false, - false, - ELEMENT.getInstance().TRINIUM_REFINED.getRGBA()); - } - - - - /* - * OSRS Materials - */ - - MaterialGenerator.generateOreMaterial( - ELEMENT.STANDALONE.GRANITE, - true, - false, - false, - ELEMENT.STANDALONE.GRANITE.getRGBA()); - MaterialGenerator.generateOreMaterial( - ELEMENT.STANDALONE.RUNITE, - true, - false, - false, - ELEMENT.STANDALONE.RUNITE.getRGBA()); - - } diff --git a/src/Java/gtPlusPlus/xmod/gregtech/loaders/RecipeGen_MaterialProcessing.java b/src/Java/gtPlusPlus/xmod/gregtech/loaders/RecipeGen_MaterialProcessing.java index f8108852f4..92d7f73ba4 100644 --- a/src/Java/gtPlusPlus/xmod/gregtech/loaders/RecipeGen_MaterialProcessing.java +++ b/src/Java/gtPlusPlus/xmod/gregtech/loaders/RecipeGen_MaterialProcessing.java @@ -3,12 +3,7 @@ package gtPlusPlus.xmod.gregtech.loaders; import java.util.HashSet; import java.util.Set; -import net.minecraft.item.ItemStack; - -import gregtech.api.GregTech_API; import gregtech.api.enums.GT_Values; -import gregtech.api.util.GT_Recipe; - import gtPlusPlus.api.interfaces.RunnableWithInfo; import gtPlusPlus.api.objects.Logger; import gtPlusPlus.api.objects.data.AutoMap; @@ -20,6 +15,7 @@ import gtPlusPlus.core.material.MaterialStack; import gtPlusPlus.core.material.state.MaterialState; import gtPlusPlus.core.recipe.common.CI; import gtPlusPlus.core.util.minecraft.ItemUtils; +import net.minecraft.item.ItemStack; import net.minecraftforge.fluids.FluidStack; public class RecipeGen_MaterialProcessing extends RecipeGen_Base { @@ -30,16 +26,24 @@ public class RecipeGen_MaterialProcessing extends RecipeGen_Base { } public RecipeGen_MaterialProcessing(final Material M){ - this.toGenerate = M; + this(M, false); + } + + public RecipeGen_MaterialProcessing(final Material M, final boolean O){ + this.toGenerate = M; + this.disableOptional = O; mRecipeGenMap.add(this); } @Override public void run() { - generateRecipes(this.toGenerate); + generateRecipes(this.toGenerate, this.disableOptional); } - private void generateRecipes(final Material material){ + private void generateRecipes(final Material material, final boolean disableOptional){ + if (disableOptional) { + return; + } if (material.getMaterialComposites().length > 1){ Logger.MATERIALS("[Recipe Generator Debug] ["+material.getLocalizedName()+"]"); @@ -65,7 +69,7 @@ public class RecipeGen_MaterialProcessing extends RecipeGen_Base { /** - * Electrolyzer + * Centrifuge */ //Process Dust @@ -79,14 +83,14 @@ public class RecipeGen_MaterialProcessing extends RecipeGen_Base { int mCounter = 0; for (Pair f : componentMap){ if (f.getValue().getState() != MaterialState.SOLID){ - Logger.MATERIALS("[Electrolyzer] Found Fluid Component, adding "+f.getKey()+" cells of "+f.getValue().getLocalizedName()+"."); + Logger.MATERIALS("[Centrifuge] Found Fluid Component, adding "+f.getKey()+" cells of "+f.getValue().getLocalizedName()+"."); mInternalOutputs[mCounter++] = f.getValue().getCell(f.getKey()); mCellCount += f.getKey(); mTotalCount += f.getKey(); - Logger.MATERIALS("[Electrolyzer] In total, adding "+mCellCount+" cells for "+material.getLocalizedName()+" processing."); + Logger.MATERIALS("[Centrifuge] In total, adding "+mCellCount+" cells for "+material.getLocalizedName()+" processing."); } else { - Logger.MATERIALS("[Electrolyzer] Found Solid Component, adding "+f.getKey()+" dusts of "+f.getValue().getLocalizedName()+"."); + Logger.MATERIALS("[Centrifuge] Found Solid Component, adding "+f.getKey()+" dusts of "+f.getValue().getLocalizedName()+"."); mInternalOutputs[mCounter++] = f.getValue().getDust(f.getKey()); mTotalCount += f.getKey(); } @@ -94,38 +98,38 @@ public class RecipeGen_MaterialProcessing extends RecipeGen_Base { //Build Output Array for (int g=0;g 0){ emptyCell = ItemUtils.getItemStackOfAmountFromOreDict("cellEmpty", mCellCount); - Logger.MATERIALS("[Electrolyzer] Recipe now requires "+mCellCount+" empty cells as input."); + Logger.MATERIALS("[Centrifuge] Recipe now requires "+mCellCount+" empty cells as input."); } ItemStack mainDust = material.getDust(material.smallestStackSizeWhenProcessing); if (mainDust != null){ - Logger.MATERIALS("[Electrolyzer] Recipe now requires "+material.smallestStackSizeWhenProcessing+"x "+mainDust.getDisplayName()+" as input."); + Logger.MATERIALS("[Centrifuge] Recipe now requires "+material.smallestStackSizeWhenProcessing+"x "+mainDust.getDisplayName()+" as input."); } else { mainDust = material.getDust(mTotalCount); - Logger.MATERIALS("[Electrolyzer] Could not find valid input dust, trying alternative."); + Logger.MATERIALS("[Centrifuge] Could not find valid input dust, trying alternative."); if (mainDust != null){ - Logger.MATERIALS("[Electrolyzer] Recipe now requires "+mTotalCount+"x "+mainDust.getDisplayName()+" as input."); + Logger.MATERIALS("[Centrifuge] Recipe now requires "+mTotalCount+"x "+mainDust.getDisplayName()+" as input."); } else { - Logger.MATERIALS("[Electrolyzer] Could not find valid input dust, exiting."); + Logger.MATERIALS("[Centrifuge] Could not find valid input dust, exiting."); } } for (int j=0;j 0 && componentMap.size() <= 6){ @@ -434,9 +440,7 @@ public class RecipeGen_Ore extends RecipeGen_Base { } } - try{ - - + try{ if (CORE.RA.addDehydratorRecipe( new ItemStack[]{mainDust, emptyCell}, null, @@ -446,6 +450,10 @@ public class RecipeGen_Ore extends RecipeGen_Base { (int) Math.max(material.getMass() * 4L * 1, 1), tVoltageMultiplier)){ Logger.MATERIALS("[Dehydrator] Generated Dehydrator recipe for "+matDust.getDisplayName()); + Logger.MATERIALS("Inputs: "+mainDust.getDisplayName()+" x"+mainDust.stackSize+", "+(emptyCell == null ? "No Cells" : ""+emptyCell.getDisplayName()+" x"+emptyCell.stackSize)); + Logger.MATERIALS("Outputs "+ItemUtils.getArrayStackNames(mInternalOutputs)); + Logger.MATERIALS("Time: "+((int) Math.max(material.getMass() * 4L * 1, 1))); + Logger.MATERIALS("EU: "+tVoltageMultiplier); } else { Logger.MATERIALS("[Dehydrator] Failed to generate Dehydrator recipe for "+matDust.getDisplayName()); @@ -457,6 +465,7 @@ public class RecipeGen_Ore extends RecipeGen_Base { } + } /** -- cgit From a52711dc135c700b0e72f49330e513523ff49d0f Mon Sep 17 00:00:00 2001 From: Alkalus <3060479+draknyte1@users.noreply.github.com> Date: Mon, 13 Dec 2021 16:25:02 +0000 Subject: Further refine GT_MetaTileEntity_Hatch_AirIntake. Stop AddCustomMachineToPA using reflection. --- .../GT_MetaTileEntity_Hatch_AirIntake.java | 97 ++++++++-------------- .../loaders/misc/AddCustomMachineToPA.java | 39 ++------- 2 files changed, 42 insertions(+), 94 deletions(-) (limited to 'src/Java/gtPlusPlus/xmod/gregtech/loaders') diff --git a/src/Java/gtPlusPlus/xmod/gregtech/api/metatileentity/implementations/GT_MetaTileEntity_Hatch_AirIntake.java b/src/Java/gtPlusPlus/xmod/gregtech/api/metatileentity/implementations/GT_MetaTileEntity_Hatch_AirIntake.java index 95d6e08420..5fb3b11d08 100644 --- a/src/Java/gtPlusPlus/xmod/gregtech/api/metatileentity/implementations/GT_MetaTileEntity_Hatch_AirIntake.java +++ b/src/Java/gtPlusPlus/xmod/gregtech/api/metatileentity/implementations/GT_MetaTileEntity_Hatch_AirIntake.java @@ -1,28 +1,25 @@ package gtPlusPlus.xmod.gregtech.api.metatileentity.implementations; -import net.minecraftforge.common.util.ForgeDirection; -import net.minecraftforge.fluids.Fluid; -import net.minecraftforge.fluids.FluidStack; -import net.minecraft.world.World; -import net.minecraft.item.ItemStack; -import net.minecraft.nbt.NBTTagCompound; -import gtPlusPlus.api.objects.Logger; +import java.lang.reflect.Field; + +import gregtech.api.enums.Textures; +import gregtech.api.interfaces.IIconContainer; +import gregtech.api.interfaces.ITexture; +import gregtech.api.interfaces.tileentity.IGregTechTileEntity; +import gregtech.api.metatileentity.MetaTileEntity; +import gregtech.api.metatileentity.implementations.GT_MetaTileEntity_Hatch_Input; +import gregtech.api.objects.GT_RenderedTexture; import gtPlusPlus.api.objects.random.XSTR; import gtPlusPlus.core.lib.CORE; import gtPlusPlus.core.util.minecraft.FluidUtils; import gtPlusPlus.core.util.reflect.ReflectionUtils; - -import gregtech.api.metatileentity.MetaTileEntity; -import gregtech.api.metatileentity.implementations.GT_MetaTileEntity_Hatch_Input; -import gregtech.api.interfaces.tileentity.IGregTechTileEntity; - -import java.lang.reflect.Field; - import net.minecraft.entity.player.EntityPlayer; -import gregtech.api.interfaces.IIconContainer; -import gregtech.api.objects.GT_RenderedTexture; -import gregtech.api.enums.Textures; -import gregtech.api.interfaces.ITexture; +import net.minecraft.item.ItemStack; +import net.minecraft.nbt.NBTTagCompound; +import net.minecraft.world.World; +import net.minecraftforge.common.util.ForgeDirection; +import net.minecraftforge.fluids.Fluid; +import net.minecraftforge.fluids.FluidStack; public class GT_MetaTileEntity_Hatch_AirIntake extends GT_MetaTileEntity_Hatch_Input { @@ -132,25 +129,17 @@ public class GT_MetaTileEntity_Hatch_AirIntake extends GT_MetaTileEntity_Hatch_I super.onPostTick(aBaseMetaTileEntity, aTick); if (!aBaseMetaTileEntity.isAllowedToWork()) { + aBaseMetaTileEntity.setActive(false); mProgresstime = 0; - mMaxProgresstime = 0; - aBaseMetaTileEntity.setActive(false); + mMaxProgresstime = 0; } else { - if (mMaxProgresstime <= 0) { - mMaxProgresstime = 4; + aBaseMetaTileEntity.setActive(true); + mMaxProgresstime = 4; + if (++mProgresstime >= mMaxProgresstime) { + addAirToHatch(aTick); + mProgresstime = 0; } - if (mMaxProgresstime > 0 && mProgresstime >= 0) { - aBaseMetaTileEntity.setActive(true); - if (++mProgresstime >= mMaxProgresstime) { - addAirToHatch(aTick); - mProgresstime = 0; - mMaxProgresstime = 0; - } - } - else { - aBaseMetaTileEntity.setActive(false); - } } } @@ -171,7 +160,9 @@ public class GT_MetaTileEntity_Hatch_AirIntake extends GT_MetaTileEntity_Hatch_I } public void pollutionParticles(final World aWorld, final String name) { - + if (this.getBaseMetaTileEntity().isServerSide()) { + return; + } final float ran1 = GT_MetaTileEntity_Hatch_AirIntake.floatGen.nextFloat(); float ran2 = 0.0f; float ran3 = 0.0f; @@ -193,14 +184,13 @@ public class GT_MetaTileEntity_Hatch_AirIntake extends GT_MetaTileEntity_Hatch_I zSpd = (float) Math.cos(temp) * 0.1f; ySpd = -ySpd; yPos = yPos - 0.8f; - } else { + } + else { xSpd = aDir.offsetX * (0.1f + 0.2f * GT_MetaTileEntity_Hatch_AirIntake.floatGen.nextFloat()); zSpd = aDir.offsetZ * (0.1f + 0.2f * GT_MetaTileEntity_Hatch_AirIntake.floatGen.nextFloat()); xSpd = -xSpd; zSpd = -zSpd; - - } aWorld.spawnParticle(name, (double) (xPos + ran1 * 0.5f), @@ -252,35 +242,16 @@ public class GT_MetaTileEntity_Hatch_AirIntake extends GT_MetaTileEntity_Hatch_I if (!this.getBaseMetaTileEntity().getAirAtSide(this.getBaseMetaTileEntity().getFrontFacing())) { return false; } - boolean a1 = canTankBeFilled(); - if (this.mFluid != null && !isAirInHatch()) { - return false; + boolean didFill = this.fill(FluidUtils.getAir(1000), true) > 0; + if (didFill) { + this.pollutionParticles(this.getBaseMetaTileEntity().getWorld(), "cloud"); } - if (this.mFluid != null && a1) { - this.mFluid.amount += 1000; - if (this.getBaseMetaTileEntity().isClientSide()) { - this.pollutionParticles(this.getBaseMetaTileEntity().getWorld(), "cloud"); - } - return true; - } - else if (this.mFluid != null && !a1) { - return false; - } - else { - if (this.mFluid == null) { - this.mFluid = FluidUtils.getFluidStack("air", 1000); - return true; - } - else { - //Not sure how any other fluid got in here - return false; - } - } + return didFill; } @Override public boolean canTankBeFilled() { - if (this.mFluid == null || (this.mFluid != null && ((this.mFluid.amount+1000) <= this.getCapacity()))) { + if (this.mFluid == null || (this.mFluid != null && (this.mFluid.amount <= this.getCapacity()))) { return true; } return false; @@ -293,12 +264,12 @@ public class GT_MetaTileEntity_Hatch_AirIntake extends GT_MetaTileEntity_Hatch_I @Override public boolean doesFillContainers() { - return false; + return true; } @Override public int fill(FluidStack aFluid, boolean doFill) { - return 0; + return super.fill(aFluid, doFill); } @Override diff --git a/src/Java/gtPlusPlus/xmod/gregtech/loaders/misc/AddCustomMachineToPA.java b/src/Java/gtPlusPlus/xmod/gregtech/loaders/misc/AddCustomMachineToPA.java index e84ce73a47..2e6de159d0 100644 --- a/src/Java/gtPlusPlus/xmod/gregtech/loaders/misc/AddCustomMachineToPA.java +++ b/src/Java/gtPlusPlus/xmod/gregtech/loaders/misc/AddCustomMachineToPA.java @@ -1,51 +1,28 @@ package gtPlusPlus.xmod.gregtech.loaders.misc; -import java.lang.reflect.Method; - import gregtech.api.util.GTPP_Recipe; +import gregtech.api.util.GT_ProcessingArray_Manager; import gregtech.api.util.GT_Recipe.GT_Recipe_Map; -import gtPlusPlus.core.util.reflect.ReflectionUtils; +import gtPlusPlus.api.objects.Logger; public class AddCustomMachineToPA { - private static final boolean sDoesPatchExist; - private static final Class sManagerPA; - private static final Method sRegisterRecipeMapForMeta; - - static { - sDoesPatchExist = ReflectionUtils.doesClassExist("gregtech.api.util.GT_ProcessingArray_Manager"); - if (sDoesPatchExist) { - sManagerPA = ReflectionUtils.getClass("gregtech.api.util.GT_ProcessingArray_Manager"); - sRegisterRecipeMapForMeta = ReflectionUtils.getMethod(sManagerPA, "registerRecipeMapForMeta", int.class, GT_Recipe_Map.class); - } - else { - sManagerPA = null; - sRegisterRecipeMapForMeta = null; - } - } - public static final void registerRecipeMapForID(int aID, GT_Recipe_Map aMap) { - if (sDoesPatchExist) { - ReflectionUtils.invokeNonBool(null, sRegisterRecipeMapForMeta, new Object[] {aID, aMap}); - } - + Logger.INFO("Attempting to add map "+aMap.mNEIName+" to Processing Array for Meta Tile "+aID+". Success? "+GT_ProcessingArray_Manager.registerRecipeMapForMeta(aID, aMap)); } public static final void registerRecipeMapBetweenRangeOfIDs(int aMin, int aMax, GT_Recipe_Map aMap) { - if (sDoesPatchExist) { - for (int i=aMin; i<=aMax;i++) { - ReflectionUtils.invokeNonBool(null, sRegisterRecipeMapForMeta, new Object[] {i, aMap}); - //GT_ProcessingArray_Manager.registerRecipeMapForMeta(i, aMap); - } - } + for (int i=aMin; i<=aMax;i++) { + registerRecipeMapForID(i, aMap); + } } public static void register() { - + // Simple Washers registerRecipeMapForID(767, GTPP_Recipe.GTPP_Recipe_Map.sSimpleWasherRecipes); registerRecipeMapBetweenRangeOfIDs(31017, 31020, GTPP_Recipe.GTPP_Recipe_Map.sSimpleWasherRecipes); - + } } -- cgit