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') 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') 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. --- .../xmod/gregtech/loaders/RecipeGen_Fluorite.java | 117 +++++---------------- 1 file changed, 24 insertions(+), 93 deletions(-) (limited to 'src/Java/gtPlusPlus/xmod') 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. --- .../loaders/RecipeGen_MaterialProcessing.java | 68 +++++++++------------- .../xmod/gregtech/loaders/RecipeGen_Ore.java | 21 +++++-- 2 files changed, 42 insertions(+), 47 deletions(-) (limited to 'src/Java/gtPlusPlus/xmod') 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 7a9fb16c95b9018c139755ef655ab19082f00f77 Mon Sep 17 00:00:00 2001 From: Alkalus <3060479+draknyte1@users.noreply.github.com> Date: Mon, 13 Dec 2021 15:33:07 +0000 Subject: Fix Air Intake Hatch not working. --- .../GT_MetaTileEntity_Hatch_AirIntake.java | 98 +++++++++++++++------- 1 file changed, 70 insertions(+), 28 deletions(-) (limited to 'src/Java/gtPlusPlus/xmod') 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 e6fd5dc797..95d6e08420 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 @@ -5,7 +5,8 @@ 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 gtPlusPlus.api.objects.random.XSTR; import gtPlusPlus.core.lib.CORE; import gtPlusPlus.core.util.minecraft.FluidUtils; @@ -24,7 +25,9 @@ import gregtech.api.enums.Textures; import gregtech.api.interfaces.ITexture; public class GT_MetaTileEntity_Hatch_AirIntake extends GT_MetaTileEntity_Hatch_Input { + private static XSTR floatGen; + public int mProgresstime = 0, mMaxProgresstime = 0; public GT_MetaTileEntity_Hatch_AirIntake(final int aID, final String aName, final String aNameRegional, final int aTier) { @@ -127,14 +130,45 @@ public class GT_MetaTileEntity_Hatch_AirIntake extends GT_MetaTileEntity_Hatch_I public void onPostTick(final IGregTechTileEntity aBaseMetaTileEntity, final long aTick) { super.onPostTick(aBaseMetaTileEntity, aTick); - if (this.getBaseMetaTileEntity().isActive() && addAirToHatch(aTick)) { - if (aTick % 8 == 0) { - if (aBaseMetaTileEntity.isClientSide()) { - this.pollutionParticles(this.getBaseMetaTileEntity().getWorld(), "cloud"); - } + + if (!aBaseMetaTileEntity.isAllowedToWork()) { + mProgresstime = 0; + mMaxProgresstime = 0; + aBaseMetaTileEntity.setActive(false); + } + else { + if (mMaxProgresstime <= 0) { + mMaxProgresstime = 4; } - } + if (mMaxProgresstime > 0 && mProgresstime >= 0) { + aBaseMetaTileEntity.setActive(true); + if (++mProgresstime >= mMaxProgresstime) { + addAirToHatch(aTick); + mProgresstime = 0; + mMaxProgresstime = 0; + } + } + else { + aBaseMetaTileEntity.setActive(false); + } + } } + + @Override + public int getProgresstime() { + return mProgresstime; + } + + @Override + public int maxProgresstime() { + return mMaxProgresstime; + } + + @Override + public int increaseProgress(int aProgress) { + mProgresstime += aProgress; + return mMaxProgresstime - mProgresstime; + } public void pollutionParticles(final World aWorld, final String name) { @@ -210,9 +244,8 @@ public class GT_MetaTileEntity_Hatch_AirIntake extends GT_MetaTileEntity_Hatch_I if (AIR == this.mFluid.getFluid()) { return true; } - else return false; } - return true; + return false; } public boolean addAirToHatch(long aTick) { @@ -220,34 +253,29 @@ public class GT_MetaTileEntity_Hatch_AirIntake extends GT_MetaTileEntity_Hatch_I return false; } boolean a1 = canTankBeFilled(); - if (aTick % 4 != 0 && a1) { + if (this.mFluid != null && !isAirInHatch()) { + return false; + } + if (this.mFluid != null && a1) { + this.mFluid.amount += 1000; + if (this.getBaseMetaTileEntity().isClientSide()) { + this.pollutionParticles(this.getBaseMetaTileEntity().getWorld(), "cloud"); + } return true; } - else if (aTick % 4 != 0 && !a1) { + else if (this.mFluid != null && !a1) { return false; } else { - if (!isAirInHatch()) { - return false; - } - if (this.mFluid != null && a1) { - this.mFluid.amount += 1000; + if (this.mFluid == null) { + this.mFluid = FluidUtils.getFluidStack("air", 1000); 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; - } + //Not sure how any other fluid got in here + return false; } - } + } } @Override @@ -287,4 +315,18 @@ public class GT_MetaTileEntity_Hatch_AirIntake extends GT_MetaTileEntity_Hatch_I public int fill_default(ForgeDirection aSide, FluidStack aFluid, boolean doFill) { return 0; } + + @Override + public void saveNBTData(NBTTagCompound aNBT) { + aNBT.setInteger("mProgresstime", mProgresstime); + aNBT.setInteger("mMaxProgresstime", mMaxProgresstime); + super.saveNBTData(aNBT); + } + + @Override + public void loadNBTData(NBTTagCompound aNBT) { + mProgresstime = aNBT.getInteger("mProgresstime"); + mMaxProgresstime = aNBT.getInteger("mMaxProgresstime"); + super.loadNBTData(aNBT); + } } -- 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') 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