From 56db47add50b0efa8b684bdaff9ca047bf117c16 Mon Sep 17 00:00:00 2001 From: PureBluez Date: Sun, 13 Oct 2024 19:14:33 -0500 Subject: [PATCH 01/22] ponzu ponzu ponzu ponzu ponzu ponzu ponzu ponzu --- .../java/gregtech/api/enums/GTValues.java | 11 + .../java/gregtech/api/enums/ItemList.java | 1 + .../gregtech/api/enums/MetaTileEntityIDs.java | 1 + .../java/gregtech/api/enums/Textures.java | 5 + .../java/gregtech/api/recipe/RecipeMaps.java | 5 + .../machines/multi/MTESolarFactory.java | 364 ++++++++++++++++++ .../loaders/postload/MachineRecipeLoader.java | 2 + .../postload/recipes/SolarFactoryRecipes.java | 21 + .../preload/LoaderMetaTileEntities.java | 6 + .../resources/assets/gregtech/lang/en_US.lang | 3 + .../OVERLAY_FRONT_SOLAR_FACTORY_ACTIVE.png | Bin 0 -> 255 bytes ...VERLAY_FRONT_SOLAR_FACTORY_ACTIVE_GLOW.png | Bin 0 -> 255 bytes .../OVERLAY_FRONT_SOLAR_FACTORY_INACTIVE.png | Bin 0 -> 254 bytes ...RLAY_FRONT_SOLAR_FACTORY_INACTIVE_GLOW.png | Bin 0 -> 256 bytes 14 files changed, 419 insertions(+) create mode 100644 src/main/java/gregtech/common/tileentities/machines/multi/MTESolarFactory.java create mode 100644 src/main/java/gregtech/loaders/postload/recipes/SolarFactoryRecipes.java create mode 100644 src/main/resources/assets/gregtech/textures/blocks/iconsets/OVERLAY_FRONT_SOLAR_FACTORY_ACTIVE.png create mode 100644 src/main/resources/assets/gregtech/textures/blocks/iconsets/OVERLAY_FRONT_SOLAR_FACTORY_ACTIVE_GLOW.png create mode 100644 src/main/resources/assets/gregtech/textures/blocks/iconsets/OVERLAY_FRONT_SOLAR_FACTORY_INACTIVE.png create mode 100644 src/main/resources/assets/gregtech/textures/blocks/iconsets/OVERLAY_FRONT_SOLAR_FACTORY_INACTIVE_GLOW.png diff --git a/src/main/java/gregtech/api/enums/GTValues.java b/src/main/java/gregtech/api/enums/GTValues.java index 388e2aec76b..f07595e7e75 100644 --- a/src/main/java/gregtech/api/enums/GTValues.java +++ b/src/main/java/gregtech/api/enums/GTValues.java @@ -683,6 +683,17 @@ public static final class NBT { + EnumChatFormatting.BOLD + "APenguin"; + public static final String AuthorPureBluez = "Author: " + EnumChatFormatting.WHITE + + "Pure" + + EnumChatFormatting.AQUA + + "B" + + EnumChatFormatting.DARK_AQUA + + "l" + + EnumChatFormatting.BLUE + + "u" + + EnumChatFormatting.DARK_BLUE + + "ez"; + // 7.5F comes from GT_Tool_Turbine_Large#getBaseDamage() given huge turbines are the most efficient now. public static double getMaxPlasmaTurbineEfficiencyFromMaterial(Materials material) { return (5F + (7.5F + material.mToolQuality)) / 10.0; diff --git a/src/main/java/gregtech/api/enums/ItemList.java b/src/main/java/gregtech/api/enums/ItemList.java index 52e3484156d..26d7521581e 100644 --- a/src/main/java/gregtech/api/enums/ItemList.java +++ b/src/main/java/gregtech/api/enums/ItemList.java @@ -1777,6 +1777,7 @@ public enum ItemList implements IItemContainer { OreDrill4, PyrolyseOven, OilCracker, + SolarFactory, NanoForge, Crop_Drop_UUMBerry, Crop_Drop_UUABerry, diff --git a/src/main/java/gregtech/api/enums/MetaTileEntityIDs.java b/src/main/java/gregtech/api/enums/MetaTileEntityIDs.java index c3cbbb02cf3..63eeca40fd7 100644 --- a/src/main/java/gregtech/api/enums/MetaTileEntityIDs.java +++ b/src/main/java/gregtech/api/enums/MetaTileEntityIDs.java @@ -336,6 +336,7 @@ public enum MetaTileEntityIDs { CENTRIFUGE_EV(364), CENTRIFUGE_IV(365), MULTI_SOLIDIFIER_CONTROLLER(366), + SOLAR_FACTORY_CONTROLLER(367), ELECTROLYSER_LV(371), ELECTROLYSER_MV(372), ELECTROLYSER_HV(373), diff --git a/src/main/java/gregtech/api/enums/Textures.java b/src/main/java/gregtech/api/enums/Textures.java index 5e21d6e9e98..68d6c3b4d26 100644 --- a/src/main/java/gregtech/api/enums/Textures.java +++ b/src/main/java/gregtech/api/enums/Textures.java @@ -1261,6 +1261,11 @@ public enum BlockIcons implements IIconContainer, Runnable { OVERLAY_TOP_CLEANROOM, OVERLAY_TOP_CLEANROOM_GLOW, + OVERLAY_FRONT_SOLAR_FACTORY_ACTIVE, + OVERLAY_FRONT_SOLAR_FACTORY_ACTIVE_GLOW, + OVERLAY_FRONT_SOLAR_FACTORY_INACTIVE_GLOW, + OVERLAY_FRONT_SOLAR_FACTORY_INACTIVE, + OVERLAY_FRONT_LARGE_CHEMICAL_REACTOR, OVERLAY_FRONT_LARGE_CHEMICAL_REACTOR_GLOW, OVERLAY_FRONT_LARGE_CHEMICAL_REACTOR_ACTIVE, diff --git a/src/main/java/gregtech/api/recipe/RecipeMaps.java b/src/main/java/gregtech/api/recipe/RecipeMaps.java index 47060d088b9..95b54961175 100644 --- a/src/main/java/gregtech/api/recipe/RecipeMaps.java +++ b/src/main/java/gregtech/api/recipe/RecipeMaps.java @@ -836,6 +836,11 @@ && isArrayEmptyOrNull(b.getFluidOutputs()) .minInputs(1, 0) .disableOptimize() .build(); + public static final RecipeMap solarFactoryRecipes = RecipeMapBuilder.of("gt.recipe.solarfactory") + .maxIO(9, 1, 1, 0) + .minInputs(1, 0) + .disableOptimize() + .build(); public static final RecipeMap wiremillRecipes = RecipeMapBuilder.of("gt.recipe.wiremill") .maxIO(2, 1, 0, 0) .minInputs(1, 0) diff --git a/src/main/java/gregtech/common/tileentities/machines/multi/MTESolarFactory.java b/src/main/java/gregtech/common/tileentities/machines/multi/MTESolarFactory.java new file mode 100644 index 00000000000..8a893a693c3 --- /dev/null +++ b/src/main/java/gregtech/common/tileentities/machines/multi/MTESolarFactory.java @@ -0,0 +1,364 @@ +package gregtech.common.tileentities.machines.multi; + +import static com.gtnewhorizon.structurelib.structure.StructureUtility.*; +import static gregtech.api.enums.HatchElement.*; +import static gregtech.api.enums.Textures.BlockIcons.OVERLAY_FRONT_SOLAR_FACTORY_ACTIVE; +import static gregtech.api.enums.Textures.BlockIcons.OVERLAY_FRONT_SOLAR_FACTORY_ACTIVE_GLOW; +import static gregtech.api.enums.Textures.BlockIcons.OVERLAY_FRONT_SOLAR_FACTORY_INACTIVE; +import static gregtech.api.enums.Textures.BlockIcons.OVERLAY_FRONT_SOLAR_FACTORY_INACTIVE_GLOW; +import static gregtech.api.enums.Textures.BlockIcons.casingTexturePages; +import static gregtech.api.util.GTStructureUtility.buildHatchAdder; +import static gregtech.api.util.GTStructureUtility.ofFrame; +import static gregtech.api.util.GTUtility.copyAmount; +import static net.minecraft.util.EnumChatFormatting.BLUE; +import static net.minecraft.util.EnumChatFormatting.DARK_AQUA; + +import javax.annotation.Nonnull; + +import net.minecraft.item.ItemStack; +import net.minecraft.nbt.NBTTagCompound; +import net.minecraftforge.common.util.ForgeDirection; + +import org.apache.commons.lang3.ArrayUtils; +import org.apache.commons.lang3.tuple.Pair; +import org.jetbrains.annotations.NotNull; + +import com.google.common.collect.ImmutableList; +import com.gtnewhorizon.structurelib.alignment.constructable.IConstructable; +import com.gtnewhorizon.structurelib.alignment.constructable.ISurvivalConstructable; +import com.gtnewhorizon.structurelib.structure.IStructureDefinition; +import com.gtnewhorizon.structurelib.structure.ISurvivalBuildEnvironment; +import com.gtnewhorizon.structurelib.structure.StructureDefinition; + +import goodgenerator.loader.Loaders; +import gregtech.api.GregTechAPI; +import gregtech.api.enums.GTValues; +import gregtech.api.enums.ItemList; +import gregtech.api.enums.Materials; +import gregtech.api.interfaces.ITexture; +import gregtech.api.interfaces.metatileentity.IMetaTileEntity; +import gregtech.api.interfaces.tileentity.IGregTechTileEntity; +import gregtech.api.logic.ProcessingLogic; +import gregtech.api.metatileentity.GregTechTileClientEvents; +import gregtech.api.metatileentity.implementations.MTEEnhancedMultiBlockBase; +import gregtech.api.multitileentity.multiblock.casing.Glasses; +import gregtech.api.recipe.RecipeMap; +import gregtech.api.recipe.RecipeMaps; +import gregtech.api.recipe.check.CheckRecipeResult; +import gregtech.api.recipe.check.CheckRecipeResultRegistry; +import gregtech.api.recipe.check.SimpleCheckRecipeResult; +import gregtech.api.render.TextureFactory; +import gregtech.api.util.GTRecipe; +import gregtech.api.util.MultiblockTooltipBuilder; +import gregtech.api.util.ParallelHelper; + +public class MTESolarFactory extends MTEEnhancedMultiBlockBase + implements IConstructable, ISurvivalConstructable { + + protected IStructureDefinition multiDefinition = null; + protected int casingAmount; + protected int casingTier; + ItemStack waferStack; + int outputMultiplier; + boolean didFindStack; + private static final int PRECISE_CASING_INDEX = 1541; + private static final int CASING_INDEX = 16; + + // Left side of the pair is a valid wafer for input, right side is lowered by the recipe's special value and then + // the recipe output (after parallels) is multiplied by it + public static final ImmutableList> validWafers = ImmutableList.of( + Pair.of(ItemList.Circuit_Silicon_Wafer.get(1), 1), + Pair.of(ItemList.Circuit_Silicon_Wafer2.get(1), 2), + Pair.of(ItemList.Circuit_Silicon_Wafer3.get(1), 3), + Pair.of(ItemList.Circuit_Silicon_Wafer4.get(1), 4), + Pair.of(ItemList.Circuit_Silicon_Wafer5.get(1), 5), + Pair.of(ItemList.Circuit_Silicon_Wafer6.get(1), 6), + Pair.of(ItemList.Circuit_Silicon_Wafer7.get(1), 7)); + + public MTESolarFactory(String aName) { + super(aName); + } + + public MTESolarFactory(final int aID, final String aName, final String aNameRegional) { + super(aID, aName, aNameRegional); + } + + @Override + public IMetaTileEntity newMetaEntity(IGregTechTileEntity aTileEntity) { + return new MTESolarFactory(mName); + } + + private static final String STRUCTURE_PIECE_MAIN = "main"; + private static final IStructureDefinition STRUCTURE_DEFINITION = StructureDefinition + .builder() + .addShape( + STRUCTURE_PIECE_MAIN, + transpose( + new String[][] { + { " CCC ", " CCFCC ", " CCFFFCC ", "CCFFFFFCC", " CCFFFCC ", " CCFCC ", " CCC " }, + { " BBB ", " C C ", " B B ", "C C", " B B ", " C C ", " BBB " }, + { " CCC ", " CCCCC ", " CCCCCCC ", "CCCCCCCCC", " CCCCCCC ", " CCCCC ", " CCC " }, + { " ", " EBBBE ", " B B ", "E B D B E", " B B ", " EBBBE ", " " }, + { " ", " EBBBE ", " B B ", "E B D B E", " B B ", " EBBBE ", " " }, + { " ", " EBBBE ", " B B ", "E B D B E", " B B ", " EBBBE ", " " }, + { " ", " EBBBE ", " B B ", "E B D B E", " B B ", " EBBBE ", " " }, + { " CCC ", " CCCCC ", " CCCCCCC ", "CCCCCCCCC", " CCCCCCC ", " CCCCC ", " CCC " }, + { " B~B ", " C C ", " B B ", "C C", " B B ", " C C ", " BBB " }, + { " CCC ", " CCFCC ", " CCFFFCC ", "CCFFFFFCC", " CCFFFCC ", " CCFCC ", " CCC " } })) + .addElement( + 'F', + withChannel( + "unit casing", + buildHatchAdder(MTESolarFactory.class).atLeast(InputHatch, InputBus, OutputBus, Maintenance, Energy) + .casingIndex(PRECISE_CASING_INDEX) + .dot(1) + .buildAndChain( + onElementPass( + MTESolarFactory::onCasingAdded, + ofBlocksTiered( + (block, meta) -> block == Loaders.preciseUnitCasing ? meta : -2, + // ^ if preciseUnitCasing return meta, otherwise return -2 & fail checkMachine :3 + ImmutableList.of( + Pair.of(Loaders.preciseUnitCasing, 0), + Pair.of(Loaders.preciseUnitCasing, 1), + Pair.of(Loaders.preciseUnitCasing, 2), + Pair.of(Loaders.preciseUnitCasing, 3)), + -3, + MTESolarFactory::setCasingTier, + MTESolarFactory::getCasingTier))))) + .addElement( + 'C', + buildHatchAdder(MTESolarFactory.class).atLeast(InputHatch, InputBus, OutputBus, Maintenance, Energy) + .casingIndex(CASING_INDEX) + .dot(1) + .buildAndChain(onElementPass(MTESolarFactory::onCasingAdded, ofBlock(GregTechAPI.sBlockCasings2, 0)))) + .addElement('D', ofBlock(GregTechAPI.sBlockCasings2, 5)) + .addElement('B', Glasses.chainAllGlasses()) + .addElement('E', ofFrame(Materials.NiobiumTitanium)) + .build(); + + public int getCasingTier() { + return casingTier; + } + + public void setCasingTier(int i) { + casingTier = i; + } + + private void onCasingAdded() { + casingAmount++; + } + + @Override + public IStructureDefinition getStructureDefinition() { + return STRUCTURE_DEFINITION; + } + + @Override + public void loadNBTData(NBTTagCompound aNBT) { + casingTier = aNBT.getInteger("casingTier"); + super.loadNBTData(aNBT); + } + + @Override + public void saveNBTData(NBTTagCompound aNBT) { + aNBT.setInteger("casingTier", casingTier); + super.saveNBTData(aNBT); + } + + @Override + public boolean checkMachine(IGregTechTileEntity aBaseMetaTileEntity, ItemStack aStack) { + this.casingAmount = 0; + this.casingTier = -3; + if (checkPiece(STRUCTURE_PIECE_MAIN, 4, 8, 0)) { + getBaseMetaTileEntity().sendBlockEvent(GregTechTileClientEvents.CHANGE_CUSTOM_DATA, getUpdateData()); + return casingAmount >= 8 && casingTier >= -1 && mMaintenanceHatches.size() == 1; + } + return false; + } + + @Override + public byte getUpdateData() { + return (byte) casingTier; + } + + @Override + public void construct(ItemStack stackSize, boolean hintsOnly) { + buildPiece(STRUCTURE_PIECE_MAIN, stackSize, hintsOnly, 4, 8, 0); + } + + @Override + public int survivalConstruct(ItemStack stackSize, int elementBudget, ISurvivalBuildEnvironment env) { + if (mMachine) return -1; + return survivialBuildPiece(STRUCTURE_PIECE_MAIN, stackSize, 4, 8, 0, elementBudget, env, false, true); + } + + // TODO: + // calculate outputs Properly + // make tooltip :3 + // get staffix to make sf recipes cuz she asked if she could :3 + + protected ItemStack[] calculateOutput(ItemStack currentOutput, int seed) { + double calculatedMultiplier = ((0.25 * seed) + 1); + if (calculatedMultiplier > 2) calculatedMultiplier = 2; + int outputSize = (int) Math.floor(currentOutput.stackSize * calculatedMultiplier); + return new ItemStack[] { copyAmount(outputSize, currentOutput) }; + } + + @NotNull + @Override + public CheckRecipeResult checkProcessing() { + setupProcessingLogic(processingLogic); + + CheckRecipeResult result = doCheckRecipe(); + result = postCheckRecipe(result, processingLogic); + // inputs are consumed at this point + updateSlots(); + if (!result.wasSuccessful()) return result; + + mEfficiency = (10000 - (getIdealStatus() - getRepairStatus()) * 1000); + mEfficiencyIncrease = 10000; + mMaxProgresstime = processingLogic.getDuration(); + setEnergyUsage(processingLogic); + + mOutputItems = calculateOutput(processingLogic.getOutputItems()[0], outputMultiplier); + mOutputFluids = processingLogic.getOutputFluids(); + + waferStack = null; + outputMultiplier = 0; + didFindStack = false; + + return result; + } + + @Override + protected ProcessingLogic createProcessingLogic() { + return new ProcessingLogic() { + + // validateRecipe is called before createParallelHelper or checkProcessing so checking for wafers and + // overriding the variables will go there + @NotNull + @Override + public CheckRecipeResult validateRecipe(@NotNull GTRecipe recipe) { + for (ItemStack items : getStoredInputs()) { + // iterate over the validWafers List + for (Pair p : validWafers) { + if (items.isItemEqual(p.getLeft())) { + waferStack = p.getLeft(); + outputMultiplier = (p.getRight() - recipe.mSpecialValue); + didFindStack = true; + // items will never equal another entry in validWafers so break out of the loop + break; + } + } + } + if (!didFindStack) { + return SimpleCheckRecipeResult.ofFailure("no_wafer"); + } + if (recipe.mSpecialValue > outputMultiplier) { + return SimpleCheckRecipeResult.ofFailure("low_wafer_tier"); + } + return CheckRecipeResultRegistry.SUCCESSFUL; + } + + @Nonnull + private GTRecipe recipeAfterAdjustments(@Nonnull GTRecipe recipe) { + GTRecipe tRecipe = recipe.copy(); + tRecipe.mInputs = ArrayUtils.add(tRecipe.mInputs, waferStack); + return tRecipe; + } + + @NotNull + @Override + protected ParallelHelper createParallelHelper(@Nonnull GTRecipe recipe) { + return super.createParallelHelper(recipeAfterAdjustments(recipe)); + } + }.setMaxParallel((int) Math.pow(2, 4 + (casingTier + 1))); + } + + @Override + public RecipeMap getRecipeMap() { + return RecipeMaps.solarFactoryRecipes; + } + + @Override + protected MultiblockTooltipBuilder createTooltip() { + final MultiblockTooltipBuilder tt = new MultiblockTooltipBuilder(); + tt.addMachineType("Solar Factory") + .addInfo("Freaky Factory") + .beginStructureBlock(7, 10, 9, true) + .addStructureInfo(BLUE + "8+ " + DARK_AQUA + "Solid Steel Machine Casings") + .addStructureInfo(BLUE + "24 " + DARK_AQUA + "Niobium-Titanium Frame Boxes") + .addStructureInfo(BLUE + "67 " + DARK_AQUA + "EV+ Glass") + .addStructureInfo(BLUE + "4 " + DARK_AQUA + "Assembling Line Casing") + .addStructureInfo(BLUE + "1+ " + DARK_AQUA + "Input Hatch") + .addStructureInfo(BLUE + "1+ " + DARK_AQUA + "Output Bus") + .addStructureInfo(BLUE + "1+ " + DARK_AQUA + "Input Bus") + .addStructureInfo(BLUE + "1 " + DARK_AQUA + "Energy Hatch+") + .addStructureInfo(BLUE + "1 " + DARK_AQUA + "Maintenance Hatch") + .toolTipFinisher(GTValues.AuthorPureBluez); + return tt; + } + + @Override + public ITexture[] getTexture(IGregTechTileEntity aBaseMetaTileEntity, ForgeDirection side, ForgeDirection aFacing, + int colorIndex, boolean aActive, boolean redstoneLevel) { + if (side == aFacing) { + if (aActive) return new ITexture[] { casingTexturePages[0][16], TextureFactory.builder() + .addIcon(OVERLAY_FRONT_SOLAR_FACTORY_ACTIVE) + .extFacing() + .build(), + TextureFactory.builder() + .addIcon(OVERLAY_FRONT_SOLAR_FACTORY_ACTIVE_GLOW) + .extFacing() + .glow() + .build() }; + return new ITexture[] { casingTexturePages[0][16], TextureFactory.builder() + .addIcon(OVERLAY_FRONT_SOLAR_FACTORY_INACTIVE) + .extFacing() + .build(), + TextureFactory.builder() + .addIcon(OVERLAY_FRONT_SOLAR_FACTORY_INACTIVE_GLOW) + .extFacing() + .glow() + .build() }; + } + return new ITexture[] { casingTexturePages[0][16] }; + } + + @Override + public int getMaxEfficiency(ItemStack aStack) { + return 10000; + } + + @Override + public boolean isCorrectMachinePart(ItemStack aStack) { + return true; + } + + @Override + public int getDamageToComponent(ItemStack aStack) { + return 0; + } + + @Override + public boolean explodesOnComponentBreak(ItemStack aStack) { + return false; + } + + @Override + public boolean isInputSeparationEnabled() { + return true; + } + + @Override + public boolean supportsBatchMode() { + return true; + } + + @Override + public boolean supportsVoidProtection() { + return true; + } + +} diff --git a/src/main/java/gregtech/loaders/postload/MachineRecipeLoader.java b/src/main/java/gregtech/loaders/postload/MachineRecipeLoader.java index c64ea6cf7b5..30c029486c4 100644 --- a/src/main/java/gregtech/loaders/postload/MachineRecipeLoader.java +++ b/src/main/java/gregtech/loaders/postload/MachineRecipeLoader.java @@ -51,6 +51,7 @@ import gregtech.loaders.postload.recipes.SifterRecipes; import gregtech.loaders.postload.recipes.SlicerRecipes; import gregtech.loaders.postload.recipes.SmelterRecipes; +import gregtech.loaders.postload.recipes.SolarFactoryRecipes; import gregtech.loaders.postload.recipes.ThaumcraftRecipes; import gregtech.loaders.postload.recipes.ThermalCentrifugeRecipes; import gregtech.loaders.postload.recipes.TranscendentPlasmaMixerRecipes; @@ -112,6 +113,7 @@ public void run() { new SifterRecipes().run(); new SlicerRecipes().run(); new SmelterRecipes().run(); + new SolarFactoryRecipes().run(); new ThaumcraftRecipes().run(); new ThermalCentrifugeRecipes().run(); new VacuumFreezerRecipes().run(); diff --git a/src/main/java/gregtech/loaders/postload/recipes/SolarFactoryRecipes.java b/src/main/java/gregtech/loaders/postload/recipes/SolarFactoryRecipes.java new file mode 100644 index 00000000000..80b5f5403a9 --- /dev/null +++ b/src/main/java/gregtech/loaders/postload/recipes/SolarFactoryRecipes.java @@ -0,0 +1,21 @@ +package gregtech.loaders.postload.recipes; + +import static gregtech.api.recipe.RecipeMaps.solarFactoryRecipes; +import static gregtech.api.util.GTRecipeBuilder.SECONDS; + +import gregtech.api.enums.GTValues; +import gregtech.api.enums.ItemList; +import gregtech.api.enums.TierEU; + +public class SolarFactoryRecipes implements Runnable { + + public void run() { + GTValues.RA.stdBuilder() + .itemInputs(ItemList.Bottle_Beer.get(1)) + .itemOutputs(ItemList.Cover_SolarPanel_UV.get(1)) + .duration(10 * SECONDS) + .eut((int) TierEU.RECIPE_HV) + .specialValue(2) + .addTo(solarFactoryRecipes); + } +} diff --git a/src/main/java/gregtech/loaders/preload/LoaderMetaTileEntities.java b/src/main/java/gregtech/loaders/preload/LoaderMetaTileEntities.java index 37afba759b7..4913fbc7bc2 100644 --- a/src/main/java/gregtech/loaders/preload/LoaderMetaTileEntities.java +++ b/src/main/java/gregtech/loaders/preload/LoaderMetaTileEntities.java @@ -744,6 +744,7 @@ import static gregtech.api.enums.MetaTileEntityIDs.SLICING_MACHINE_UV; import static gregtech.api.enums.MetaTileEntityIDs.SLICING_MACHINE_ZPM; import static gregtech.api.enums.MetaTileEntityIDs.SMALL_COAL_BOILER; +import static gregtech.api.enums.MetaTileEntityIDs.SOLAR_FACTORY_CONTROLLER; import static gregtech.api.enums.MetaTileEntityIDs.STEAM_ALLOY_SMELTER; import static gregtech.api.enums.MetaTileEntityIDs.STEAM_COMPRESSOR; import static gregtech.api.enums.MetaTileEntityIDs.STEAM_EXTRACTOR; @@ -1075,6 +1076,7 @@ import gregtech.common.tileentities.machines.multi.MTEPlasmaForge; import gregtech.common.tileentities.machines.multi.MTEProcessingArray; import gregtech.common.tileentities.machines.multi.MTEPyrolyseOven; +import gregtech.common.tileentities.machines.multi.MTESolarFactory; import gregtech.common.tileentities.machines.multi.MTETranscendentPlasmaMixer; import gregtech.common.tileentities.machines.multi.MTEVacuumFreezer; import gregtech.common.tileentities.machines.multi.MTEWormholeGenerator; @@ -1542,6 +1544,10 @@ private static void registerMultiblockControllers() { ItemList.OilCracker.set( new MTEOilCracker(OIL_CRACKER_CONTROLLER.ID, "multimachine.cracker", "Oil Cracking Unit").getStackForm(1)); + ItemList.SolarFactory.set( + new MTESolarFactory(SOLAR_FACTORY_CONTROLLER.ID, "multimachine.solarfactory", "Solar Factory") + .getStackForm(1)); + ItemList.Machine_Multi_Assemblyline.set( new MTEAssemblyLine(ASSEMBLING_LINE_CONTROLLER.ID, "multimachine.assemblyline", "Assembling Line") .getStackForm(1L)); diff --git a/src/main/resources/assets/gregtech/lang/en_US.lang b/src/main/resources/assets/gregtech/lang/en_US.lang index 049bb66bc49..05eddb3d2b4 100644 --- a/src/main/resources/assets/gregtech/lang/en_US.lang +++ b/src/main/resources/assets/gregtech/lang/en_US.lang @@ -214,6 +214,7 @@ gt.recipe.largechemicalreactor=Large Chemical Reactor gt.recipe.distillationtower=Distillation Tower gt.recipe.craker=Oil Cracker gt.recipe.pyro=Pyrolyse Oven +gt.recipe.solarfactory=Solar Factory gt.recipe.dieselgeneratorfuel=Combustion Generator Fuels gt.recipe.extremedieselgeneratorfuel=Extreme Diesel Engine Fuel gt.recipe.gasturbinefuel=Gas Turbine Fuel @@ -576,6 +577,8 @@ GT5U.gui.text.missing_item=§7Missing required item: §b%s§f GT5U.gui.text.ph_sensor=pH threshold GT5U.gui.text.critical_ph_value=pH exceeded critical value. GT5U.gui.text.heat_sensor=Heat threshold +GT5U.gui.text.no_wafer=No wafer was found +GT5U.gui.text.low_wafer_tier=Found wafer is too low tier for the recipe GT5U.item.programmed_circuit.select.header=Reprogram Circuit GT5U.gui.config.client=Client diff --git a/src/main/resources/assets/gregtech/textures/blocks/iconsets/OVERLAY_FRONT_SOLAR_FACTORY_ACTIVE.png b/src/main/resources/assets/gregtech/textures/blocks/iconsets/OVERLAY_FRONT_SOLAR_FACTORY_ACTIVE.png new file mode 100644 index 0000000000000000000000000000000000000000..ffd43d8dc23e8320eb3205fcf1629b1d0a134b1c GIT binary patch literal 255 zcmV#0LBIRInMId82EwhG|8 zoW>Ef)*(j8Xsdu!_!9M?`2?4~-voIHO(&pa4nUu)4EQ7yfO>#)$9o|}u*L77vCM002ovPDHLk FV1i&^Y6SoQ literal 0 HcmV?d00001 diff --git a/src/main/resources/assets/gregtech/textures/blocks/iconsets/OVERLAY_FRONT_SOLAR_FACTORY_ACTIVE_GLOW.png b/src/main/resources/assets/gregtech/textures/blocks/iconsets/OVERLAY_FRONT_SOLAR_FACTORY_ACTIVE_GLOW.png new file mode 100644 index 0000000000000000000000000000000000000000..3bb29bbda660983e1c67cc3af70b987d72a8b374 GIT binary patch literal 255 zcmVz&J8-ZEgYLhjj4e93~-<1Gon?ce*#m3|9RPv|XgE zwRr$Nyms9@`%9R7@An_aQ2}xa-<0janqy>}xcO)LS5LpFhTV3o5L*BM002ovPDHLk FV1m86V?qD` literal 0 HcmV?d00001 diff --git a/src/main/resources/assets/gregtech/textures/blocks/iconsets/OVERLAY_FRONT_SOLAR_FACTORY_INACTIVE.png b/src/main/resources/assets/gregtech/textures/blocks/iconsets/OVERLAY_FRONT_SOLAR_FACTORY_INACTIVE.png new file mode 100644 index 0000000000000000000000000000000000000000..6092ec4c180d0e05ffac7183e90cdf5a5f4a9b54 GIT binary patch literal 254 zcmVa&ZnI&pC(I+7O!nE@r@G znm}tEJT9i#1Z+i%cm~}&@GGLAY@urhT$}?a&s7I}iW$H&pmV2tAw-DP@1XXUT;n*l z0rc>-u8_|DX;QBB8Mf_I0r@F>Q*#DAZ8V3t`)B%BZ=QSGx43|cvj6}907*qoM6N<$ Ef<6RhYybcN literal 0 HcmV?d00001 diff --git a/src/main/resources/assets/gregtech/textures/blocks/iconsets/OVERLAY_FRONT_SOLAR_FACTORY_INACTIVE_GLOW.png b/src/main/resources/assets/gregtech/textures/blocks/iconsets/OVERLAY_FRONT_SOLAR_FACTORY_INACTIVE_GLOW.png new file mode 100644 index 0000000000000000000000000000000000000000..b7955d63ab896c55563aac4ce30b822a23db287c GIT binary patch literal 256 zcmV+b0ssDqP)RMNv3=BGwKkZifjkXLB5w<8g#+aY9 z0yyWQ+O}ogh5^ofpN(Y!hs&M?SAbp9fGmnl3t1kJVk-bqB{>C9EQEmGdn8)~NU{J< zT?f`$j!81vB48=nBt57;!L$Qe@TzlJLe&W*IR%iPDi4^G1t2}3xzn>!if#5D Date: Tue, 15 Oct 2024 18:39:49 -0500 Subject: [PATCH 02/22] add tooltip + various fixes and changes --- .../java/gregtech/api/recipe/RecipeMaps.java | 5 +- .../api/recipe/metadata/SolarFactoryKey.java | 38 ++++++ .../gregtech/api/util/GTLanguageManager.java | 7 ++ .../machines/multi/MTESolarFactory.java | 118 ++++++++++-------- .../postload/recipes/SolarFactoryRecipes.java | 11 ++ 5 files changed, 125 insertions(+), 54 deletions(-) create mode 100644 src/main/java/gregtech/api/recipe/metadata/SolarFactoryKey.java diff --git a/src/main/java/gregtech/api/recipe/RecipeMaps.java b/src/main/java/gregtech/api/recipe/RecipeMaps.java index 95b54961175..7d296e78baf 100644 --- a/src/main/java/gregtech/api/recipe/RecipeMaps.java +++ b/src/main/java/gregtech/api/recipe/RecipeMaps.java @@ -74,6 +74,7 @@ import gregtech.api.recipe.metadata.CompressionTierKey; import gregtech.api.recipe.metadata.PCBFactoryTierKey; import gregtech.api.recipe.metadata.PurificationPlantBaseChanceKey; +import gregtech.api.recipe.metadata.SolarFactoryKey; import gregtech.api.util.GTModHandler; import gregtech.api.util.GTOreDictUnificator; import gregtech.api.util.GTRecipe; @@ -839,7 +840,9 @@ && isArrayEmptyOrNull(b.getFluidOutputs()) public static final RecipeMap solarFactoryRecipes = RecipeMapBuilder.of("gt.recipe.solarfactory") .maxIO(9, 1, 1, 0) .minInputs(1, 0) - .disableOptimize() + .neiRecipeComparator( + Comparator.comparing(recipe -> recipe.getMetadataOrDefault(SolarFactoryKey.INSTANCE, 0)) + .thenComparing(GTRecipe::compareTo)) .build(); public static final RecipeMap wiremillRecipes = RecipeMapBuilder.of("gt.recipe.wiremill") .maxIO(2, 1, 0, 0) diff --git a/src/main/java/gregtech/api/recipe/metadata/SolarFactoryKey.java b/src/main/java/gregtech/api/recipe/metadata/SolarFactoryKey.java new file mode 100644 index 00000000000..c3d45cf06ac --- /dev/null +++ b/src/main/java/gregtech/api/recipe/metadata/SolarFactoryKey.java @@ -0,0 +1,38 @@ +package gregtech.api.recipe.metadata; + +import static gregtech.api.util.GTUtility.trans; + +import javax.annotation.Nullable; +import javax.annotation.ParametersAreNonnullByDefault; + +import gregtech.api.recipe.RecipeMetadataKey; +import gregtech.api.util.MethodsReturnNonnullByDefault; +import gregtech.nei.RecipeDisplayInfo; + +/** + * Wafer tier required for Solar Factory recipes + */ +@ParametersAreNonnullByDefault +@MethodsReturnNonnullByDefault +public class SolarFactoryKey extends RecipeMetadataKey { + + public static final SolarFactoryKey INSTANCE = new SolarFactoryKey(); + + private SolarFactoryKey() { + super(Integer.class, "pcb_factory_tier"); + } + + @Override + public void drawInfo(RecipeDisplayInfo recipeInfo, @Nullable Object value) { + int tier = cast(value, 1); + switch (tier) { + case 1 -> recipeInfo.drawText(trans("510", "Minimum wafer: T1")); + case 2 -> recipeInfo.drawText(trans("511", "Minimum wafer: T2")); + case 3 -> recipeInfo.drawText(trans("512", "Minimum wafer: T3")); + case 4 -> recipeInfo.drawText(trans("513", "Minimum wafer: T4")); + case 5 -> recipeInfo.drawText(trans("514", "Minimum wafer: T5")); + case 6 -> recipeInfo.drawText(trans("515", "Minimum wafer: T6")); + case 7 -> recipeInfo.drawText(trans("516", "Minimum wafer: T7")); + } + } +} diff --git a/src/main/java/gregtech/api/util/GTLanguageManager.java b/src/main/java/gregtech/api/util/GTLanguageManager.java index 1a4c3bf0826..1706265c8a4 100644 --- a/src/main/java/gregtech/api/util/GTLanguageManager.java +++ b/src/main/java/gregtech/api/util/GTLanguageManager.java @@ -550,6 +550,13 @@ public static void writePlaceholderStrings() { addStringLocalization("Interaction_DESCRIPTION_Index_507", "Safe Mode"); addStringLocalization("Interaction_DESCRIPTION_Index_508", "Requires Stabilized Black Hole"); addStringLocalization("Interaction_DESCRIPTION_Index_509", "Requires HIP Unit"); + addStringLocalization("Interaction_DESCRIPTION_Index_510", "Minimum wafer: T1"); + addStringLocalization("Interaction_DESCRIPTION_Index_511", "Minimum wafer: T2"); + addStringLocalization("Interaction_DESCRIPTION_Index_512", "Minimum wafer: T3"); + addStringLocalization("Interaction_DESCRIPTION_Index_513", "Minimum wafer: T4"); + addStringLocalization("Interaction_DESCRIPTION_Index_514", "Minimum wafer: T5"); + addStringLocalization("Interaction_DESCRIPTION_Index_515", "Minimum wafer: T6"); + addStringLocalization("Interaction_DESCRIPTION_Index_516", "Minimum wafer: T7"); addStringLocalization("Interaction_DESCRIPTION_Index_602", "Use Private Frequency"); addStringLocalization("Interaction_DESCRIPTION_Index_756", "Connectable: "); addStringLocalization("Interaction_DESCRIPTION_Index_ALL", "All"); diff --git a/src/main/java/gregtech/common/tileentities/machines/multi/MTESolarFactory.java b/src/main/java/gregtech/common/tileentities/machines/multi/MTESolarFactory.java index 8a893a693c3..053fb0921f2 100644 --- a/src/main/java/gregtech/common/tileentities/machines/multi/MTESolarFactory.java +++ b/src/main/java/gregtech/common/tileentities/machines/multi/MTESolarFactory.java @@ -1,5 +1,6 @@ package gregtech.common.tileentities.machines.multi; +import static bartworks.util.BWTooltipReference.TT; import static com.gtnewhorizon.structurelib.structure.StructureUtility.*; import static gregtech.api.enums.HatchElement.*; import static gregtech.api.enums.Textures.BlockIcons.OVERLAY_FRONT_SOLAR_FACTORY_ACTIVE; @@ -9,9 +10,8 @@ import static gregtech.api.enums.Textures.BlockIcons.casingTexturePages; import static gregtech.api.util.GTStructureUtility.buildHatchAdder; import static gregtech.api.util.GTStructureUtility.ofFrame; -import static gregtech.api.util.GTUtility.copyAmount; -import static net.minecraft.util.EnumChatFormatting.BLUE; -import static net.minecraft.util.EnumChatFormatting.DARK_AQUA; +import static gregtech.api.util.GTUtility.copyAmountUnsafe; +import static net.minecraft.util.EnumChatFormatting.*; import javax.annotation.Nonnull; @@ -29,6 +29,7 @@ import com.gtnewhorizon.structurelib.structure.IStructureDefinition; import com.gtnewhorizon.structurelib.structure.ISurvivalBuildEnvironment; import com.gtnewhorizon.structurelib.structure.StructureDefinition; +import com.gtnewhorizon.structurelib.structure.StructureUtility; import goodgenerator.loader.Loaders; import gregtech.api.GregTechAPI; @@ -40,7 +41,7 @@ import gregtech.api.interfaces.tileentity.IGregTechTileEntity; import gregtech.api.logic.ProcessingLogic; import gregtech.api.metatileentity.GregTechTileClientEvents; -import gregtech.api.metatileentity.implementations.MTEEnhancedMultiBlockBase; +import gregtech.api.metatileentity.implementations.MTEExtendedPowerMultiBlockBase; import gregtech.api.multitileentity.multiblock.casing.Glasses; import gregtech.api.recipe.RecipeMap; import gregtech.api.recipe.RecipeMaps; @@ -52,20 +53,24 @@ import gregtech.api.util.MultiblockTooltipBuilder; import gregtech.api.util.ParallelHelper; -public class MTESolarFactory extends MTEEnhancedMultiBlockBase +// TODO: +// fix bugs if i find them +// get staffix to make sf recipes cuz she asked if she could :3 + +public class MTESolarFactory extends MTEExtendedPowerMultiBlockBase implements IConstructable, ISurvivalConstructable { protected IStructureDefinition multiDefinition = null; protected int casingAmount; protected int casingTier; ItemStack waferStack; - int outputMultiplier; + int foundWaferTier; boolean didFindStack; - private static final int PRECISE_CASING_INDEX = 1541; + int minimumWaferTierForRecipe = -1; private static final int CASING_INDEX = 16; - // Left side of the pair is a valid wafer for input, right side is lowered by the recipe's special value and then - // the recipe output (after parallels) is multiplied by it + // Left side of the pair is a valid wafer for input, right side is compared to the specialvalue to validate recipe + // and then used in the output multiplier formula public static final ImmutableList> validWafers = ImmutableList.of( Pair.of(ItemList.Circuit_Silicon_Wafer.get(1), 1), Pair.of(ItemList.Circuit_Silicon_Wafer2.get(1), 2), @@ -109,26 +114,21 @@ public IMetaTileEntity newMetaEntity(IGregTechTileEntity aTileEntity) { 'F', withChannel( "unit casing", - buildHatchAdder(MTESolarFactory.class).atLeast(InputHatch, InputBus, OutputBus, Maintenance, Energy) - .casingIndex(PRECISE_CASING_INDEX) - .dot(1) - .buildAndChain( - onElementPass( - MTESolarFactory::onCasingAdded, - ofBlocksTiered( - (block, meta) -> block == Loaders.preciseUnitCasing ? meta : -2, - // ^ if preciseUnitCasing return meta, otherwise return -2 & fail checkMachine :3 - ImmutableList.of( - Pair.of(Loaders.preciseUnitCasing, 0), - Pair.of(Loaders.preciseUnitCasing, 1), - Pair.of(Loaders.preciseUnitCasing, 2), - Pair.of(Loaders.preciseUnitCasing, 3)), - -3, - MTESolarFactory::setCasingTier, - MTESolarFactory::getCasingTier))))) + StructureUtility.ofBlocksTiered( + (block, meta) -> block == Loaders.preciseUnitCasing ? meta : -2, + // ^ if block is preciseUnitCasing return meta, otherwise return -2 & fail checkMachine + ImmutableList.of( + Pair.of(Loaders.preciseUnitCasing, 0), + Pair.of(Loaders.preciseUnitCasing, 1), + Pair.of(Loaders.preciseUnitCasing, 2), + Pair.of(Loaders.preciseUnitCasing, 3)), + -3, + MTESolarFactory::setCasingTier, + MTESolarFactory::getCasingTier))) .addElement( 'C', - buildHatchAdder(MTESolarFactory.class).atLeast(InputHatch, InputBus, OutputBus, Maintenance, Energy) + buildHatchAdder(MTESolarFactory.class) + .atLeast(InputHatch, InputBus, OutputBus, Maintenance, Energy.or(ExoticEnergy)) .casingIndex(CASING_INDEX) .dot(1) .buildAndChain(onElementPass(MTESolarFactory::onCasingAdded, ofBlock(GregTechAPI.sBlockCasings2, 0)))) @@ -154,6 +154,17 @@ public IStructureDefinition getStructureDefinition() { return STRUCTURE_DEFINITION; } + @Override + public boolean checkMachine(IGregTechTileEntity aBaseMetaTileEntity, ItemStack aStack) { + this.casingAmount = 0; + this.casingTier = -3; + if (checkPiece(STRUCTURE_PIECE_MAIN, 4, 8, 0)) { + getBaseMetaTileEntity().sendBlockEvent(GregTechTileClientEvents.CHANGE_CUSTOM_DATA, getUpdateData()); + return casingAmount >= 8 && casingTier >= -1 && mMaintenanceHatches.size() == 1; + } + return false; + } + @Override public void loadNBTData(NBTTagCompound aNBT) { casingTier = aNBT.getInteger("casingTier"); @@ -166,17 +177,6 @@ public void saveNBTData(NBTTagCompound aNBT) { super.saveNBTData(aNBT); } - @Override - public boolean checkMachine(IGregTechTileEntity aBaseMetaTileEntity, ItemStack aStack) { - this.casingAmount = 0; - this.casingTier = -3; - if (checkPiece(STRUCTURE_PIECE_MAIN, 4, 8, 0)) { - getBaseMetaTileEntity().sendBlockEvent(GregTechTileClientEvents.CHANGE_CUSTOM_DATA, getUpdateData()); - return casingAmount >= 8 && casingTier >= -1 && mMaintenanceHatches.size() == 1; - } - return false; - } - @Override public byte getUpdateData() { return (byte) casingTier; @@ -193,16 +193,15 @@ public int survivalConstruct(ItemStack stackSize, int elementBudget, ISurvivalBu return survivialBuildPiece(STRUCTURE_PIECE_MAIN, stackSize, 4, 8, 0, elementBudget, env, false, true); } - // TODO: - // calculate outputs Properly - // make tooltip :3 - // get staffix to make sf recipes cuz she asked if she could :3 + protected int getMaxParallel() { + return (int) Math.pow(2, 1 + (casingTier + 2)); + } protected ItemStack[] calculateOutput(ItemStack currentOutput, int seed) { double calculatedMultiplier = ((0.25 * seed) + 1); if (calculatedMultiplier > 2) calculatedMultiplier = 2; int outputSize = (int) Math.floor(currentOutput.stackSize * calculatedMultiplier); - return new ItemStack[] { copyAmount(outputSize, currentOutput) }; + return new ItemStack[] { copyAmountUnsafe(outputSize, currentOutput) }; } @NotNull @@ -221,11 +220,14 @@ public CheckRecipeResult checkProcessing() { mMaxProgresstime = processingLogic.getDuration(); setEnergyUsage(processingLogic); - mOutputItems = calculateOutput(processingLogic.getOutputItems()[0], outputMultiplier); + mOutputItems = calculateOutput( + processingLogic.getOutputItems()[0], + (foundWaferTier - minimumWaferTierForRecipe)); mOutputFluids = processingLogic.getOutputFluids(); waferStack = null; - outputMultiplier = 0; + foundWaferTier = 0; + minimumWaferTierForRecipe = -1; didFindStack = false; return result; @@ -245,7 +247,8 @@ public CheckRecipeResult validateRecipe(@NotNull GTRecipe recipe) { for (Pair p : validWafers) { if (items.isItemEqual(p.getLeft())) { waferStack = p.getLeft(); - outputMultiplier = (p.getRight() - recipe.mSpecialValue); + foundWaferTier = p.getRight(); + minimumWaferTierForRecipe = recipe.mSpecialValue; didFindStack = true; // items will never equal another entry in validWafers so break out of the loop break; @@ -255,7 +258,7 @@ public CheckRecipeResult validateRecipe(@NotNull GTRecipe recipe) { if (!didFindStack) { return SimpleCheckRecipeResult.ofFailure("no_wafer"); } - if (recipe.mSpecialValue > outputMultiplier) { + if (minimumWaferTierForRecipe > foundWaferTier) { return SimpleCheckRecipeResult.ofFailure("low_wafer_tier"); } return CheckRecipeResultRegistry.SUCCESSFUL; @@ -273,7 +276,7 @@ private GTRecipe recipeAfterAdjustments(@Nonnull GTRecipe recipe) { protected ParallelHelper createParallelHelper(@Nonnull GTRecipe recipe) { return super.createParallelHelper(recipeAfterAdjustments(recipe)); } - }.setMaxParallel((int) Math.pow(2, 4 + (casingTier + 1))); + }.setMaxParallelSupplier(this::getMaxParallel); } @Override @@ -285,16 +288,25 @@ public RecipeMap getRecipeMap() { protected MultiblockTooltipBuilder createTooltip() { final MultiblockTooltipBuilder tt = new MultiblockTooltipBuilder(); tt.addMachineType("Solar Factory") - .addInfo("Freaky Factory") + .addInfo("Controller block for the Solar Factory") + .addInfo("Produces solar panels in bulk") + .addInfo("Receives a 25% bonus to output for each Wafer tier above the minimum required") + .addInfo("The bonus to output occurs after parallels, and cannot be greater than 100%") + .addInfo("The recipes shown in NEI display the minimum wafer tier required") + .addInfo("Parallels are based on Precise Casing Tier") + .addInfo("MK-I = 8x, MK-II = 16x, MK-III = 32x, MK-IV = 64x") + .addInfo("Supports " + TT + " energy hatches") .beginStructureBlock(7, 10, 9, true) - .addStructureInfo(BLUE + "8+ " + DARK_AQUA + "Solid Steel Machine Casings") + .addStructureInfo(BLUE + "Imprecise Unit Casings cannot be used") + .addStructureInfo(BLUE + "26 " + DARK_AQUA + "Precise Electronic Unit Casing") + .addStructureInfo(BLUE + "120+ " + DARK_AQUA + "Solid Steel Machine Casings") .addStructureInfo(BLUE + "24 " + DARK_AQUA + "Niobium-Titanium Frame Boxes") - .addStructureInfo(BLUE + "67 " + DARK_AQUA + "EV+ Glass") + .addStructureInfo(BLUE + "67 " + DARK_AQUA + "HV+ Glass") .addStructureInfo(BLUE + "4 " + DARK_AQUA + "Assembling Line Casing") .addStructureInfo(BLUE + "1+ " + DARK_AQUA + "Input Hatch") - .addStructureInfo(BLUE + "1+ " + DARK_AQUA + "Output Bus") .addStructureInfo(BLUE + "1+ " + DARK_AQUA + "Input Bus") - .addStructureInfo(BLUE + "1 " + DARK_AQUA + "Energy Hatch+") + .addStructureInfo(BLUE + "1+ " + DARK_AQUA + "Output Bus") + .addStructureInfo(BLUE + "1+ " + DARK_AQUA + "Energy Hatch") .addStructureInfo(BLUE + "1 " + DARK_AQUA + "Maintenance Hatch") .toolTipFinisher(GTValues.AuthorPureBluez); return tt; diff --git a/src/main/java/gregtech/loaders/postload/recipes/SolarFactoryRecipes.java b/src/main/java/gregtech/loaders/postload/recipes/SolarFactoryRecipes.java index 80b5f5403a9..0d93739e1d5 100644 --- a/src/main/java/gregtech/loaders/postload/recipes/SolarFactoryRecipes.java +++ b/src/main/java/gregtech/loaders/postload/recipes/SolarFactoryRecipes.java @@ -6,6 +6,7 @@ import gregtech.api.enums.GTValues; import gregtech.api.enums.ItemList; import gregtech.api.enums.TierEU; +import gregtech.api.recipe.metadata.SolarFactoryKey; public class SolarFactoryRecipes implements Runnable { @@ -16,6 +17,16 @@ public void run() { .duration(10 * SECONDS) .eut((int) TierEU.RECIPE_HV) .specialValue(2) + .hidden() + .addTo(solarFactoryRecipes); + + GTValues.RA.stdBuilder() + .itemInputs(ItemList.Bottle_Beer.get(1), ItemList.Circuit_Silicon_Wafer2.get(1)) + .itemOutputs(ItemList.Cover_SolarPanel_UV.get(1)) + .duration(10 * SECONDS) + .eut((int) TierEU.RECIPE_HV) + .metadata(SolarFactoryKey.INSTANCE, 2) + .fake() .addTo(solarFactoryRecipes); } } From 49151f55a8bca56f36562f8f1455c08f5fa8e862 Mon Sep 17 00:00:00 2001 From: PureBluez Date: Thu, 7 Nov 2024 18:08:42 -0600 Subject: [PATCH 03/22] even MORE various fixes and changes and features --- .../api/recipe/metadata/SolarFactoryKey.java | 14 +-- .../gregtech/api/util/GTLanguageManager.java | 8 +- .../machines/multi/MTESolarFactory.java | 107 +++++++++++------- .../postload/recipes/SolarFactoryRecipes.java | 22 +++- .../resources/assets/gregtech/lang/en_US.lang | 1 + 5 files changed, 89 insertions(+), 63 deletions(-) diff --git a/src/main/java/gregtech/api/recipe/metadata/SolarFactoryKey.java b/src/main/java/gregtech/api/recipe/metadata/SolarFactoryKey.java index c3d45cf06ac..be8e328b70f 100644 --- a/src/main/java/gregtech/api/recipe/metadata/SolarFactoryKey.java +++ b/src/main/java/gregtech/api/recipe/metadata/SolarFactoryKey.java @@ -19,20 +19,14 @@ public class SolarFactoryKey extends RecipeMetadataKey { public static final SolarFactoryKey INSTANCE = new SolarFactoryKey(); private SolarFactoryKey() { - super(Integer.class, "pcb_factory_tier"); + super(Integer.class, "solar_factory_wafer_tier"); } @Override public void drawInfo(RecipeDisplayInfo recipeInfo, @Nullable Object value) { - int tier = cast(value, 1); - switch (tier) { - case 1 -> recipeInfo.drawText(trans("510", "Minimum wafer: T1")); - case 2 -> recipeInfo.drawText(trans("511", "Minimum wafer: T2")); - case 3 -> recipeInfo.drawText(trans("512", "Minimum wafer: T3")); - case 4 -> recipeInfo.drawText(trans("513", "Minimum wafer: T4")); - case 5 -> recipeInfo.drawText(trans("514", "Minimum wafer: T5")); - case 6 -> recipeInfo.drawText(trans("515", "Minimum wafer: T6")); - case 7 -> recipeInfo.drawText(trans("516", "Minimum wafer: T7")); + int tier = cast(value, 0); + if (tier > 0) { + recipeInfo.drawText(trans("510", "Minimum wafer tier: ") + tier); } } } diff --git a/src/main/java/gregtech/api/util/GTLanguageManager.java b/src/main/java/gregtech/api/util/GTLanguageManager.java index 1706265c8a4..5c0b9a97323 100644 --- a/src/main/java/gregtech/api/util/GTLanguageManager.java +++ b/src/main/java/gregtech/api/util/GTLanguageManager.java @@ -550,13 +550,7 @@ public static void writePlaceholderStrings() { addStringLocalization("Interaction_DESCRIPTION_Index_507", "Safe Mode"); addStringLocalization("Interaction_DESCRIPTION_Index_508", "Requires Stabilized Black Hole"); addStringLocalization("Interaction_DESCRIPTION_Index_509", "Requires HIP Unit"); - addStringLocalization("Interaction_DESCRIPTION_Index_510", "Minimum wafer: T1"); - addStringLocalization("Interaction_DESCRIPTION_Index_511", "Minimum wafer: T2"); - addStringLocalization("Interaction_DESCRIPTION_Index_512", "Minimum wafer: T3"); - addStringLocalization("Interaction_DESCRIPTION_Index_513", "Minimum wafer: T4"); - addStringLocalization("Interaction_DESCRIPTION_Index_514", "Minimum wafer: T5"); - addStringLocalization("Interaction_DESCRIPTION_Index_515", "Minimum wafer: T6"); - addStringLocalization("Interaction_DESCRIPTION_Index_516", "Minimum wafer: T7"); + addStringLocalization("Interaction_DESCRIPTION_Index_510", "Minimum wafer tier: "); addStringLocalization("Interaction_DESCRIPTION_Index_602", "Use Private Frequency"); addStringLocalization("Interaction_DESCRIPTION_Index_756", "Connectable: "); addStringLocalization("Interaction_DESCRIPTION_Index_ALL", "All"); diff --git a/src/main/java/gregtech/common/tileentities/machines/multi/MTESolarFactory.java b/src/main/java/gregtech/common/tileentities/machines/multi/MTESolarFactory.java index 053fb0921f2..f15d808022e 100644 --- a/src/main/java/gregtech/common/tileentities/machines/multi/MTESolarFactory.java +++ b/src/main/java/gregtech/common/tileentities/machines/multi/MTESolarFactory.java @@ -10,9 +10,12 @@ import static gregtech.api.enums.Textures.BlockIcons.casingTexturePages; import static gregtech.api.util.GTStructureUtility.buildHatchAdder; import static gregtech.api.util.GTStructureUtility.ofFrame; +import static gregtech.api.util.GTUtility.copyAmount; import static gregtech.api.util.GTUtility.copyAmountUnsafe; import static net.minecraft.util.EnumChatFormatting.*; +import java.util.List; + import javax.annotation.Nonnull; import net.minecraft.item.ItemStack; @@ -48,6 +51,7 @@ import gregtech.api.recipe.check.CheckRecipeResult; import gregtech.api.recipe.check.CheckRecipeResultRegistry; import gregtech.api.recipe.check.SimpleCheckRecipeResult; +import gregtech.api.recipe.metadata.SolarFactoryKey; import gregtech.api.render.TextureFactory; import gregtech.api.util.GTRecipe; import gregtech.api.util.MultiblockTooltipBuilder; @@ -61,17 +65,28 @@ public class MTESolarFactory extends MTEExtendedPowerMultiBlockBase multiDefinition = null; - protected int casingAmount; - protected int casingTier; - ItemStack waferStack; - int foundWaferTier; - boolean didFindStack; - int minimumWaferTierForRecipe = -1; private static final int CASING_INDEX = 16; + int casingAmount; + int casingTier; + + int outputMultiplierCap = 2; + double outputMultiplierSlope = 0.25; + + ItemStack foundWaferStack; + int waferAmountInRecipe; + int foundWaferTier; + int minimumTierForRecipe; + + private void clearVars() { + foundWaferStack = null; + waferAmountInRecipe = 0; + foundWaferTier = 0; + minimumTierForRecipe = 0; + } // Left side of the pair is a valid wafer for input, right side is compared to the specialvalue to validate recipe // and then used in the output multiplier formula - public static final ImmutableList> validWafers = ImmutableList.of( + public static ImmutableList> validWafers = ImmutableList.of( Pair.of(ItemList.Circuit_Silicon_Wafer.get(1), 1), Pair.of(ItemList.Circuit_Silicon_Wafer2.get(1), 2), Pair.of(ItemList.Circuit_Silicon_Wafer3.get(1), 3), @@ -193,17 +208,27 @@ public int survivalConstruct(ItemStack stackSize, int elementBudget, ISurvivalBu return survivialBuildPiece(STRUCTURE_PIECE_MAIN, stackSize, 4, 8, 0, elementBudget, env, false, true); } - protected int getMaxParallel() { - return (int) Math.pow(2, 1 + (casingTier + 2)); - } - - protected ItemStack[] calculateOutput(ItemStack currentOutput, int seed) { - double calculatedMultiplier = ((0.25 * seed) + 1); - if (calculatedMultiplier > 2) calculatedMultiplier = 2; + protected ItemStack[] calculateNewOutput(ItemStack currentOutput, int seed) { + double calculatedMultiplier = ((outputMultiplierSlope * seed) + 1) > outputMultiplierCap ? outputMultiplierCap + : ((outputMultiplierSlope * seed) + 1); int outputSize = (int) Math.floor(currentOutput.stackSize * calculatedMultiplier); return new ItemStack[] { copyAmountUnsafe(outputSize, currentOutput) }; } + // Looks through the inputs and overrides our variables if wafers are found. This is called in validateRecipe. + protected void findWafer(GTRecipe recipe, List> waferList) { + for (ItemStack items : getStoredInputs()) { + for (Pair pair : waferList) { + if (items.isItemEqual(pair.getLeft())) { + foundWaferStack = items; + foundWaferTier = pair.getRight(); + waferAmountInRecipe = recipe.mSpecialValue; + break; + } + } + } + } + @NotNull @Override public CheckRecipeResult checkProcessing() { @@ -220,15 +245,15 @@ public CheckRecipeResult checkProcessing() { mMaxProgresstime = processingLogic.getDuration(); setEnergyUsage(processingLogic); - mOutputItems = calculateOutput( - processingLogic.getOutputItems()[0], - (foundWaferTier - minimumWaferTierForRecipe)); + if (minimumTierForRecipe != 0) { + mOutputItems = calculateNewOutput( + processingLogic.getOutputItems()[0], + (foundWaferTier - minimumTierForRecipe)); + } else mOutputItems = processingLogic.getOutputItems(); + mOutputFluids = processingLogic.getOutputFluids(); - waferStack = null; - foundWaferTier = 0; - minimumWaferTierForRecipe = -1; - didFindStack = false; + clearVars(); return result; } @@ -237,37 +262,30 @@ public CheckRecipeResult checkProcessing() { protected ProcessingLogic createProcessingLogic() { return new ProcessingLogic() { - // validateRecipe is called before createParallelHelper or checkProcessing so checking for wafers and - // overriding the variables will go there @NotNull @Override public CheckRecipeResult validateRecipe(@NotNull GTRecipe recipe) { - for (ItemStack items : getStoredInputs()) { - // iterate over the validWafers List - for (Pair p : validWafers) { - if (items.isItemEqual(p.getLeft())) { - waferStack = p.getLeft(); - foundWaferTier = p.getRight(); - minimumWaferTierForRecipe = recipe.mSpecialValue; - didFindStack = true; - // items will never equal another entry in validWafers so break out of the loop - break; - } - } - } - if (!didFindStack) { + // No metadata means no wafers used in the recipe, so return successful since this method is called only + // when input matching is already successful. + minimumTierForRecipe = recipe.getMetadataOrDefault(SolarFactoryKey.INSTANCE, 0); + if (minimumTierForRecipe == 0) return CheckRecipeResultRegistry.SUCCESSFUL; + findWafer(recipe, validWafers); + if (foundWaferStack == null) { return SimpleCheckRecipeResult.ofFailure("no_wafer"); } - if (minimumWaferTierForRecipe > foundWaferTier) { + if (minimumTierForRecipe > foundWaferTier) { return SimpleCheckRecipeResult.ofFailure("low_wafer_tier"); } + if (waferAmountInRecipe > foundWaferStack.stackSize) { + return SimpleCheckRecipeResult.ofFailure("not_enough_wafer"); + } return CheckRecipeResultRegistry.SUCCESSFUL; } @Nonnull private GTRecipe recipeAfterAdjustments(@Nonnull GTRecipe recipe) { GTRecipe tRecipe = recipe.copy(); - tRecipe.mInputs = ArrayUtils.add(tRecipe.mInputs, waferStack); + tRecipe.mInputs = ArrayUtils.add(tRecipe.mInputs, copyAmount(waferAmountInRecipe, foundWaferStack)); return tRecipe; } @@ -279,6 +297,11 @@ protected ParallelHelper createParallelHelper(@Nonnull GTRecipe recipe) { }.setMaxParallelSupplier(this::getMaxParallel); } + // 2^(casingTier + 3) + protected int getMaxParallel() { + return (int) Math.pow(2, 1 + (casingTier + 2)); + } + @Override public RecipeMap getRecipeMap() { return RecipeMaps.solarFactoryRecipes; @@ -296,6 +319,7 @@ protected MultiblockTooltipBuilder createTooltip() { .addInfo("Parallels are based on Precise Casing Tier") .addInfo("MK-I = 8x, MK-II = 16x, MK-III = 32x, MK-IV = 64x") .addInfo("Supports " + TT + " energy hatches") + .addSeparator() .beginStructureBlock(7, 10, 9, true) .addStructureInfo(BLUE + "Imprecise Unit Casings cannot be used") .addStructureInfo(BLUE + "26 " + DARK_AQUA + "Precise Electronic Unit Casing") @@ -358,11 +382,6 @@ public boolean explodesOnComponentBreak(ItemStack aStack) { return false; } - @Override - public boolean isInputSeparationEnabled() { - return true; - } - @Override public boolean supportsBatchMode() { return true; diff --git a/src/main/java/gregtech/loaders/postload/recipes/SolarFactoryRecipes.java b/src/main/java/gregtech/loaders/postload/recipes/SolarFactoryRecipes.java index 0d93739e1d5..a2ccb18ea30 100644 --- a/src/main/java/gregtech/loaders/postload/recipes/SolarFactoryRecipes.java +++ b/src/main/java/gregtech/loaders/postload/recipes/SolarFactoryRecipes.java @@ -8,6 +8,14 @@ import gregtech.api.enums.TierEU; import gregtech.api.recipe.metadata.SolarFactoryKey; +// If you want to make a new recipe for Solar Factory, you'll need to make a hidden one and a fake one. This is so we +// can display the minimum wafer in NEI without having problems with the Solar Factory processing logic. + +// Recipe specialValue should correspond to the stack size of the wafer input. +// Recipe metadata serves dual purpose, in the fake recipes it displays the minimum tier in NEI, and in the hidden +// recipes it gives the multi the minimum wafer tier for processing logic. + +// If the recipe you are making doesn't use a wafer, just make it like a normal recipe and put down a metadata of 0. public class SolarFactoryRecipes implements Runnable { public void run() { @@ -17,16 +25,26 @@ public void run() { .duration(10 * SECONDS) .eut((int) TierEU.RECIPE_HV) .specialValue(2) + .metadata(SolarFactoryKey.INSTANCE, 3) .hidden() .addTo(solarFactoryRecipes); GTValues.RA.stdBuilder() - .itemInputs(ItemList.Bottle_Beer.get(1), ItemList.Circuit_Silicon_Wafer2.get(1)) + .itemInputs(ItemList.Bottle_Beer.get(1), ItemList.Circuit_Silicon_Wafer3.get(2)) .itemOutputs(ItemList.Cover_SolarPanel_UV.get(1)) .duration(10 * SECONDS) .eut((int) TierEU.RECIPE_HV) - .metadata(SolarFactoryKey.INSTANCE, 2) .fake() + .metadata(SolarFactoryKey.INSTANCE, 3) + .addTo(solarFactoryRecipes); + + // Test case for a recipe that doesn't use a wafer. + GTValues.RA.stdBuilder() + .itemInputs(ItemList.Bottle_Cider.get(2)) + .itemOutputs(ItemList.Cover_SolarPanel_LuV.get(1)) + .duration(10 * SECONDS) + .eut((int) TierEU.RECIPE_HV) + .metadata(SolarFactoryKey.INSTANCE, 0) .addTo(solarFactoryRecipes); } } diff --git a/src/main/resources/assets/gregtech/lang/en_US.lang b/src/main/resources/assets/gregtech/lang/en_US.lang index 05eddb3d2b4..e778fa28984 100644 --- a/src/main/resources/assets/gregtech/lang/en_US.lang +++ b/src/main/resources/assets/gregtech/lang/en_US.lang @@ -579,6 +579,7 @@ GT5U.gui.text.critical_ph_value=pH exceeded critical value. GT5U.gui.text.heat_sensor=Heat threshold GT5U.gui.text.no_wafer=No wafer was found GT5U.gui.text.low_wafer_tier=Found wafer is too low tier for the recipe +GT5U.gui.text.not_enough_wafer=Found wafer but recipe requires more than given GT5U.item.programmed_circuit.select.header=Reprogram Circuit GT5U.gui.config.client=Client From 33eb644805c8af521240de379c189fa13ea7ecd4 Mon Sep 17 00:00:00 2001 From: PureBluez Date: Fri, 22 Nov 2024 23:19:59 -0600 Subject: [PATCH 04/22] add input sep support + make actual recipes + redo metadata --- .../java/gregtech/api/recipe/RecipeMaps.java | 4 - .../api/recipe/metadata/SolarFactoryKey.java | 32 -- .../gregtech/api/util/GTRecipeConstants.java | 7 + .../util/recipe/SolarFactoryRecipeData.java | 20 ++ .../machines/multi/MTESolarFactory.java | 56 ++-- .../postload/recipes/SolarFactoryRecipes.java | 277 ++++++++++++++++-- 6 files changed, 316 insertions(+), 80 deletions(-) delete mode 100644 src/main/java/gregtech/api/recipe/metadata/SolarFactoryKey.java create mode 100644 src/main/java/gregtech/api/util/recipe/SolarFactoryRecipeData.java diff --git a/src/main/java/gregtech/api/recipe/RecipeMaps.java b/src/main/java/gregtech/api/recipe/RecipeMaps.java index 7d296e78baf..0d337622a3a 100644 --- a/src/main/java/gregtech/api/recipe/RecipeMaps.java +++ b/src/main/java/gregtech/api/recipe/RecipeMaps.java @@ -74,7 +74,6 @@ import gregtech.api.recipe.metadata.CompressionTierKey; import gregtech.api.recipe.metadata.PCBFactoryTierKey; import gregtech.api.recipe.metadata.PurificationPlantBaseChanceKey; -import gregtech.api.recipe.metadata.SolarFactoryKey; import gregtech.api.util.GTModHandler; import gregtech.api.util.GTOreDictUnificator; import gregtech.api.util.GTRecipe; @@ -840,9 +839,6 @@ && isArrayEmptyOrNull(b.getFluidOutputs()) public static final RecipeMap solarFactoryRecipes = RecipeMapBuilder.of("gt.recipe.solarfactory") .maxIO(9, 1, 1, 0) .minInputs(1, 0) - .neiRecipeComparator( - Comparator.comparing(recipe -> recipe.getMetadataOrDefault(SolarFactoryKey.INSTANCE, 0)) - .thenComparing(GTRecipe::compareTo)) .build(); public static final RecipeMap wiremillRecipes = RecipeMapBuilder.of("gt.recipe.wiremill") .maxIO(2, 1, 0, 0) diff --git a/src/main/java/gregtech/api/recipe/metadata/SolarFactoryKey.java b/src/main/java/gregtech/api/recipe/metadata/SolarFactoryKey.java deleted file mode 100644 index be8e328b70f..00000000000 --- a/src/main/java/gregtech/api/recipe/metadata/SolarFactoryKey.java +++ /dev/null @@ -1,32 +0,0 @@ -package gregtech.api.recipe.metadata; - -import static gregtech.api.util.GTUtility.trans; - -import javax.annotation.Nullable; -import javax.annotation.ParametersAreNonnullByDefault; - -import gregtech.api.recipe.RecipeMetadataKey; -import gregtech.api.util.MethodsReturnNonnullByDefault; -import gregtech.nei.RecipeDisplayInfo; - -/** - * Wafer tier required for Solar Factory recipes - */ -@ParametersAreNonnullByDefault -@MethodsReturnNonnullByDefault -public class SolarFactoryKey extends RecipeMetadataKey { - - public static final SolarFactoryKey INSTANCE = new SolarFactoryKey(); - - private SolarFactoryKey() { - super(Integer.class, "solar_factory_wafer_tier"); - } - - @Override - public void drawInfo(RecipeDisplayInfo recipeInfo, @Nullable Object value) { - int tier = cast(value, 0); - if (tier > 0) { - recipeInfo.drawText(trans("510", "Minimum wafer tier: ") + tier); - } - } -} diff --git a/src/main/java/gregtech/api/util/GTRecipeConstants.java b/src/main/java/gregtech/api/util/GTRecipeConstants.java index dfaaff87139..76ab66e842d 100644 --- a/src/main/java/gregtech/api/util/GTRecipeConstants.java +++ b/src/main/java/gregtech/api/util/GTRecipeConstants.java @@ -26,6 +26,7 @@ import gregtech.api.recipe.RecipeMaps; import gregtech.api.recipe.RecipeMetadataKey; import gregtech.api.recipe.metadata.SimpleRecipeMetadataKey; +import gregtech.api.util.recipe.SolarFactoryRecipeData; import gregtech.common.items.IDMetaItem03; import gregtech.common.items.MetaGeneratedItem03; import gtnhlanth.common.item.ItemPhotolithographicMask; @@ -106,6 +107,12 @@ public class GTRecipeConstants { */ public static final RecipeMetadataKey ON_FIRE = SimpleRecipeMetadataKey.create(Boolean.class, "on_fire"); + /** + * Solar Factory recipe data containing minimum wafer tier and count + */ + public static final RecipeMetadataKey SF_DATA = SimpleRecipeMetadataKey + .create(SolarFactoryRecipeData.class, "solar_factory_wafer_tier"); + /** * Nano Forge Tier. */ diff --git a/src/main/java/gregtech/api/util/recipe/SolarFactoryRecipeData.java b/src/main/java/gregtech/api/util/recipe/SolarFactoryRecipeData.java new file mode 100644 index 00000000000..38db6253272 --- /dev/null +++ b/src/main/java/gregtech/api/util/recipe/SolarFactoryRecipeData.java @@ -0,0 +1,20 @@ +package gregtech.api.util.recipe; + +public class SolarFactoryRecipeData { + + public final int minimumWaferTier; + public final int minimumWaferCount; + + public SolarFactoryRecipeData(int minimumWaferTier, int minimumWaferCount) { + this.minimumWaferTier = minimumWaferTier; + this.minimumWaferCount = minimumWaferCount; + } + + public int getMinimumWaferTier() { + return minimumWaferTier; + } + + public int getMinimumWaferCount() { + return minimumWaferCount; + } +} diff --git a/src/main/java/gregtech/common/tileentities/machines/multi/MTESolarFactory.java b/src/main/java/gregtech/common/tileentities/machines/multi/MTESolarFactory.java index f15d808022e..a085f1ebd5c 100644 --- a/src/main/java/gregtech/common/tileentities/machines/multi/MTESolarFactory.java +++ b/src/main/java/gregtech/common/tileentities/machines/multi/MTESolarFactory.java @@ -8,11 +8,13 @@ import static gregtech.api.enums.Textures.BlockIcons.OVERLAY_FRONT_SOLAR_FACTORY_INACTIVE; import static gregtech.api.enums.Textures.BlockIcons.OVERLAY_FRONT_SOLAR_FACTORY_INACTIVE_GLOW; import static gregtech.api.enums.Textures.BlockIcons.casingTexturePages; +import static gregtech.api.util.GTRecipeConstants.SF_DATA; import static gregtech.api.util.GTStructureUtility.buildHatchAdder; import static gregtech.api.util.GTStructureUtility.ofFrame; import static gregtech.api.util.GTUtility.copyAmount; import static gregtech.api.util.GTUtility.copyAmountUnsafe; -import static net.minecraft.util.EnumChatFormatting.*; +import static net.minecraft.util.EnumChatFormatting.BLUE; +import static net.minecraft.util.EnumChatFormatting.DARK_AQUA; import java.util.List; @@ -51,15 +53,14 @@ import gregtech.api.recipe.check.CheckRecipeResult; import gregtech.api.recipe.check.CheckRecipeResultRegistry; import gregtech.api.recipe.check.SimpleCheckRecipeResult; -import gregtech.api.recipe.metadata.SolarFactoryKey; import gregtech.api.render.TextureFactory; import gregtech.api.util.GTRecipe; import gregtech.api.util.MultiblockTooltipBuilder; import gregtech.api.util.ParallelHelper; +import gregtech.api.util.recipe.SolarFactoryRecipeData; -// TODO: -// fix bugs if i find them -// get staffix to make sf recipes cuz she asked if she could :3 +// TODO: fix bugs if i find them +// TODO: Bug: Freaky stocking bus public class MTESolarFactory extends MTEExtendedPowerMultiBlockBase implements IConstructable, ISurvivalConstructable { @@ -84,8 +85,7 @@ private void clearVars() { minimumTierForRecipe = 0; } - // Left side of the pair is a valid wafer for input, right side is compared to the specialvalue to validate recipe - // and then used in the output multiplier formula + // Left side represents the wafers to look for, right side represents their tier. public static ImmutableList> validWafers = ImmutableList.of( Pair.of(ItemList.Circuit_Silicon_Wafer.get(1), 1), Pair.of(ItemList.Circuit_Silicon_Wafer2.get(1), 2), @@ -215,20 +215,6 @@ protected ItemStack[] calculateNewOutput(ItemStack currentOutput, int seed) { return new ItemStack[] { copyAmountUnsafe(outputSize, currentOutput) }; } - // Looks through the inputs and overrides our variables if wafers are found. This is called in validateRecipe. - protected void findWafer(GTRecipe recipe, List> waferList) { - for (ItemStack items : getStoredInputs()) { - for (Pair pair : waferList) { - if (items.isItemEqual(pair.getLeft())) { - foundWaferStack = items; - foundWaferTier = pair.getRight(); - waferAmountInRecipe = recipe.mSpecialValue; - break; - } - } - } - } - @NotNull @Override public CheckRecipeResult checkProcessing() { @@ -262,14 +248,34 @@ public CheckRecipeResult checkProcessing() { protected ProcessingLogic createProcessingLogic() { return new ProcessingLogic() { + private void findWafer(List> waferList) { + ItemStack[] items; + if (isInputSeparationEnabled()) { + items = inputItems; + } else items = getStoredInputs().toArray(new ItemStack[0]); + + for (ItemStack stored : items) { + for (Pair pair : waferList) { + if (stored.isItemEqual(pair.getLeft())) { + foundWaferStack = stored; + foundWaferTier = pair.getRight(); + break; + } + } + } + } + @NotNull @Override public CheckRecipeResult validateRecipe(@NotNull GTRecipe recipe) { // No metadata means no wafers used in the recipe, so return successful since this method is called only // when input matching is already successful. - minimumTierForRecipe = recipe.getMetadataOrDefault(SolarFactoryKey.INSTANCE, 0); + minimumTierForRecipe = recipe.getMetadataOrDefault(SF_DATA, new SolarFactoryRecipeData(0, 0)) + .getMinimumWaferTier(); + waferAmountInRecipe = recipe.getMetadataOrDefault(SF_DATA, new SolarFactoryRecipeData(0, 0)) + .getMinimumWaferCount(); if (minimumTierForRecipe == 0) return CheckRecipeResultRegistry.SUCCESSFUL; - findWafer(recipe, validWafers); + findWafer(validWafers); if (foundWaferStack == null) { return SimpleCheckRecipeResult.ofFailure("no_wafer"); } @@ -392,4 +398,8 @@ public boolean supportsVoidProtection() { return true; } + @Override + public boolean supportsInputSeparation() { + return true; + } } diff --git a/src/main/java/gregtech/loaders/postload/recipes/SolarFactoryRecipes.java b/src/main/java/gregtech/loaders/postload/recipes/SolarFactoryRecipes.java index a2ccb18ea30..9ea839521a7 100644 --- a/src/main/java/gregtech/loaders/postload/recipes/SolarFactoryRecipes.java +++ b/src/main/java/gregtech/loaders/postload/recipes/SolarFactoryRecipes.java @@ -1,50 +1,285 @@ package gregtech.loaders.postload.recipes; +import static gregtech.api.enums.Mods.NewHorizonsCoreMod; +import static gregtech.api.enums.Mods.SuperSolarPanels; import static gregtech.api.recipe.RecipeMaps.solarFactoryRecipes; +import static gregtech.api.util.GTModHandler.getModItem; import static gregtech.api.util.GTRecipeBuilder.SECONDS; +import static gregtech.api.util.GTRecipeConstants.SF_DATA; + +import net.minecraftforge.fluids.Fluid; +import net.minecraftforge.fluids.FluidRegistry; +import net.minecraftforge.fluids.FluidStack; import gregtech.api.enums.GTValues; import gregtech.api.enums.ItemList; +import gregtech.api.enums.Materials; +import gregtech.api.enums.OrePrefixes; import gregtech.api.enums.TierEU; -import gregtech.api.recipe.metadata.SolarFactoryKey; +import gregtech.api.util.GTOreDictUnificator; +import gregtech.api.util.recipe.SolarFactoryRecipeData; -// If you want to make a new recipe for Solar Factory, you'll need to make a hidden one and a fake one. This is so we -// can display the minimum wafer in NEI without having problems with the Solar Factory processing logic. +// If you want to make a new recipe for Solar Factory, you'll need to make a hidden one and a fake one. +// The fake one should include the wafer you use, the hidden one without it. Hidden recipes must have a metadata value. -// Recipe specialValue should correspond to the stack size of the wafer input. -// Recipe metadata serves dual purpose, in the fake recipes it displays the minimum tier in NEI, and in the hidden -// recipes it gives the multi the minimum wafer tier for processing logic. +// Recipe metadata values represent the minimum tier and the amount of wafers respectively. +// Metadata is only required on the hidden recipes. -// If the recipe you are making doesn't use a wafer, just make it like a normal recipe and put down a metadata of 0. +// If the recipe you are making doesn't use a wafer, just make it like a normal recipe, no metadata needed public class SolarFactoryRecipes implements Runnable { + private final Fluid solderIndalloy; + + public SolarFactoryRecipes() { + solderIndalloy = FluidRegistry.getFluid("molten.indalloy140"); + } + public void run() { + + // Fake recipes for NEI GTValues.RA.stdBuilder() - .itemInputs(ItemList.Bottle_Beer.get(1)) - .itemOutputs(ItemList.Cover_SolarPanel_UV.get(1)) + .itemInputs( + getModItem(NewHorizonsCoreMod.ID, "item.IrradiantReinforcedAluminiumPlate", 2), + ItemList.Circuit_Silicon_Wafer2.get(4), + GTOreDictUnificator.get(OrePrefixes.wireGt01, Materials.SuperconductorMV, 4), + GTOreDictUnificator.get(OrePrefixes.circuit.get(Materials.HV), 2)) + .itemOutputs(ItemList.Cover_SolarPanel_LV.get(1)) + .fluidInputs(Materials.Polytetrafluoroethylene.getMolten(288)) .duration(10 * SECONDS) - .eut((int) TierEU.RECIPE_HV) - .specialValue(2) - .metadata(SolarFactoryKey.INSTANCE, 3) - .hidden() + .eut(TierEU.RECIPE_HV) + .fake() .addTo(solarFactoryRecipes); GTValues.RA.stdBuilder() - .itemInputs(ItemList.Bottle_Beer.get(1), ItemList.Circuit_Silicon_Wafer3.get(2)) - .itemOutputs(ItemList.Cover_SolarPanel_UV.get(1)) + .itemInputs( + getModItem(NewHorizonsCoreMod.ID, "item.IrradiantReinforcedTitaniumPlate", 2), + ItemList.Circuit_Silicon_Wafer2.get(4), + ItemList.Circuit_Chip_ULPIC.get(4), + GTOreDictUnificator.get(OrePrefixes.wireGt01, Materials.SuperconductorHV, 4), + GTOreDictUnificator.get(OrePrefixes.circuit.get(Materials.EV), 2)) + .itemOutputs(ItemList.Cover_SolarPanel_MV.get(1)) + .fluidInputs(Materials.Epoxid.getMolten(576)) + .duration(10 * SECONDS) + .eut(TierEU.RECIPE_EV) + .fake() + .addTo(solarFactoryRecipes); + + GTValues.RA.stdBuilder() + .itemInputs( + getModItem(NewHorizonsCoreMod.ID, "item.IrradiantReinforcedTungstenPlate", 4), + ItemList.Circuit_Silicon_Wafer2.get(4), + ItemList.Circuit_Chip_LPIC.get(4), + GTOreDictUnificator.get(OrePrefixes.wireGt01, Materials.SuperconductorEV, 8), + GTOreDictUnificator.get(OrePrefixes.circuit.get(Materials.IV), 4), + GTOreDictUnificator.get(OrePrefixes.plate.get(Materials.IndiumGalliumPhosphide), 8)) + .itemOutputs(ItemList.Cover_SolarPanel_HV.get(1)) + .duration(10 * SECONDS) + .eut(TierEU.RECIPE_IV) + .fake() + .addTo(solarFactoryRecipes); + + GTValues.RA.stdBuilder() + .itemInputs( + getModItem(NewHorizonsCoreMod.ID, "item.IrradiantReinforcedTungstenPlate", 4), + ItemList.Circuit_Silicon_Wafer3.get(4), + ItemList.Circuit_Chip_PIC.get(4), + GTOreDictUnificator.get(OrePrefixes.wireGt01, Materials.SuperconductorIV, 8), + GTOreDictUnificator.get(OrePrefixes.circuit.get(Materials.LuV), 4), + GTOreDictUnificator.get(OrePrefixes.plate.get(Materials.SiliconSG), 16)) + .itemOutputs(ItemList.Cover_SolarPanel_EV.get(1)) + .fluidInputs(Materials.Polybenzimidazole.getMolten(576)) .duration(10 * SECONDS) - .eut((int) TierEU.RECIPE_HV) + .eut(TierEU.RECIPE_LuV) .fake() - .metadata(SolarFactoryKey.INSTANCE, 3) .addTo(solarFactoryRecipes); - // Test case for a recipe that doesn't use a wafer. GTValues.RA.stdBuilder() - .itemInputs(ItemList.Bottle_Cider.get(2)) + .itemInputs( + getModItem(NewHorizonsCoreMod.ID, "item.IrradiantReinforcedChromePlate", 4), + ItemList.Circuit_Silicon_Wafer3.get(8), + ItemList.Circuit_Chip_HPIC.get(4), + GTOreDictUnificator.get(OrePrefixes.wireGt01, Materials.SuperconductorLuV, 10), + GTOreDictUnificator.get(OrePrefixes.circuit.get(Materials.ZPM), 4), + GTOreDictUnificator.get(OrePrefixes.block.get(Materials.SiliconSG), 4)) + .itemOutputs(ItemList.Cover_SolarPanel_IV.get(1)) + .fluidInputs(Materials.Polybenzimidazole.getMolten(1152)) + .duration(10 * SECONDS) + .eut(TierEU.RECIPE_ZPM) + .fake() + .addTo(solarFactoryRecipes); + + GTValues.RA.stdBuilder() + .itemInputs( + getModItem(NewHorizonsCoreMod.ID, "item.IrradiantReinforcedChromePlate", 4), + ItemList.Circuit_Silicon_Wafer4.get(8), + ItemList.Circuit_Chip_UHPIC.get(8), + GTOreDictUnificator.get(OrePrefixes.wireGt01, Materials.SuperconductorZPM, 24), + GTOreDictUnificator.get(OrePrefixes.circuit.get(Materials.UV), 2), + GTOreDictUnificator.get(OrePrefixes.circuit.get(Materials.ZPM), 6), + GTOreDictUnificator.get(OrePrefixes.block.get(Materials.SiliconSG), 8), + getModItem(SuperSolarPanels.ID, "solarsplitter", 4, 0)) .itemOutputs(ItemList.Cover_SolarPanel_LuV.get(1)) + .fluidInputs(Materials.Polybenzimidazole.getMolten(1728)) + .duration(1 * SECONDS) + .eut(TierEU.RECIPE_UV) + .fake() + .addTo(solarFactoryRecipes); + + GTValues.RA.stdBuilder() + .itemInputs( + getModItem(NewHorizonsCoreMod.ID, "item.IrradiantReinforcedNaquadriaPlate", 8), + ItemList.Circuit_Silicon_Wafer5.get(8), + ItemList.Circuit_Wafer_QPIC.get(4), + ItemList.Circuit_Chip_NPIC.get(8), + GTOreDictUnificator.get(OrePrefixes.wireGt01, Materials.SuperconductorUV, 32), + GTOreDictUnificator.get(OrePrefixes.circuit.get(Materials.UHV), 2), + GTOreDictUnificator.get(OrePrefixes.circuit.get(Materials.UV), 4)) + .itemOutputs(ItemList.Cover_SolarPanel_ZPM.get(1)) + .fluidInputs(Materials.Polybenzimidazole.getMolten(2304)) + .duration(1 * SECONDS) + .eut(TierEU.RECIPE_UHV) + .fake() + .addTo(solarFactoryRecipes); + + GTValues.RA.stdBuilder() + .itemInputs( + getModItem(NewHorizonsCoreMod.ID, "item.IrradiantReinforcedNaquadriaPlate", 8), + ItemList.Circuit_Silicon_Wafer5.get(8), + getModItem(NewHorizonsCoreMod.ID, "item.PicoWafer", 8), + ItemList.Circuit_Chip_PPIC.get(8), + ItemList.Circuit_Chip_CrystalSoC2.get(8), + GTOreDictUnificator.get(OrePrefixes.wireGt04, Materials.SuperconductorUHV, 12), + GTOreDictUnificator.get(OrePrefixes.circuit.get(Materials.UEV), 2), + GTOreDictUnificator.get(OrePrefixes.circuit.get(Materials.UHV), 4), + GTOreDictUnificator.get(OrePrefixes.plateSuperdense.get(Materials.SiliconSG), 4)) + .itemOutputs(ItemList.Cover_SolarPanel_UV.get(1)) + .fluidInputs(new FluidStack(solderIndalloy, 1152)) + .duration(1 * SECONDS) + .eut(TierEU.RECIPE_UEV) + .fake() + .addTo(solarFactoryRecipes); + + // Real recipes for the multi, hidden from NEI + GTValues.RA.stdBuilder() + .itemInputs( + getModItem(NewHorizonsCoreMod.ID, "item.IrradiantReinforcedAluminiumPlate", 2), + GTOreDictUnificator.get(OrePrefixes.wireGt01, Materials.SuperconductorMV, 4), + GTOreDictUnificator.get(OrePrefixes.circuit.get(Materials.HV), 2)) + .itemOutputs(ItemList.Cover_SolarPanel_LV.get(1)) + .fluidInputs(Materials.Polytetrafluoroethylene.getMolten(288)) + .duration(10 * SECONDS) + .eut(TierEU.RECIPE_HV) + .metadata(SF_DATA, new SolarFactoryRecipeData(2, 4)) + .hidden() + .addTo(solarFactoryRecipes); + + GTValues.RA.stdBuilder() + .itemInputs( + getModItem(NewHorizonsCoreMod.ID, "item.IrradiantReinforcedTitaniumPlate", 2), + ItemList.Circuit_Chip_ULPIC.get(4), + GTOreDictUnificator.get(OrePrefixes.wireGt01, Materials.SuperconductorHV, 4), + GTOreDictUnificator.get(OrePrefixes.circuit.get(Materials.EV), 2)) + .itemOutputs(ItemList.Cover_SolarPanel_MV.get(1)) + .fluidInputs(Materials.Epoxid.getMolten(576)) + .duration(10 * SECONDS) + .eut(TierEU.RECIPE_EV) + .metadata(SF_DATA, new SolarFactoryRecipeData(2, 4)) + .hidden() + .addTo(solarFactoryRecipes); + + GTValues.RA.stdBuilder() + .itemInputs( + getModItem(NewHorizonsCoreMod.ID, "item.IrradiantReinforcedTungstenPlate", 4), + ItemList.Circuit_Chip_LPIC.get(4), + GTOreDictUnificator.get(OrePrefixes.wireGt01, Materials.SuperconductorEV, 8), + GTOreDictUnificator.get(OrePrefixes.circuit.get(Materials.IV), 4), + GTOreDictUnificator.get(OrePrefixes.plate.get(Materials.IndiumGalliumPhosphide), 8)) + .itemOutputs(ItemList.Cover_SolarPanel_HV.get(1)) + .duration(10 * SECONDS) + .eut(TierEU.RECIPE_IV) + .metadata(SF_DATA, new SolarFactoryRecipeData(2, 4)) + .hidden() + .addTo(solarFactoryRecipes); + + GTValues.RA.stdBuilder() + .itemInputs( + getModItem(NewHorizonsCoreMod.ID, "item.IrradiantReinforcedTungstenPlate", 4), + ItemList.Circuit_Chip_PIC.get(4), + GTOreDictUnificator.get(OrePrefixes.wireGt01, Materials.SuperconductorIV, 8), + GTOreDictUnificator.get(OrePrefixes.circuit.get(Materials.LuV), 4), + GTOreDictUnificator.get(OrePrefixes.plate.get(Materials.SiliconSG), 16)) + .itemOutputs(ItemList.Cover_SolarPanel_EV.get(1)) + .fluidInputs(Materials.Polybenzimidazole.getMolten(576)) + .duration(10 * SECONDS) + .eut(TierEU.RECIPE_LuV) + .metadata(SF_DATA, new SolarFactoryRecipeData(3, 4)) + .hidden() + .addTo(solarFactoryRecipes); + + GTValues.RA.stdBuilder() + .itemInputs( + getModItem(NewHorizonsCoreMod.ID, "item.IrradiantReinforcedChromePlate", 4), + ItemList.Circuit_Chip_HPIC.get(4), + GTOreDictUnificator.get(OrePrefixes.wireGt01, Materials.SuperconductorLuV, 10), + GTOreDictUnificator.get(OrePrefixes.circuit.get(Materials.ZPM), 4), + GTOreDictUnificator.get(OrePrefixes.block.get(Materials.SiliconSG), 4)) + .itemOutputs(ItemList.Cover_SolarPanel_IV.get(1)) + .fluidInputs(Materials.Polybenzimidazole.getMolten(1152)) .duration(10 * SECONDS) - .eut((int) TierEU.RECIPE_HV) - .metadata(SolarFactoryKey.INSTANCE, 0) + .eut(TierEU.RECIPE_ZPM) + .metadata(SF_DATA, new SolarFactoryRecipeData(3, 8)) + .hidden() + .addTo(solarFactoryRecipes); + + GTValues.RA.stdBuilder() + .itemInputs( + getModItem(NewHorizonsCoreMod.ID, "item.IrradiantReinforcedChromePlate", 4), + ItemList.Circuit_Chip_UHPIC.get(8), + GTOreDictUnificator.get(OrePrefixes.wireGt01, Materials.SuperconductorZPM, 24), + GTOreDictUnificator.get(OrePrefixes.circuit.get(Materials.UV), 2), + GTOreDictUnificator.get(OrePrefixes.circuit.get(Materials.ZPM), 6), + GTOreDictUnificator.get(OrePrefixes.block.get(Materials.SiliconSG), 8), + getModItem(SuperSolarPanels.ID, "solarsplitter", 4, 0)) + .itemOutputs(ItemList.Cover_SolarPanel_LuV.get(1)) + .fluidInputs(Materials.Polybenzimidazole.getMolten(1728)) + .duration(1 * SECONDS) + .eut(TierEU.RECIPE_UV) + .metadata(SF_DATA, new SolarFactoryRecipeData(4, 8)) + .hidden() + .addTo(solarFactoryRecipes); + + GTValues.RA.stdBuilder() + .itemInputs( + getModItem(NewHorizonsCoreMod.ID, "item.IrradiantReinforcedNaquadriaPlate", 8), + ItemList.Circuit_Wafer_QPIC.get(4), + ItemList.Circuit_Chip_NPIC.get(8), + GTOreDictUnificator.get(OrePrefixes.wireGt01, Materials.SuperconductorUV, 32), + GTOreDictUnificator.get(OrePrefixes.circuit.get(Materials.UHV), 2), + GTOreDictUnificator.get(OrePrefixes.circuit.get(Materials.UV), 4)) + .itemOutputs(ItemList.Cover_SolarPanel_ZPM.get(1)) + .fluidInputs(Materials.Polybenzimidazole.getMolten(2304)) + .duration(1 * SECONDS) + .eut(TierEU.RECIPE_UHV) + .metadata(SF_DATA, new SolarFactoryRecipeData(5, 8)) + .hidden() + .addTo(solarFactoryRecipes); + + GTValues.RA.stdBuilder() + .itemInputs( + getModItem(NewHorizonsCoreMod.ID, "item.IrradiantReinforcedNaquadriaPlate", 8), + getModItem(NewHorizonsCoreMod.ID, "item.PicoWafer", 8), + ItemList.Circuit_Chip_PPIC.get(8), + ItemList.Circuit_Chip_CrystalSoC2.get(8), + GTOreDictUnificator.get(OrePrefixes.wireGt04, Materials.SuperconductorUHV, 12), + GTOreDictUnificator.get(OrePrefixes.circuit.get(Materials.UEV), 2), + GTOreDictUnificator.get(OrePrefixes.circuit.get(Materials.UHV), 4), + GTOreDictUnificator.get(OrePrefixes.plateSuperdense.get(Materials.SiliconSG), 4)) + .itemOutputs(ItemList.Cover_SolarPanel_UV.get(1)) + .fluidInputs(new FluidStack(solderIndalloy, 1152)) + .duration(1 * SECONDS) + .eut(TierEU.RECIPE_UEV) + .metadata(SF_DATA, new SolarFactoryRecipeData(5, 8)) + .hidden() .addTo(solarFactoryRecipes); } } From 2dbbc82bb941ad616ac43d1f3f7ab4c848b0c72b Mon Sep 17 00:00:00 2001 From: PureBluez Date: Sun, 24 Nov 2024 18:12:32 -0600 Subject: [PATCH 05/22] fix that bug with stocking bus (solution came to me in a dream) --- .../machines/multi/MTESolarFactory.java | 20 ++++++------------- 1 file changed, 6 insertions(+), 14 deletions(-) diff --git a/src/main/java/gregtech/common/tileentities/machines/multi/MTESolarFactory.java b/src/main/java/gregtech/common/tileentities/machines/multi/MTESolarFactory.java index a085f1ebd5c..98c1f569ab6 100644 --- a/src/main/java/gregtech/common/tileentities/machines/multi/MTESolarFactory.java +++ b/src/main/java/gregtech/common/tileentities/machines/multi/MTESolarFactory.java @@ -16,8 +16,6 @@ import static net.minecraft.util.EnumChatFormatting.BLUE; import static net.minecraft.util.EnumChatFormatting.DARK_AQUA; -import java.util.List; - import javax.annotation.Nonnull; import net.minecraft.item.ItemStack; @@ -60,7 +58,6 @@ import gregtech.api.util.recipe.SolarFactoryRecipeData; // TODO: fix bugs if i find them -// TODO: Bug: Freaky stocking bus public class MTESolarFactory extends MTEExtendedPowerMultiBlockBase implements IConstructable, ISurvivalConstructable { @@ -248,16 +245,11 @@ public CheckRecipeResult checkProcessing() { protected ProcessingLogic createProcessingLogic() { return new ProcessingLogic() { - private void findWafer(List> waferList) { - ItemStack[] items; - if (isInputSeparationEnabled()) { - items = inputItems; - } else items = getStoredInputs().toArray(new ItemStack[0]); - - for (ItemStack stored : items) { - for (Pair pair : waferList) { - if (stored.isItemEqual(pair.getLeft())) { - foundWaferStack = stored; + private void findWaferStack() { + for (ItemStack items : inputItems) { + for (Pair pair : validWafers) { + if (items.isItemEqual(pair.getLeft())) { + foundWaferStack = items; foundWaferTier = pair.getRight(); break; } @@ -275,7 +267,7 @@ public CheckRecipeResult validateRecipe(@NotNull GTRecipe recipe) { waferAmountInRecipe = recipe.getMetadataOrDefault(SF_DATA, new SolarFactoryRecipeData(0, 0)) .getMinimumWaferCount(); if (minimumTierForRecipe == 0) return CheckRecipeResultRegistry.SUCCESSFUL; - findWafer(validWafers); + findWaferStack(); if (foundWaferStack == null) { return SimpleCheckRecipeResult.ofFailure("no_wafer"); } From 910d712279f7c742cbc289f2641445e202855727 Mon Sep 17 00:00:00 2001 From: PureBluez Date: Wed, 27 Nov 2024 21:24:11 -0600 Subject: [PATCH 06/22] fix angelica crash (???) --- .../gregtech/api/util/GTRecipeConstants.java | 22 ++++++++++++------- .../util/recipe/SolarFactoryRecipeData.java | 8 ------- .../machines/multi/MTESolarFactory.java | 12 +++++----- .../postload/recipes/SolarFactoryRecipes.java | 18 +++++++-------- 4 files changed, 28 insertions(+), 32 deletions(-) diff --git a/src/main/java/gregtech/api/util/GTRecipeConstants.java b/src/main/java/gregtech/api/util/GTRecipeConstants.java index a569ee96e12..3d753babfa6 100644 --- a/src/main/java/gregtech/api/util/GTRecipeConstants.java +++ b/src/main/java/gregtech/api/util/GTRecipeConstants.java @@ -16,6 +16,7 @@ import cpw.mods.fml.common.registry.GameRegistry; import gregtech.api.enums.GTValues; +import gregtech.api.enums.ItemList; import gregtech.api.enums.Materials; import gregtech.api.enums.OrePrefixes; import gregtech.api.enums.TierEU; @@ -106,12 +107,6 @@ public class GTRecipeConstants { */ public static final RecipeMetadataKey ON_FIRE = SimpleRecipeMetadataKey.create(Boolean.class, "on_fire"); - /** - * Solar Factory recipe data containing minimum wafer tier and count - */ - public static final RecipeMetadataKey SF_DATA = SimpleRecipeMetadataKey - .create(SolarFactoryRecipeData.class, "solar_factory_wafer_tier"); - /** * Nano Forge Tier. */ @@ -200,6 +195,12 @@ public class GTRecipeConstants { public static final RecipeMetadataKey COAL_CASING_TIER = SimpleRecipeMetadataKey .create(Integer.class, "coal_casing_tier"); + /** + * Solar Factory recipe data containing minimum wafer tier and count + */ + public static final RecipeMetadataKey SOLAR_FACTORY_WAFER_DATA = SimpleRecipeMetadataKey + .create(SolarFactoryRecipeData.class, "solar_factory_wafer_data"); + /** * LFTR output power. */ @@ -514,12 +515,14 @@ enum Wafer{ GTRecipe.RecipeAssemblyLine.sAssemblylineRecipes.add(tRecipe); AssemblyLineUtils.addRecipeToCache(tRecipe); + ItemStack writesDataStick = ItemList.Tool_DataStick.getWithName(1L, "Writes Research result"); + AssemblyLineUtils.setAssemblyLineRecipeOnDataStick(writesDataStick, tRecipe, false); Collection ret = new ArrayList<>(3); ret.addAll( GTValues.RA.stdBuilder() .itemInputs(aResearchItem) .itemOutputs(aOutput) - .special(tRecipe.newDataStickForNEI("Writes Research result")) + .special(writesDataStick) .duration(aResearchTime) .eut(TierEU.RECIPE_LV) .specialValue(-201) // means it's scanned @@ -528,12 +531,14 @@ enum Wafer{ .fake() .addTo(scannerFakeRecipes)); + ItemStack readsDataStick = ItemList.Tool_DataStick.getWithName(1L, "Reads Research result"); + AssemblyLineUtils.setAssemblyLineRecipeOnDataStick(readsDataStick, tRecipe, false); ret.add( RecipeMaps.assemblylineVisualRecipes.addFakeRecipe( false, r.mInputs, new ItemStack[] { aOutput }, - new ItemStack[] { tRecipe.newDataStickForNEI("Reads Research result") }, + new ItemStack[] { readsDataStick }, r.mFluidInputs, null, r.mDuration, @@ -693,6 +698,7 @@ public IRecipeMap getTarget() { GTRecipeMapUtil.SPECIAL_VALUE_ALIASES.add(NKE_RANGE); GTRecipeMapUtil.SPECIAL_VALUE_ALIASES.add(PRECISE_ASSEMBLER_CASING_TIER); GTRecipeMapUtil.SPECIAL_VALUE_ALIASES.add(COAL_CASING_TIER); + GTRecipeMapUtil.SPECIAL_VALUE_ALIASES.add(COMPRESSION_TIER); GTRecipeMapUtil.SPECIAL_VALUE_ALIASES.add(RESEARCH_STATION_DATA); GTRecipeMapUtil.SPECIAL_VALUE_ALIASES.add(SIEVERTS); GTRecipeMapUtil.SPECIAL_VALUE_ALIASES.add(DECAY_TICKS); diff --git a/src/main/java/gregtech/api/util/recipe/SolarFactoryRecipeData.java b/src/main/java/gregtech/api/util/recipe/SolarFactoryRecipeData.java index 38db6253272..b74ec89d2a5 100644 --- a/src/main/java/gregtech/api/util/recipe/SolarFactoryRecipeData.java +++ b/src/main/java/gregtech/api/util/recipe/SolarFactoryRecipeData.java @@ -9,12 +9,4 @@ public SolarFactoryRecipeData(int minimumWaferTier, int minimumWaferCount) { this.minimumWaferTier = minimumWaferTier; this.minimumWaferCount = minimumWaferCount; } - - public int getMinimumWaferTier() { - return minimumWaferTier; - } - - public int getMinimumWaferCount() { - return minimumWaferCount; - } } diff --git a/src/main/java/gregtech/common/tileentities/machines/multi/MTESolarFactory.java b/src/main/java/gregtech/common/tileentities/machines/multi/MTESolarFactory.java index 98c1f569ab6..6d6663e536b 100644 --- a/src/main/java/gregtech/common/tileentities/machines/multi/MTESolarFactory.java +++ b/src/main/java/gregtech/common/tileentities/machines/multi/MTESolarFactory.java @@ -8,7 +8,6 @@ import static gregtech.api.enums.Textures.BlockIcons.OVERLAY_FRONT_SOLAR_FACTORY_INACTIVE; import static gregtech.api.enums.Textures.BlockIcons.OVERLAY_FRONT_SOLAR_FACTORY_INACTIVE_GLOW; import static gregtech.api.enums.Textures.BlockIcons.casingTexturePages; -import static gregtech.api.util.GTRecipeConstants.SF_DATA; import static gregtech.api.util.GTStructureUtility.buildHatchAdder; import static gregtech.api.util.GTStructureUtility.ofFrame; import static gregtech.api.util.GTUtility.copyAmount; @@ -53,6 +52,7 @@ import gregtech.api.recipe.check.SimpleCheckRecipeResult; import gregtech.api.render.TextureFactory; import gregtech.api.util.GTRecipe; +import gregtech.api.util.GTRecipeConstants; import gregtech.api.util.MultiblockTooltipBuilder; import gregtech.api.util.ParallelHelper; import gregtech.api.util.recipe.SolarFactoryRecipeData; @@ -260,12 +260,10 @@ private void findWaferStack() { @NotNull @Override public CheckRecipeResult validateRecipe(@NotNull GTRecipe recipe) { - // No metadata means no wafers used in the recipe, so return successful since this method is called only - // when input matching is already successful. - minimumTierForRecipe = recipe.getMetadataOrDefault(SF_DATA, new SolarFactoryRecipeData(0, 0)) - .getMinimumWaferTier(); - waferAmountInRecipe = recipe.getMetadataOrDefault(SF_DATA, new SolarFactoryRecipeData(0, 0)) - .getMinimumWaferCount(); + SolarFactoryRecipeData data = recipe.getMetadata(GTRecipeConstants.SOLAR_FACTORY_WAFER_DATA); + if (data == null) return CheckRecipeResultRegistry.NO_RECIPE; + minimumTierForRecipe = data.minimumWaferTier; + waferAmountInRecipe = data.minimumWaferCount; if (minimumTierForRecipe == 0) return CheckRecipeResultRegistry.SUCCESSFUL; findWaferStack(); if (foundWaferStack == null) { diff --git a/src/main/java/gregtech/loaders/postload/recipes/SolarFactoryRecipes.java b/src/main/java/gregtech/loaders/postload/recipes/SolarFactoryRecipes.java index 9ea839521a7..1551fbc4041 100644 --- a/src/main/java/gregtech/loaders/postload/recipes/SolarFactoryRecipes.java +++ b/src/main/java/gregtech/loaders/postload/recipes/SolarFactoryRecipes.java @@ -5,7 +5,7 @@ import static gregtech.api.recipe.RecipeMaps.solarFactoryRecipes; import static gregtech.api.util.GTModHandler.getModItem; import static gregtech.api.util.GTRecipeBuilder.SECONDS; -import static gregtech.api.util.GTRecipeConstants.SF_DATA; +import static gregtech.api.util.GTRecipeConstants.SOLAR_FACTORY_WAFER_DATA; import net.minecraftforge.fluids.Fluid; import net.minecraftforge.fluids.FluidRegistry; @@ -169,7 +169,7 @@ public void run() { .fluidInputs(Materials.Polytetrafluoroethylene.getMolten(288)) .duration(10 * SECONDS) .eut(TierEU.RECIPE_HV) - .metadata(SF_DATA, new SolarFactoryRecipeData(2, 4)) + .metadata(SOLAR_FACTORY_WAFER_DATA, new SolarFactoryRecipeData(2, 4)) .hidden() .addTo(solarFactoryRecipes); @@ -183,7 +183,7 @@ public void run() { .fluidInputs(Materials.Epoxid.getMolten(576)) .duration(10 * SECONDS) .eut(TierEU.RECIPE_EV) - .metadata(SF_DATA, new SolarFactoryRecipeData(2, 4)) + .metadata(SOLAR_FACTORY_WAFER_DATA, new SolarFactoryRecipeData(2, 4)) .hidden() .addTo(solarFactoryRecipes); @@ -197,7 +197,7 @@ public void run() { .itemOutputs(ItemList.Cover_SolarPanel_HV.get(1)) .duration(10 * SECONDS) .eut(TierEU.RECIPE_IV) - .metadata(SF_DATA, new SolarFactoryRecipeData(2, 4)) + .metadata(SOLAR_FACTORY_WAFER_DATA, new SolarFactoryRecipeData(2, 4)) .hidden() .addTo(solarFactoryRecipes); @@ -212,7 +212,7 @@ public void run() { .fluidInputs(Materials.Polybenzimidazole.getMolten(576)) .duration(10 * SECONDS) .eut(TierEU.RECIPE_LuV) - .metadata(SF_DATA, new SolarFactoryRecipeData(3, 4)) + .metadata(SOLAR_FACTORY_WAFER_DATA, new SolarFactoryRecipeData(3, 4)) .hidden() .addTo(solarFactoryRecipes); @@ -227,7 +227,7 @@ public void run() { .fluidInputs(Materials.Polybenzimidazole.getMolten(1152)) .duration(10 * SECONDS) .eut(TierEU.RECIPE_ZPM) - .metadata(SF_DATA, new SolarFactoryRecipeData(3, 8)) + .metadata(SOLAR_FACTORY_WAFER_DATA, new SolarFactoryRecipeData(3, 8)) .hidden() .addTo(solarFactoryRecipes); @@ -244,7 +244,7 @@ public void run() { .fluidInputs(Materials.Polybenzimidazole.getMolten(1728)) .duration(1 * SECONDS) .eut(TierEU.RECIPE_UV) - .metadata(SF_DATA, new SolarFactoryRecipeData(4, 8)) + .metadata(SOLAR_FACTORY_WAFER_DATA, new SolarFactoryRecipeData(4, 8)) .hidden() .addTo(solarFactoryRecipes); @@ -260,7 +260,7 @@ public void run() { .fluidInputs(Materials.Polybenzimidazole.getMolten(2304)) .duration(1 * SECONDS) .eut(TierEU.RECIPE_UHV) - .metadata(SF_DATA, new SolarFactoryRecipeData(5, 8)) + .metadata(SOLAR_FACTORY_WAFER_DATA, new SolarFactoryRecipeData(5, 8)) .hidden() .addTo(solarFactoryRecipes); @@ -278,7 +278,7 @@ public void run() { .fluidInputs(new FluidStack(solderIndalloy, 1152)) .duration(1 * SECONDS) .eut(TierEU.RECIPE_UEV) - .metadata(SF_DATA, new SolarFactoryRecipeData(5, 8)) + .metadata(SOLAR_FACTORY_WAFER_DATA, new SolarFactoryRecipeData(5, 8)) .hidden() .addTo(solarFactoryRecipes); } From 94d4ef8ae821f714069fc75c39a3147dbbcdc662 Mon Sep 17 00:00:00 2001 From: PureBluez Date: Wed, 27 Nov 2024 21:54:46 -0600 Subject: [PATCH 07/22] fix artifact from merge? idk how that got there --- src/main/java/gregtech/api/util/GTRecipeConstants.java | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/src/main/java/gregtech/api/util/GTRecipeConstants.java b/src/main/java/gregtech/api/util/GTRecipeConstants.java index 3d753babfa6..5c5d2d8bc09 100644 --- a/src/main/java/gregtech/api/util/GTRecipeConstants.java +++ b/src/main/java/gregtech/api/util/GTRecipeConstants.java @@ -522,7 +522,7 @@ enum Wafer{ GTValues.RA.stdBuilder() .itemInputs(aResearchItem) .itemOutputs(aOutput) - .special(writesDataStick) + .special(tRecipe.newDataStickForNEI("Writes Research result")) .duration(aResearchTime) .eut(TierEU.RECIPE_LV) .specialValue(-201) // means it's scanned @@ -538,7 +538,7 @@ enum Wafer{ false, r.mInputs, new ItemStack[] { aOutput }, - new ItemStack[] { readsDataStick }, + new ItemStack[] { tRecipe.newDataStickForNEI("Reads Research result") }, r.mFluidInputs, null, r.mDuration, @@ -698,7 +698,6 @@ public IRecipeMap getTarget() { GTRecipeMapUtil.SPECIAL_VALUE_ALIASES.add(NKE_RANGE); GTRecipeMapUtil.SPECIAL_VALUE_ALIASES.add(PRECISE_ASSEMBLER_CASING_TIER); GTRecipeMapUtil.SPECIAL_VALUE_ALIASES.add(COAL_CASING_TIER); - GTRecipeMapUtil.SPECIAL_VALUE_ALIASES.add(COMPRESSION_TIER); GTRecipeMapUtil.SPECIAL_VALUE_ALIASES.add(RESEARCH_STATION_DATA); GTRecipeMapUtil.SPECIAL_VALUE_ALIASES.add(SIEVERTS); GTRecipeMapUtil.SPECIAL_VALUE_ALIASES.add(DECAY_TICKS); From a69710589c37715a00608ec68d4d01a44e6bf3c1 Mon Sep 17 00:00:00 2001 From: PureBluez Date: Wed, 27 Nov 2024 22:04:19 -0600 Subject: [PATCH 08/22] last commit but proper (hopefully) --- src/main/java/gregtech/api/util/GTRecipeConstants.java | 5 ----- 1 file changed, 5 deletions(-) diff --git a/src/main/java/gregtech/api/util/GTRecipeConstants.java b/src/main/java/gregtech/api/util/GTRecipeConstants.java index 5c5d2d8bc09..98a998577a1 100644 --- a/src/main/java/gregtech/api/util/GTRecipeConstants.java +++ b/src/main/java/gregtech/api/util/GTRecipeConstants.java @@ -16,7 +16,6 @@ import cpw.mods.fml.common.registry.GameRegistry; import gregtech.api.enums.GTValues; -import gregtech.api.enums.ItemList; import gregtech.api.enums.Materials; import gregtech.api.enums.OrePrefixes; import gregtech.api.enums.TierEU; @@ -515,8 +514,6 @@ enum Wafer{ GTRecipe.RecipeAssemblyLine.sAssemblylineRecipes.add(tRecipe); AssemblyLineUtils.addRecipeToCache(tRecipe); - ItemStack writesDataStick = ItemList.Tool_DataStick.getWithName(1L, "Writes Research result"); - AssemblyLineUtils.setAssemblyLineRecipeOnDataStick(writesDataStick, tRecipe, false); Collection ret = new ArrayList<>(3); ret.addAll( GTValues.RA.stdBuilder() @@ -531,8 +528,6 @@ enum Wafer{ .fake() .addTo(scannerFakeRecipes)); - ItemStack readsDataStick = ItemList.Tool_DataStick.getWithName(1L, "Reads Research result"); - AssemblyLineUtils.setAssemblyLineRecipeOnDataStick(readsDataStick, tRecipe, false); ret.add( RecipeMaps.assemblylineVisualRecipes.addFakeRecipe( false, From 01d39000192088a45b374ba9712d03041797173c Mon Sep 17 00:00:00 2001 From: PureBluez Date: Thu, 28 Nov 2024 14:28:50 -0600 Subject: [PATCH 09/22] add controller recipe + bugfix + cleanup --- .../machines/multi/MTESolarFactory.java | 8 +++++-- .../postload/recipes/AssemblyLineRecipes.java | 21 +++++++++++++++++++ .../postload/recipes/SolarFactoryRecipes.java | 2 +- 3 files changed, 28 insertions(+), 3 deletions(-) diff --git a/src/main/java/gregtech/common/tileentities/machines/multi/MTESolarFactory.java b/src/main/java/gregtech/common/tileentities/machines/multi/MTESolarFactory.java index 6d6663e536b..aa12af1552f 100644 --- a/src/main/java/gregtech/common/tileentities/machines/multi/MTESolarFactory.java +++ b/src/main/java/gregtech/common/tileentities/machines/multi/MTESolarFactory.java @@ -58,6 +58,7 @@ import gregtech.api.util.recipe.SolarFactoryRecipeData; // TODO: fix bugs if i find them +// TODO: move controller recipe in AssemblyLineRecipes into coremod public class MTESolarFactory extends MTEExtendedPowerMultiBlockBase implements IConstructable, ISurvivalConstructable { @@ -260,19 +261,23 @@ private void findWaferStack() { @NotNull @Override public CheckRecipeResult validateRecipe(@NotNull GTRecipe recipe) { - SolarFactoryRecipeData data = recipe.getMetadata(GTRecipeConstants.SOLAR_FACTORY_WAFER_DATA); + SolarFactoryRecipeData data = recipe + .getMetadataOrDefault(GTRecipeConstants.SOLAR_FACTORY_WAFER_DATA, new SolarFactoryRecipeData(0, 0)); if (data == null) return CheckRecipeResultRegistry.NO_RECIPE; minimumTierForRecipe = data.minimumWaferTier; waferAmountInRecipe = data.minimumWaferCount; if (minimumTierForRecipe == 0) return CheckRecipeResultRegistry.SUCCESSFUL; findWaferStack(); if (foundWaferStack == null) { + clearVars(); return SimpleCheckRecipeResult.ofFailure("no_wafer"); } if (minimumTierForRecipe > foundWaferTier) { + clearVars(); return SimpleCheckRecipeResult.ofFailure("low_wafer_tier"); } if (waferAmountInRecipe > foundWaferStack.stackSize) { + clearVars(); return SimpleCheckRecipeResult.ofFailure("not_enough_wafer"); } return CheckRecipeResultRegistry.SUCCESSFUL; @@ -315,7 +320,6 @@ protected MultiblockTooltipBuilder createTooltip() { .addInfo("Parallels are based on Precise Casing Tier") .addInfo("MK-I = 8x, MK-II = 16x, MK-III = 32x, MK-IV = 64x") .addInfo("Supports " + TT + " energy hatches") - .addSeparator() .beginStructureBlock(7, 10, 9, true) .addStructureInfo(BLUE + "Imprecise Unit Casings cannot be used") .addStructureInfo(BLUE + "26 " + DARK_AQUA + "Precise Electronic Unit Casing") diff --git a/src/main/java/gregtech/loaders/postload/recipes/AssemblyLineRecipes.java b/src/main/java/gregtech/loaders/postload/recipes/AssemblyLineRecipes.java index 1c91dcd7861..6164e13d149 100644 --- a/src/main/java/gregtech/loaders/postload/recipes/AssemblyLineRecipes.java +++ b/src/main/java/gregtech/loaders/postload/recipes/AssemblyLineRecipes.java @@ -884,5 +884,26 @@ public void run() { .eut(TierEU.RECIPE_UHV) .addTo(AssemblyLine); + GTValues.RA.stdBuilder() + .metadata(RESEARCH_ITEM, ItemList.Cover_SolarPanel.get(1)) + .metadata(RESEARCH_TIME, 2 * HOURS) + .itemInputs( + ItemList.Hull_LuV.get(2), + ItemList.AssemblingMachineLuV.get(1), + GTOreDictUnificator.get(OrePrefixes.frameGt, Materials.BlueAlloy, 4), + ItemList.Robot_Arm_LuV.get(8), + ItemList.Electric_Motor_LuV.get(4), + ItemList.Electric_Piston_LuV.get(4), + GTOreDictUnificator.get(OrePrefixes.circuit.get(Materials.ZPM), 4), + GTOreDictUnificator.get(OrePrefixes.circuit.get(Materials.LuV), 8)) + .itemOutputs(ItemList.SolarFactory.get(1)) + .fluidInputs( + new FluidStack(solderIndalloy, 2880), + Materials.Lubricant.getFluid(1440), + Materials.Electrotine.getMolten(720)) + .duration(60 * SECONDS) + .eut(TierEU.RECIPE_LuV) + .addTo(AssemblyLine); + } } diff --git a/src/main/java/gregtech/loaders/postload/recipes/SolarFactoryRecipes.java b/src/main/java/gregtech/loaders/postload/recipes/SolarFactoryRecipes.java index 1551fbc4041..b7c4498e089 100644 --- a/src/main/java/gregtech/loaders/postload/recipes/SolarFactoryRecipes.java +++ b/src/main/java/gregtech/loaders/postload/recipes/SolarFactoryRecipes.java @@ -25,7 +25,7 @@ // Recipe metadata values represent the minimum tier and the amount of wafers respectively. // Metadata is only required on the hidden recipes. -// If the recipe you are making doesn't use a wafer, just make it like a normal recipe, no metadata needed +// If the recipe you are making doesn't use a wafer, just make it without any metadata. public class SolarFactoryRecipes implements Runnable { private final Fluid solderIndalloy; From 0a8d515e602689855aa9234388627fb3785a74a2 Mon Sep 17 00:00:00 2001 From: PureBluez Date: Tue, 17 Dec 2024 20:37:01 -0600 Subject: [PATCH 10/22] recipe adjustments --- .../postload/recipes/SolarFactoryRecipes.java | 18 ++++++++++-------- 1 file changed, 10 insertions(+), 8 deletions(-) diff --git a/src/main/java/gregtech/loaders/postload/recipes/SolarFactoryRecipes.java b/src/main/java/gregtech/loaders/postload/recipes/SolarFactoryRecipes.java index b7c4498e089..9e267a08565 100644 --- a/src/main/java/gregtech/loaders/postload/recipes/SolarFactoryRecipes.java +++ b/src/main/java/gregtech/loaders/postload/recipes/SolarFactoryRecipes.java @@ -73,6 +73,7 @@ public void run() { GTOreDictUnificator.get(OrePrefixes.circuit.get(Materials.IV), 4), GTOreDictUnificator.get(OrePrefixes.plate.get(Materials.IndiumGalliumPhosphide), 8)) .itemOutputs(ItemList.Cover_SolarPanel_HV.get(1)) + .fluidInputs(Materials.Epoxid.getMolten(1152)) .duration(10 * SECONDS) .eut(TierEU.RECIPE_IV) .fake() @@ -80,7 +81,7 @@ public void run() { GTValues.RA.stdBuilder() .itemInputs( - getModItem(NewHorizonsCoreMod.ID, "item.IrradiantReinforcedTungstenPlate", 4), + getModItem(NewHorizonsCoreMod.ID, "item.IrradiantReinforcedTungstenSteelPlate", 4), ItemList.Circuit_Silicon_Wafer3.get(4), ItemList.Circuit_Chip_PIC.get(4), GTOreDictUnificator.get(OrePrefixes.wireGt01, Materials.SuperconductorIV, 8), @@ -120,7 +121,7 @@ public void run() { getModItem(SuperSolarPanels.ID, "solarsplitter", 4, 0)) .itemOutputs(ItemList.Cover_SolarPanel_LuV.get(1)) .fluidInputs(Materials.Polybenzimidazole.getMolten(1728)) - .duration(1 * SECONDS) + .duration(10 * SECONDS) .eut(TierEU.RECIPE_UV) .fake() .addTo(solarFactoryRecipes); @@ -136,7 +137,7 @@ public void run() { GTOreDictUnificator.get(OrePrefixes.circuit.get(Materials.UV), 4)) .itemOutputs(ItemList.Cover_SolarPanel_ZPM.get(1)) .fluidInputs(Materials.Polybenzimidazole.getMolten(2304)) - .duration(1 * SECONDS) + .duration(10 * SECONDS) .eut(TierEU.RECIPE_UHV) .fake() .addTo(solarFactoryRecipes); @@ -154,7 +155,7 @@ public void run() { GTOreDictUnificator.get(OrePrefixes.plateSuperdense.get(Materials.SiliconSG), 4)) .itemOutputs(ItemList.Cover_SolarPanel_UV.get(1)) .fluidInputs(new FluidStack(solderIndalloy, 1152)) - .duration(1 * SECONDS) + .duration(10 * SECONDS) .eut(TierEU.RECIPE_UEV) .fake() .addTo(solarFactoryRecipes); @@ -195,6 +196,7 @@ public void run() { GTOreDictUnificator.get(OrePrefixes.circuit.get(Materials.IV), 4), GTOreDictUnificator.get(OrePrefixes.plate.get(Materials.IndiumGalliumPhosphide), 8)) .itemOutputs(ItemList.Cover_SolarPanel_HV.get(1)) + .fluidInputs(Materials.Polybenzimidazole.getMolten(576)) .duration(10 * SECONDS) .eut(TierEU.RECIPE_IV) .metadata(SOLAR_FACTORY_WAFER_DATA, new SolarFactoryRecipeData(2, 4)) @@ -203,7 +205,7 @@ public void run() { GTValues.RA.stdBuilder() .itemInputs( - getModItem(NewHorizonsCoreMod.ID, "item.IrradiantReinforcedTungstenPlate", 4), + getModItem(NewHorizonsCoreMod.ID, "item.IrradiantReinforcedTungstenSteelPlate", 4), ItemList.Circuit_Chip_PIC.get(4), GTOreDictUnificator.get(OrePrefixes.wireGt01, Materials.SuperconductorIV, 8), GTOreDictUnificator.get(OrePrefixes.circuit.get(Materials.LuV), 4), @@ -242,7 +244,7 @@ public void run() { getModItem(SuperSolarPanels.ID, "solarsplitter", 4, 0)) .itemOutputs(ItemList.Cover_SolarPanel_LuV.get(1)) .fluidInputs(Materials.Polybenzimidazole.getMolten(1728)) - .duration(1 * SECONDS) + .duration(10 * SECONDS) .eut(TierEU.RECIPE_UV) .metadata(SOLAR_FACTORY_WAFER_DATA, new SolarFactoryRecipeData(4, 8)) .hidden() @@ -258,7 +260,7 @@ public void run() { GTOreDictUnificator.get(OrePrefixes.circuit.get(Materials.UV), 4)) .itemOutputs(ItemList.Cover_SolarPanel_ZPM.get(1)) .fluidInputs(Materials.Polybenzimidazole.getMolten(2304)) - .duration(1 * SECONDS) + .duration(10 * SECONDS) .eut(TierEU.RECIPE_UHV) .metadata(SOLAR_FACTORY_WAFER_DATA, new SolarFactoryRecipeData(5, 8)) .hidden() @@ -276,7 +278,7 @@ public void run() { GTOreDictUnificator.get(OrePrefixes.plateSuperdense.get(Materials.SiliconSG), 4)) .itemOutputs(ItemList.Cover_SolarPanel_UV.get(1)) .fluidInputs(new FluidStack(solderIndalloy, 1152)) - .duration(1 * SECONDS) + .duration(10 * SECONDS) .eut(TierEU.RECIPE_UEV) .metadata(SOLAR_FACTORY_WAFER_DATA, new SolarFactoryRecipeData(5, 8)) .hidden() From d700f1c168b38d182754f9d0071769b4135f2913 Mon Sep 17 00:00:00 2001 From: PureBluez Date: Mon, 23 Dec 2024 14:56:04 -0600 Subject: [PATCH 11/22] changes for when i pr --- .../machines/multi/MTESolarFactory.java | 6 +----- .../postload/recipes/AssemblyLineRecipes.java | 21 ------------------- .../preload/LoaderMetaTileEntities.java | 2 +- 3 files changed, 2 insertions(+), 27 deletions(-) diff --git a/src/main/java/gregtech/common/tileentities/machines/multi/MTESolarFactory.java b/src/main/java/gregtech/common/tileentities/machines/multi/MTESolarFactory.java index aa12af1552f..3238a40539b 100644 --- a/src/main/java/gregtech/common/tileentities/machines/multi/MTESolarFactory.java +++ b/src/main/java/gregtech/common/tileentities/machines/multi/MTESolarFactory.java @@ -57,9 +57,6 @@ import gregtech.api.util.ParallelHelper; import gregtech.api.util.recipe.SolarFactoryRecipeData; -// TODO: fix bugs if i find them -// TODO: move controller recipe in AssemblyLineRecipes into coremod - public class MTESolarFactory extends MTEExtendedPowerMultiBlockBase implements IConstructable, ISurvivalConstructable { @@ -263,10 +260,9 @@ private void findWaferStack() { public CheckRecipeResult validateRecipe(@NotNull GTRecipe recipe) { SolarFactoryRecipeData data = recipe .getMetadataOrDefault(GTRecipeConstants.SOLAR_FACTORY_WAFER_DATA, new SolarFactoryRecipeData(0, 0)); - if (data == null) return CheckRecipeResultRegistry.NO_RECIPE; minimumTierForRecipe = data.minimumWaferTier; waferAmountInRecipe = data.minimumWaferCount; - if (minimumTierForRecipe == 0) return CheckRecipeResultRegistry.SUCCESSFUL; + if (minimumTierForRecipe == 0 || waferAmountInRecipe == 0) return CheckRecipeResultRegistry.SUCCESSFUL; findWaferStack(); if (foundWaferStack == null) { clearVars(); diff --git a/src/main/java/gregtech/loaders/postload/recipes/AssemblyLineRecipes.java b/src/main/java/gregtech/loaders/postload/recipes/AssemblyLineRecipes.java index 6164e13d149..1c91dcd7861 100644 --- a/src/main/java/gregtech/loaders/postload/recipes/AssemblyLineRecipes.java +++ b/src/main/java/gregtech/loaders/postload/recipes/AssemblyLineRecipes.java @@ -884,26 +884,5 @@ public void run() { .eut(TierEU.RECIPE_UHV) .addTo(AssemblyLine); - GTValues.RA.stdBuilder() - .metadata(RESEARCH_ITEM, ItemList.Cover_SolarPanel.get(1)) - .metadata(RESEARCH_TIME, 2 * HOURS) - .itemInputs( - ItemList.Hull_LuV.get(2), - ItemList.AssemblingMachineLuV.get(1), - GTOreDictUnificator.get(OrePrefixes.frameGt, Materials.BlueAlloy, 4), - ItemList.Robot_Arm_LuV.get(8), - ItemList.Electric_Motor_LuV.get(4), - ItemList.Electric_Piston_LuV.get(4), - GTOreDictUnificator.get(OrePrefixes.circuit.get(Materials.ZPM), 4), - GTOreDictUnificator.get(OrePrefixes.circuit.get(Materials.LuV), 8)) - .itemOutputs(ItemList.SolarFactory.get(1)) - .fluidInputs( - new FluidStack(solderIndalloy, 2880), - Materials.Lubricant.getFluid(1440), - Materials.Electrotine.getMolten(720)) - .duration(60 * SECONDS) - .eut(TierEU.RECIPE_LuV) - .addTo(AssemblyLine); - } } diff --git a/src/main/java/gregtech/loaders/preload/LoaderMetaTileEntities.java b/src/main/java/gregtech/loaders/preload/LoaderMetaTileEntities.java index 75e2646de29..921878d4b59 100644 --- a/src/main/java/gregtech/loaders/preload/LoaderMetaTileEntities.java +++ b/src/main/java/gregtech/loaders/preload/LoaderMetaTileEntities.java @@ -1073,8 +1073,8 @@ import gregtech.common.tileentities.machines.multi.MTEPlasmaForge; import gregtech.common.tileentities.machines.multi.MTEProcessingArray; import gregtech.common.tileentities.machines.multi.MTEPyrolyseOven; -import gregtech.common.tileentities.machines.multi.MTESolarFactory; import gregtech.common.tileentities.machines.multi.MTEResearchCompleter; +import gregtech.common.tileentities.machines.multi.MTESolarFactory; import gregtech.common.tileentities.machines.multi.MTETranscendentPlasmaMixer; import gregtech.common.tileentities.machines.multi.MTEVacuumFreezer; import gregtech.common.tileentities.machines.multi.MTEWormholeGenerator; From c2375e7357a7925a71368f6f8dd5bfefdfa1932c Mon Sep 17 00:00:00 2001 From: PureBluez Date: Mon, 23 Dec 2024 21:31:08 -0600 Subject: [PATCH 12/22] change structure casings --- .../machines/multi/MTESolarFactory.java | 22 ++++++++++--------- 1 file changed, 12 insertions(+), 10 deletions(-) diff --git a/src/main/java/gregtech/common/tileentities/machines/multi/MTESolarFactory.java b/src/main/java/gregtech/common/tileentities/machines/multi/MTESolarFactory.java index 3238a40539b..f5f5c3ce3f3 100644 --- a/src/main/java/gregtech/common/tileentities/machines/multi/MTESolarFactory.java +++ b/src/main/java/gregtech/common/tileentities/machines/multi/MTESolarFactory.java @@ -2,12 +2,12 @@ import static bartworks.util.BWTooltipReference.TT; import static com.gtnewhorizon.structurelib.structure.StructureUtility.*; +import static gregtech.api.GregTechAPI.sBlockCasings4; import static gregtech.api.enums.HatchElement.*; import static gregtech.api.enums.Textures.BlockIcons.OVERLAY_FRONT_SOLAR_FACTORY_ACTIVE; import static gregtech.api.enums.Textures.BlockIcons.OVERLAY_FRONT_SOLAR_FACTORY_ACTIVE_GLOW; import static gregtech.api.enums.Textures.BlockIcons.OVERLAY_FRONT_SOLAR_FACTORY_INACTIVE; import static gregtech.api.enums.Textures.BlockIcons.OVERLAY_FRONT_SOLAR_FACTORY_INACTIVE_GLOW; -import static gregtech.api.enums.Textures.BlockIcons.casingTexturePages; import static gregtech.api.util.GTStructureUtility.buildHatchAdder; import static gregtech.api.util.GTStructureUtility.ofFrame; import static gregtech.api.util.GTUtility.copyAmount; @@ -38,6 +38,7 @@ import gregtech.api.enums.GTValues; import gregtech.api.enums.ItemList; import gregtech.api.enums.Materials; +import gregtech.api.enums.Textures; import gregtech.api.interfaces.ITexture; import gregtech.api.interfaces.metatileentity.IMetaTileEntity; import gregtech.api.interfaces.tileentity.IGregTechTileEntity; @@ -61,7 +62,7 @@ public class MTESolarFactory extends MTEExtendedPowerMultiBlockBase multiDefinition = null; - private static final int CASING_INDEX = 16; + private static final int CASING_INDEX = 48; int casingAmount; int casingTier; @@ -141,10 +142,10 @@ public IMetaTileEntity newMetaEntity(IGregTechTileEntity aTileEntity) { .atLeast(InputHatch, InputBus, OutputBus, Maintenance, Energy.or(ExoticEnergy)) .casingIndex(CASING_INDEX) .dot(1) - .buildAndChain(onElementPass(MTESolarFactory::onCasingAdded, ofBlock(GregTechAPI.sBlockCasings2, 0)))) + .buildAndChain(onElementPass(MTESolarFactory::onCasingAdded, ofBlock(sBlockCasings4, 0)))) .addElement('D', ofBlock(GregTechAPI.sBlockCasings2, 5)) .addElement('B', Glasses.chainAllGlasses()) - .addElement('E', ofFrame(Materials.NiobiumTitanium)) + .addElement('E', ofFrame(Materials.Tungsten)) .build(); public int getCasingTier() { @@ -336,16 +337,17 @@ protected MultiblockTooltipBuilder createTooltip() { public ITexture[] getTexture(IGregTechTileEntity aBaseMetaTileEntity, ForgeDirection side, ForgeDirection aFacing, int colorIndex, boolean aActive, boolean redstoneLevel) { if (side == aFacing) { - if (aActive) return new ITexture[] { casingTexturePages[0][16], TextureFactory.builder() - .addIcon(OVERLAY_FRONT_SOLAR_FACTORY_ACTIVE) - .extFacing() - .build(), + if (aActive) return new ITexture[] { Textures.BlockIcons.getCasingTextureForId(CASING_INDEX), + TextureFactory.builder() + .addIcon(OVERLAY_FRONT_SOLAR_FACTORY_ACTIVE) + .extFacing() + .build(), TextureFactory.builder() .addIcon(OVERLAY_FRONT_SOLAR_FACTORY_ACTIVE_GLOW) .extFacing() .glow() .build() }; - return new ITexture[] { casingTexturePages[0][16], TextureFactory.builder() + return new ITexture[] { Textures.BlockIcons.getCasingTextureForId(CASING_INDEX), TextureFactory.builder() .addIcon(OVERLAY_FRONT_SOLAR_FACTORY_INACTIVE) .extFacing() .build(), @@ -355,7 +357,7 @@ public ITexture[] getTexture(IGregTechTileEntity aBaseMetaTileEntity, ForgeDirec .glow() .build() }; } - return new ITexture[] { casingTexturePages[0][16] }; + return new ITexture[] { Textures.BlockIcons.getCasingTextureForId(CASING_INDEX) }; } @Override From 0f389f41db83b2b8e8671bf51629828adb56c3a2 Mon Sep 17 00:00:00 2001 From: PureBluez Date: Tue, 24 Dec 2024 14:27:39 -0600 Subject: [PATCH 13/22] adjust tooltip --- .../machines/multi/MTESolarFactory.java | 28 +++++++++---------- 1 file changed, 13 insertions(+), 15 deletions(-) diff --git a/src/main/java/gregtech/common/tileentities/machines/multi/MTESolarFactory.java b/src/main/java/gregtech/common/tileentities/machines/multi/MTESolarFactory.java index f5f5c3ce3f3..25b0b0bd1d2 100644 --- a/src/main/java/gregtech/common/tileentities/machines/multi/MTESolarFactory.java +++ b/src/main/java/gregtech/common/tileentities/machines/multi/MTESolarFactory.java @@ -1,6 +1,5 @@ package gregtech.common.tileentities.machines.multi; -import static bartworks.util.BWTooltipReference.TT; import static com.gtnewhorizon.structurelib.structure.StructureUtility.*; import static gregtech.api.GregTechAPI.sBlockCasings4; import static gregtech.api.enums.HatchElement.*; @@ -12,8 +11,7 @@ import static gregtech.api.util.GTStructureUtility.ofFrame; import static gregtech.api.util.GTUtility.copyAmount; import static gregtech.api.util.GTUtility.copyAmountUnsafe; -import static net.minecraft.util.EnumChatFormatting.BLUE; -import static net.minecraft.util.EnumChatFormatting.DARK_AQUA; +import static net.minecraft.util.EnumChatFormatting.WHITE; import javax.annotation.Nonnull; @@ -316,19 +314,19 @@ protected MultiblockTooltipBuilder createTooltip() { .addInfo("The recipes shown in NEI display the minimum wafer tier required") .addInfo("Parallels are based on Precise Casing Tier") .addInfo("MK-I = 8x, MK-II = 16x, MK-III = 32x, MK-IV = 64x") - .addInfo("Supports " + TT + " energy hatches") + .addTecTechHatchInfo() .beginStructureBlock(7, 10, 9, true) - .addStructureInfo(BLUE + "Imprecise Unit Casings cannot be used") - .addStructureInfo(BLUE + "26 " + DARK_AQUA + "Precise Electronic Unit Casing") - .addStructureInfo(BLUE + "120+ " + DARK_AQUA + "Solid Steel Machine Casings") - .addStructureInfo(BLUE + "24 " + DARK_AQUA + "Niobium-Titanium Frame Boxes") - .addStructureInfo(BLUE + "67 " + DARK_AQUA + "HV+ Glass") - .addStructureInfo(BLUE + "4 " + DARK_AQUA + "Assembling Line Casing") - .addStructureInfo(BLUE + "1+ " + DARK_AQUA + "Input Hatch") - .addStructureInfo(BLUE + "1+ " + DARK_AQUA + "Input Bus") - .addStructureInfo(BLUE + "1+ " + DARK_AQUA + "Output Bus") - .addStructureInfo(BLUE + "1+ " + DARK_AQUA + "Energy Hatch") - .addStructureInfo(BLUE + "1 " + DARK_AQUA + "Maintenance Hatch") + .addStructureInfo(WHITE + "Imprecise Unit Casings cannot be used") + .addCasingInfoRange("Tungstensteel Machine Casing", 120, 142, false) + .addCasingInfoExactly("Any Glass", 67, false) + .addCasingInfoExactly("Precise Electronic Unit Casing", 26, true) + .addCasingInfoExactly("Tungsten Frame Box", 24, false) + .addCasingInfoExactly("Assembling Line Casing", 4, false) + .addInputHatch("Any Tungstensteel Machine Casing") + .addInputBus("Any Tungstensteel Machine Casing") + .addOutputBus("Any Tungstensteel Machine Casing") + .addEnergyHatch("Any Tungstensteel Machine Casing") + .addMaintenanceHatch("Any Tungstensteel Machine Casing") .toolTipFinisher(GTValues.AuthorPureBluez); return tt; } From 43a64cec2fb929250758e74c72255ada4feb5789 Mon Sep 17 00:00:00 2001 From: PureBluez Date: Fri, 27 Dec 2024 11:17:31 -0600 Subject: [PATCH 14/22] stuff - change key string to reflect object - move away from checkProcessing into full gpl - remove unused entry from GTLanguageManager - remove bad overrides in MTESolarFactory --- .../gregtech/api/util/GTLanguageManager.java | 1 - .../gregtech/api/util/GTRecipeConstants.java | 2 +- .../machines/multi/MTESolarFactory.java | 99 ++++++++----------- .../postload/recipes/SolarFactoryRecipes.java | 18 ++-- 4 files changed, 50 insertions(+), 70 deletions(-) diff --git a/src/main/java/gregtech/api/util/GTLanguageManager.java b/src/main/java/gregtech/api/util/GTLanguageManager.java index d52aa456f14..02bbbc99f28 100644 --- a/src/main/java/gregtech/api/util/GTLanguageManager.java +++ b/src/main/java/gregtech/api/util/GTLanguageManager.java @@ -550,7 +550,6 @@ public static void writePlaceholderStrings() { addStringLocalization("Interaction_DESCRIPTION_Index_507", "Safe Mode"); addStringLocalization("Interaction_DESCRIPTION_Index_508", "Requires Stabilized Black Hole"); addStringLocalization("Interaction_DESCRIPTION_Index_509", "Requires HIP Unit"); - addStringLocalization("Interaction_DESCRIPTION_Index_510", "Minimum wafer tier: "); addStringLocalization("Interaction_DESCRIPTION_Index_602", "Use Private Frequency"); addStringLocalization("Interaction_DESCRIPTION_Index_756", "Connectable: "); addStringLocalization("Interaction_DESCRIPTION_Index_ALL", "All"); diff --git a/src/main/java/gregtech/api/util/GTRecipeConstants.java b/src/main/java/gregtech/api/util/GTRecipeConstants.java index 768ac52742c..5ddde7487b4 100644 --- a/src/main/java/gregtech/api/util/GTRecipeConstants.java +++ b/src/main/java/gregtech/api/util/GTRecipeConstants.java @@ -205,7 +205,7 @@ public class GTRecipeConstants { /** * Solar Factory recipe data containing minimum wafer tier and count */ - public static final RecipeMetadataKey SOLAR_FACTORY_WAFER_DATA = SimpleRecipeMetadataKey + public static final RecipeMetadataKey SOLAR_FACTORY_RECIPE_DATA = SimpleRecipeMetadataKey .create(SolarFactoryRecipeData.class, "solar_factory_wafer_data"); /** diff --git a/src/main/java/gregtech/common/tileentities/machines/multi/MTESolarFactory.java b/src/main/java/gregtech/common/tileentities/machines/multi/MTESolarFactory.java index 25b0b0bd1d2..39c20909bd1 100644 --- a/src/main/java/gregtech/common/tileentities/machines/multi/MTESolarFactory.java +++ b/src/main/java/gregtech/common/tileentities/machines/multi/MTESolarFactory.java @@ -8,6 +8,7 @@ import static gregtech.api.enums.Textures.BlockIcons.OVERLAY_FRONT_SOLAR_FACTORY_INACTIVE; import static gregtech.api.enums.Textures.BlockIcons.OVERLAY_FRONT_SOLAR_FACTORY_INACTIVE_GLOW; import static gregtech.api.util.GTStructureUtility.buildHatchAdder; +import static gregtech.api.util.GTStructureUtility.chainAllGlasses; import static gregtech.api.util.GTStructureUtility.ofFrame; import static gregtech.api.util.GTUtility.copyAmount; import static gregtech.api.util.GTUtility.copyAmountUnsafe; @@ -43,7 +44,6 @@ import gregtech.api.logic.ProcessingLogic; import gregtech.api.metatileentity.GregTechTileClientEvents; import gregtech.api.metatileentity.implementations.MTEExtendedPowerMultiBlockBase; -import gregtech.api.multitileentity.multiblock.casing.Glasses; import gregtech.api.recipe.RecipeMap; import gregtech.api.recipe.RecipeMaps; import gregtech.api.recipe.check.CheckRecipeResult; @@ -53,6 +53,7 @@ import gregtech.api.util.GTRecipe; import gregtech.api.util.GTRecipeConstants; import gregtech.api.util.MultiblockTooltipBuilder; +import gregtech.api.util.OverclockCalculator; import gregtech.api.util.ParallelHelper; import gregtech.api.util.recipe.SolarFactoryRecipeData; @@ -67,18 +68,6 @@ public class MTESolarFactory extends MTEExtendedPowerMultiBlockBase> validWafers = ImmutableList.of( Pair.of(ItemList.Circuit_Silicon_Wafer.get(1), 1), @@ -142,7 +131,7 @@ public IMetaTileEntity newMetaEntity(IGregTechTileEntity aTileEntity) { .dot(1) .buildAndChain(onElementPass(MTESolarFactory::onCasingAdded, ofBlock(sBlockCasings4, 0)))) .addElement('D', ofBlock(GregTechAPI.sBlockCasings2, 5)) - .addElement('B', Glasses.chainAllGlasses()) + .addElement('B', chainAllGlasses()) .addElement('E', ofFrame(Materials.Tungsten)) .build(); @@ -209,39 +198,24 @@ protected ItemStack[] calculateNewOutput(ItemStack currentOutput, int seed) { return new ItemStack[] { copyAmountUnsafe(outputSize, currentOutput) }; } - @NotNull - @Override - public CheckRecipeResult checkProcessing() { - setupProcessingLogic(processingLogic); - - CheckRecipeResult result = doCheckRecipe(); - result = postCheckRecipe(result, processingLogic); - // inputs are consumed at this point - updateSlots(); - if (!result.wasSuccessful()) return result; - - mEfficiency = (10000 - (getIdealStatus() - getRepairStatus()) * 1000); - mEfficiencyIncrease = 10000; - mMaxProgresstime = processingLogic.getDuration(); - setEnergyUsage(processingLogic); - - if (minimumTierForRecipe != 0) { - mOutputItems = calculateNewOutput( - processingLogic.getOutputItems()[0], - (foundWaferTier - minimumTierForRecipe)); - } else mOutputItems = processingLogic.getOutputItems(); - - mOutputFluids = processingLogic.getOutputFluids(); - - clearVars(); - - return result; - } - @Override protected ProcessingLogic createProcessingLogic() { return new ProcessingLogic() { + ItemStack foundWaferStack; + int waferAmountInRecipe; + int foundWaferTier; + int minimumTierForRecipe; + boolean shouldMultiplyOutputs = true; + + private void clearVars() { + foundWaferStack = null; + waferAmountInRecipe = 0; + foundWaferTier = 0; + minimumTierForRecipe = 0; + shouldMultiplyOutputs = true; + } + private void findWaferStack() { for (ItemStack items : inputItems) { for (Pair pair : validWafers) { @@ -254,14 +228,29 @@ private void findWaferStack() { } } + @Override + protected @NotNull CheckRecipeResult applyRecipe(@NotNull GTRecipe recipe, @NotNull ParallelHelper helper, + @NotNull OverclockCalculator calculator, @NotNull CheckRecipeResult result) { + result = super.applyRecipe(recipe, helper, calculator, result); + if (shouldMultiplyOutputs) { + // We multiply outputs here since its after parallels are calculated, however this is after void + // protection checks so void protection is not supported. + outputItems = calculateNewOutput(outputItems[0], (foundWaferTier - minimumTierForRecipe)); + } + clearVars(); + return result; + } + @NotNull @Override public CheckRecipeResult validateRecipe(@NotNull GTRecipe recipe) { - SolarFactoryRecipeData data = recipe - .getMetadataOrDefault(GTRecipeConstants.SOLAR_FACTORY_WAFER_DATA, new SolarFactoryRecipeData(0, 0)); + SolarFactoryRecipeData data = recipe.getMetadata(GTRecipeConstants.SOLAR_FACTORY_RECIPE_DATA); + if (data == null) { + shouldMultiplyOutputs = false; + return CheckRecipeResultRegistry.SUCCESSFUL; + } minimumTierForRecipe = data.minimumWaferTier; waferAmountInRecipe = data.minimumWaferCount; - if (minimumTierForRecipe == 0 || waferAmountInRecipe == 0) return CheckRecipeResultRegistry.SUCCESSFUL; findWaferStack(); if (foundWaferStack == null) { clearVars(); @@ -279,16 +268,18 @@ public CheckRecipeResult validateRecipe(@NotNull GTRecipe recipe) { } @Nonnull - private GTRecipe recipeAfterAdjustments(@Nonnull GTRecipe recipe) { + private GTRecipe adjustRecipe(@Nonnull GTRecipe recipe) { GTRecipe tRecipe = recipe.copy(); - tRecipe.mInputs = ArrayUtils.add(tRecipe.mInputs, copyAmount(waferAmountInRecipe, foundWaferStack)); + if (shouldMultiplyOutputs) { + tRecipe.mInputs = ArrayUtils.add(tRecipe.mInputs, copyAmount(waferAmountInRecipe, foundWaferStack)); + } return tRecipe; } @NotNull @Override protected ParallelHelper createParallelHelper(@Nonnull GTRecipe recipe) { - return super.createParallelHelper(recipeAfterAdjustments(recipe)); + return super.createParallelHelper(adjustRecipe(recipe)); } }.setMaxParallelSupplier(this::getMaxParallel); } @@ -378,16 +369,6 @@ public boolean explodesOnComponentBreak(ItemStack aStack) { return false; } - @Override - public boolean supportsBatchMode() { - return true; - } - - @Override - public boolean supportsVoidProtection() { - return true; - } - @Override public boolean supportsInputSeparation() { return true; diff --git a/src/main/java/gregtech/loaders/postload/recipes/SolarFactoryRecipes.java b/src/main/java/gregtech/loaders/postload/recipes/SolarFactoryRecipes.java index 9e267a08565..289105fa288 100644 --- a/src/main/java/gregtech/loaders/postload/recipes/SolarFactoryRecipes.java +++ b/src/main/java/gregtech/loaders/postload/recipes/SolarFactoryRecipes.java @@ -5,7 +5,7 @@ import static gregtech.api.recipe.RecipeMaps.solarFactoryRecipes; import static gregtech.api.util.GTModHandler.getModItem; import static gregtech.api.util.GTRecipeBuilder.SECONDS; -import static gregtech.api.util.GTRecipeConstants.SOLAR_FACTORY_WAFER_DATA; +import static gregtech.api.util.GTRecipeConstants.SOLAR_FACTORY_RECIPE_DATA; import net.minecraftforge.fluids.Fluid; import net.minecraftforge.fluids.FluidRegistry; @@ -170,7 +170,7 @@ public void run() { .fluidInputs(Materials.Polytetrafluoroethylene.getMolten(288)) .duration(10 * SECONDS) .eut(TierEU.RECIPE_HV) - .metadata(SOLAR_FACTORY_WAFER_DATA, new SolarFactoryRecipeData(2, 4)) + .metadata(SOLAR_FACTORY_RECIPE_DATA, new SolarFactoryRecipeData(2, 4)) .hidden() .addTo(solarFactoryRecipes); @@ -184,7 +184,7 @@ public void run() { .fluidInputs(Materials.Epoxid.getMolten(576)) .duration(10 * SECONDS) .eut(TierEU.RECIPE_EV) - .metadata(SOLAR_FACTORY_WAFER_DATA, new SolarFactoryRecipeData(2, 4)) + .metadata(SOLAR_FACTORY_RECIPE_DATA, new SolarFactoryRecipeData(2, 4)) .hidden() .addTo(solarFactoryRecipes); @@ -199,7 +199,7 @@ public void run() { .fluidInputs(Materials.Polybenzimidazole.getMolten(576)) .duration(10 * SECONDS) .eut(TierEU.RECIPE_IV) - .metadata(SOLAR_FACTORY_WAFER_DATA, new SolarFactoryRecipeData(2, 4)) + .metadata(SOLAR_FACTORY_RECIPE_DATA, new SolarFactoryRecipeData(2, 4)) .hidden() .addTo(solarFactoryRecipes); @@ -214,7 +214,7 @@ public void run() { .fluidInputs(Materials.Polybenzimidazole.getMolten(576)) .duration(10 * SECONDS) .eut(TierEU.RECIPE_LuV) - .metadata(SOLAR_FACTORY_WAFER_DATA, new SolarFactoryRecipeData(3, 4)) + .metadata(SOLAR_FACTORY_RECIPE_DATA, new SolarFactoryRecipeData(3, 4)) .hidden() .addTo(solarFactoryRecipes); @@ -229,7 +229,7 @@ public void run() { .fluidInputs(Materials.Polybenzimidazole.getMolten(1152)) .duration(10 * SECONDS) .eut(TierEU.RECIPE_ZPM) - .metadata(SOLAR_FACTORY_WAFER_DATA, new SolarFactoryRecipeData(3, 8)) + .metadata(SOLAR_FACTORY_RECIPE_DATA, new SolarFactoryRecipeData(3, 8)) .hidden() .addTo(solarFactoryRecipes); @@ -246,7 +246,7 @@ public void run() { .fluidInputs(Materials.Polybenzimidazole.getMolten(1728)) .duration(10 * SECONDS) .eut(TierEU.RECIPE_UV) - .metadata(SOLAR_FACTORY_WAFER_DATA, new SolarFactoryRecipeData(4, 8)) + .metadata(SOLAR_FACTORY_RECIPE_DATA, new SolarFactoryRecipeData(4, 8)) .hidden() .addTo(solarFactoryRecipes); @@ -262,7 +262,7 @@ public void run() { .fluidInputs(Materials.Polybenzimidazole.getMolten(2304)) .duration(10 * SECONDS) .eut(TierEU.RECIPE_UHV) - .metadata(SOLAR_FACTORY_WAFER_DATA, new SolarFactoryRecipeData(5, 8)) + .metadata(SOLAR_FACTORY_RECIPE_DATA, new SolarFactoryRecipeData(5, 8)) .hidden() .addTo(solarFactoryRecipes); @@ -280,7 +280,7 @@ public void run() { .fluidInputs(new FluidStack(solderIndalloy, 1152)) .duration(10 * SECONDS) .eut(TierEU.RECIPE_UEV) - .metadata(SOLAR_FACTORY_WAFER_DATA, new SolarFactoryRecipeData(5, 8)) + .metadata(SOLAR_FACTORY_RECIPE_DATA, new SolarFactoryRecipeData(5, 8)) .hidden() .addTo(solarFactoryRecipes); } From ad236923acedc2d7437eca73813d0d9a301d782f Mon Sep 17 00:00:00 2001 From: PureBluez Date: Fri, 27 Dec 2024 13:50:04 -0600 Subject: [PATCH 15/22] remove solar factory recipes (see related coremod pr for where they went) --- .../machines/multi/MTESolarFactory.java | 1 + .../loaders/postload/MachineRecipeLoader.java | 2 - .../postload/recipes/SolarFactoryRecipes.java | 287 ------------------ 3 files changed, 1 insertion(+), 289 deletions(-) delete mode 100644 src/main/java/gregtech/loaders/postload/recipes/SolarFactoryRecipes.java diff --git a/src/main/java/gregtech/common/tileentities/machines/multi/MTESolarFactory.java b/src/main/java/gregtech/common/tileentities/machines/multi/MTESolarFactory.java index 39c20909bd1..c9dca7215f7 100644 --- a/src/main/java/gregtech/common/tileentities/machines/multi/MTESolarFactory.java +++ b/src/main/java/gregtech/common/tileentities/machines/multi/MTESolarFactory.java @@ -291,6 +291,7 @@ protected int getMaxParallel() { @Override public RecipeMap getRecipeMap() { + // The recipes for this map are added in NewHorizonsCoreMod return RecipeMaps.solarFactoryRecipes; } diff --git a/src/main/java/gregtech/loaders/postload/MachineRecipeLoader.java b/src/main/java/gregtech/loaders/postload/MachineRecipeLoader.java index 30c029486c4..c64ea6cf7b5 100644 --- a/src/main/java/gregtech/loaders/postload/MachineRecipeLoader.java +++ b/src/main/java/gregtech/loaders/postload/MachineRecipeLoader.java @@ -51,7 +51,6 @@ import gregtech.loaders.postload.recipes.SifterRecipes; import gregtech.loaders.postload.recipes.SlicerRecipes; import gregtech.loaders.postload.recipes.SmelterRecipes; -import gregtech.loaders.postload.recipes.SolarFactoryRecipes; import gregtech.loaders.postload.recipes.ThaumcraftRecipes; import gregtech.loaders.postload.recipes.ThermalCentrifugeRecipes; import gregtech.loaders.postload.recipes.TranscendentPlasmaMixerRecipes; @@ -113,7 +112,6 @@ public void run() { new SifterRecipes().run(); new SlicerRecipes().run(); new SmelterRecipes().run(); - new SolarFactoryRecipes().run(); new ThaumcraftRecipes().run(); new ThermalCentrifugeRecipes().run(); new VacuumFreezerRecipes().run(); diff --git a/src/main/java/gregtech/loaders/postload/recipes/SolarFactoryRecipes.java b/src/main/java/gregtech/loaders/postload/recipes/SolarFactoryRecipes.java deleted file mode 100644 index 289105fa288..00000000000 --- a/src/main/java/gregtech/loaders/postload/recipes/SolarFactoryRecipes.java +++ /dev/null @@ -1,287 +0,0 @@ -package gregtech.loaders.postload.recipes; - -import static gregtech.api.enums.Mods.NewHorizonsCoreMod; -import static gregtech.api.enums.Mods.SuperSolarPanels; -import static gregtech.api.recipe.RecipeMaps.solarFactoryRecipes; -import static gregtech.api.util.GTModHandler.getModItem; -import static gregtech.api.util.GTRecipeBuilder.SECONDS; -import static gregtech.api.util.GTRecipeConstants.SOLAR_FACTORY_RECIPE_DATA; - -import net.minecraftforge.fluids.Fluid; -import net.minecraftforge.fluids.FluidRegistry; -import net.minecraftforge.fluids.FluidStack; - -import gregtech.api.enums.GTValues; -import gregtech.api.enums.ItemList; -import gregtech.api.enums.Materials; -import gregtech.api.enums.OrePrefixes; -import gregtech.api.enums.TierEU; -import gregtech.api.util.GTOreDictUnificator; -import gregtech.api.util.recipe.SolarFactoryRecipeData; - -// If you want to make a new recipe for Solar Factory, you'll need to make a hidden one and a fake one. -// The fake one should include the wafer you use, the hidden one without it. Hidden recipes must have a metadata value. - -// Recipe metadata values represent the minimum tier and the amount of wafers respectively. -// Metadata is only required on the hidden recipes. - -// If the recipe you are making doesn't use a wafer, just make it without any metadata. -public class SolarFactoryRecipes implements Runnable { - - private final Fluid solderIndalloy; - - public SolarFactoryRecipes() { - solderIndalloy = FluidRegistry.getFluid("molten.indalloy140"); - } - - public void run() { - - // Fake recipes for NEI - GTValues.RA.stdBuilder() - .itemInputs( - getModItem(NewHorizonsCoreMod.ID, "item.IrradiantReinforcedAluminiumPlate", 2), - ItemList.Circuit_Silicon_Wafer2.get(4), - GTOreDictUnificator.get(OrePrefixes.wireGt01, Materials.SuperconductorMV, 4), - GTOreDictUnificator.get(OrePrefixes.circuit.get(Materials.HV), 2)) - .itemOutputs(ItemList.Cover_SolarPanel_LV.get(1)) - .fluidInputs(Materials.Polytetrafluoroethylene.getMolten(288)) - .duration(10 * SECONDS) - .eut(TierEU.RECIPE_HV) - .fake() - .addTo(solarFactoryRecipes); - - GTValues.RA.stdBuilder() - .itemInputs( - getModItem(NewHorizonsCoreMod.ID, "item.IrradiantReinforcedTitaniumPlate", 2), - ItemList.Circuit_Silicon_Wafer2.get(4), - ItemList.Circuit_Chip_ULPIC.get(4), - GTOreDictUnificator.get(OrePrefixes.wireGt01, Materials.SuperconductorHV, 4), - GTOreDictUnificator.get(OrePrefixes.circuit.get(Materials.EV), 2)) - .itemOutputs(ItemList.Cover_SolarPanel_MV.get(1)) - .fluidInputs(Materials.Epoxid.getMolten(576)) - .duration(10 * SECONDS) - .eut(TierEU.RECIPE_EV) - .fake() - .addTo(solarFactoryRecipes); - - GTValues.RA.stdBuilder() - .itemInputs( - getModItem(NewHorizonsCoreMod.ID, "item.IrradiantReinforcedTungstenPlate", 4), - ItemList.Circuit_Silicon_Wafer2.get(4), - ItemList.Circuit_Chip_LPIC.get(4), - GTOreDictUnificator.get(OrePrefixes.wireGt01, Materials.SuperconductorEV, 8), - GTOreDictUnificator.get(OrePrefixes.circuit.get(Materials.IV), 4), - GTOreDictUnificator.get(OrePrefixes.plate.get(Materials.IndiumGalliumPhosphide), 8)) - .itemOutputs(ItemList.Cover_SolarPanel_HV.get(1)) - .fluidInputs(Materials.Epoxid.getMolten(1152)) - .duration(10 * SECONDS) - .eut(TierEU.RECIPE_IV) - .fake() - .addTo(solarFactoryRecipes); - - GTValues.RA.stdBuilder() - .itemInputs( - getModItem(NewHorizonsCoreMod.ID, "item.IrradiantReinforcedTungstenSteelPlate", 4), - ItemList.Circuit_Silicon_Wafer3.get(4), - ItemList.Circuit_Chip_PIC.get(4), - GTOreDictUnificator.get(OrePrefixes.wireGt01, Materials.SuperconductorIV, 8), - GTOreDictUnificator.get(OrePrefixes.circuit.get(Materials.LuV), 4), - GTOreDictUnificator.get(OrePrefixes.plate.get(Materials.SiliconSG), 16)) - .itemOutputs(ItemList.Cover_SolarPanel_EV.get(1)) - .fluidInputs(Materials.Polybenzimidazole.getMolten(576)) - .duration(10 * SECONDS) - .eut(TierEU.RECIPE_LuV) - .fake() - .addTo(solarFactoryRecipes); - - GTValues.RA.stdBuilder() - .itemInputs( - getModItem(NewHorizonsCoreMod.ID, "item.IrradiantReinforcedChromePlate", 4), - ItemList.Circuit_Silicon_Wafer3.get(8), - ItemList.Circuit_Chip_HPIC.get(4), - GTOreDictUnificator.get(OrePrefixes.wireGt01, Materials.SuperconductorLuV, 10), - GTOreDictUnificator.get(OrePrefixes.circuit.get(Materials.ZPM), 4), - GTOreDictUnificator.get(OrePrefixes.block.get(Materials.SiliconSG), 4)) - .itemOutputs(ItemList.Cover_SolarPanel_IV.get(1)) - .fluidInputs(Materials.Polybenzimidazole.getMolten(1152)) - .duration(10 * SECONDS) - .eut(TierEU.RECIPE_ZPM) - .fake() - .addTo(solarFactoryRecipes); - - GTValues.RA.stdBuilder() - .itemInputs( - getModItem(NewHorizonsCoreMod.ID, "item.IrradiantReinforcedChromePlate", 4), - ItemList.Circuit_Silicon_Wafer4.get(8), - ItemList.Circuit_Chip_UHPIC.get(8), - GTOreDictUnificator.get(OrePrefixes.wireGt01, Materials.SuperconductorZPM, 24), - GTOreDictUnificator.get(OrePrefixes.circuit.get(Materials.UV), 2), - GTOreDictUnificator.get(OrePrefixes.circuit.get(Materials.ZPM), 6), - GTOreDictUnificator.get(OrePrefixes.block.get(Materials.SiliconSG), 8), - getModItem(SuperSolarPanels.ID, "solarsplitter", 4, 0)) - .itemOutputs(ItemList.Cover_SolarPanel_LuV.get(1)) - .fluidInputs(Materials.Polybenzimidazole.getMolten(1728)) - .duration(10 * SECONDS) - .eut(TierEU.RECIPE_UV) - .fake() - .addTo(solarFactoryRecipes); - - GTValues.RA.stdBuilder() - .itemInputs( - getModItem(NewHorizonsCoreMod.ID, "item.IrradiantReinforcedNaquadriaPlate", 8), - ItemList.Circuit_Silicon_Wafer5.get(8), - ItemList.Circuit_Wafer_QPIC.get(4), - ItemList.Circuit_Chip_NPIC.get(8), - GTOreDictUnificator.get(OrePrefixes.wireGt01, Materials.SuperconductorUV, 32), - GTOreDictUnificator.get(OrePrefixes.circuit.get(Materials.UHV), 2), - GTOreDictUnificator.get(OrePrefixes.circuit.get(Materials.UV), 4)) - .itemOutputs(ItemList.Cover_SolarPanel_ZPM.get(1)) - .fluidInputs(Materials.Polybenzimidazole.getMolten(2304)) - .duration(10 * SECONDS) - .eut(TierEU.RECIPE_UHV) - .fake() - .addTo(solarFactoryRecipes); - - GTValues.RA.stdBuilder() - .itemInputs( - getModItem(NewHorizonsCoreMod.ID, "item.IrradiantReinforcedNaquadriaPlate", 8), - ItemList.Circuit_Silicon_Wafer5.get(8), - getModItem(NewHorizonsCoreMod.ID, "item.PicoWafer", 8), - ItemList.Circuit_Chip_PPIC.get(8), - ItemList.Circuit_Chip_CrystalSoC2.get(8), - GTOreDictUnificator.get(OrePrefixes.wireGt04, Materials.SuperconductorUHV, 12), - GTOreDictUnificator.get(OrePrefixes.circuit.get(Materials.UEV), 2), - GTOreDictUnificator.get(OrePrefixes.circuit.get(Materials.UHV), 4), - GTOreDictUnificator.get(OrePrefixes.plateSuperdense.get(Materials.SiliconSG), 4)) - .itemOutputs(ItemList.Cover_SolarPanel_UV.get(1)) - .fluidInputs(new FluidStack(solderIndalloy, 1152)) - .duration(10 * SECONDS) - .eut(TierEU.RECIPE_UEV) - .fake() - .addTo(solarFactoryRecipes); - - // Real recipes for the multi, hidden from NEI - GTValues.RA.stdBuilder() - .itemInputs( - getModItem(NewHorizonsCoreMod.ID, "item.IrradiantReinforcedAluminiumPlate", 2), - GTOreDictUnificator.get(OrePrefixes.wireGt01, Materials.SuperconductorMV, 4), - GTOreDictUnificator.get(OrePrefixes.circuit.get(Materials.HV), 2)) - .itemOutputs(ItemList.Cover_SolarPanel_LV.get(1)) - .fluidInputs(Materials.Polytetrafluoroethylene.getMolten(288)) - .duration(10 * SECONDS) - .eut(TierEU.RECIPE_HV) - .metadata(SOLAR_FACTORY_RECIPE_DATA, new SolarFactoryRecipeData(2, 4)) - .hidden() - .addTo(solarFactoryRecipes); - - GTValues.RA.stdBuilder() - .itemInputs( - getModItem(NewHorizonsCoreMod.ID, "item.IrradiantReinforcedTitaniumPlate", 2), - ItemList.Circuit_Chip_ULPIC.get(4), - GTOreDictUnificator.get(OrePrefixes.wireGt01, Materials.SuperconductorHV, 4), - GTOreDictUnificator.get(OrePrefixes.circuit.get(Materials.EV), 2)) - .itemOutputs(ItemList.Cover_SolarPanel_MV.get(1)) - .fluidInputs(Materials.Epoxid.getMolten(576)) - .duration(10 * SECONDS) - .eut(TierEU.RECIPE_EV) - .metadata(SOLAR_FACTORY_RECIPE_DATA, new SolarFactoryRecipeData(2, 4)) - .hidden() - .addTo(solarFactoryRecipes); - - GTValues.RA.stdBuilder() - .itemInputs( - getModItem(NewHorizonsCoreMod.ID, "item.IrradiantReinforcedTungstenPlate", 4), - ItemList.Circuit_Chip_LPIC.get(4), - GTOreDictUnificator.get(OrePrefixes.wireGt01, Materials.SuperconductorEV, 8), - GTOreDictUnificator.get(OrePrefixes.circuit.get(Materials.IV), 4), - GTOreDictUnificator.get(OrePrefixes.plate.get(Materials.IndiumGalliumPhosphide), 8)) - .itemOutputs(ItemList.Cover_SolarPanel_HV.get(1)) - .fluidInputs(Materials.Polybenzimidazole.getMolten(576)) - .duration(10 * SECONDS) - .eut(TierEU.RECIPE_IV) - .metadata(SOLAR_FACTORY_RECIPE_DATA, new SolarFactoryRecipeData(2, 4)) - .hidden() - .addTo(solarFactoryRecipes); - - GTValues.RA.stdBuilder() - .itemInputs( - getModItem(NewHorizonsCoreMod.ID, "item.IrradiantReinforcedTungstenSteelPlate", 4), - ItemList.Circuit_Chip_PIC.get(4), - GTOreDictUnificator.get(OrePrefixes.wireGt01, Materials.SuperconductorIV, 8), - GTOreDictUnificator.get(OrePrefixes.circuit.get(Materials.LuV), 4), - GTOreDictUnificator.get(OrePrefixes.plate.get(Materials.SiliconSG), 16)) - .itemOutputs(ItemList.Cover_SolarPanel_EV.get(1)) - .fluidInputs(Materials.Polybenzimidazole.getMolten(576)) - .duration(10 * SECONDS) - .eut(TierEU.RECIPE_LuV) - .metadata(SOLAR_FACTORY_RECIPE_DATA, new SolarFactoryRecipeData(3, 4)) - .hidden() - .addTo(solarFactoryRecipes); - - GTValues.RA.stdBuilder() - .itemInputs( - getModItem(NewHorizonsCoreMod.ID, "item.IrradiantReinforcedChromePlate", 4), - ItemList.Circuit_Chip_HPIC.get(4), - GTOreDictUnificator.get(OrePrefixes.wireGt01, Materials.SuperconductorLuV, 10), - GTOreDictUnificator.get(OrePrefixes.circuit.get(Materials.ZPM), 4), - GTOreDictUnificator.get(OrePrefixes.block.get(Materials.SiliconSG), 4)) - .itemOutputs(ItemList.Cover_SolarPanel_IV.get(1)) - .fluidInputs(Materials.Polybenzimidazole.getMolten(1152)) - .duration(10 * SECONDS) - .eut(TierEU.RECIPE_ZPM) - .metadata(SOLAR_FACTORY_RECIPE_DATA, new SolarFactoryRecipeData(3, 8)) - .hidden() - .addTo(solarFactoryRecipes); - - GTValues.RA.stdBuilder() - .itemInputs( - getModItem(NewHorizonsCoreMod.ID, "item.IrradiantReinforcedChromePlate", 4), - ItemList.Circuit_Chip_UHPIC.get(8), - GTOreDictUnificator.get(OrePrefixes.wireGt01, Materials.SuperconductorZPM, 24), - GTOreDictUnificator.get(OrePrefixes.circuit.get(Materials.UV), 2), - GTOreDictUnificator.get(OrePrefixes.circuit.get(Materials.ZPM), 6), - GTOreDictUnificator.get(OrePrefixes.block.get(Materials.SiliconSG), 8), - getModItem(SuperSolarPanels.ID, "solarsplitter", 4, 0)) - .itemOutputs(ItemList.Cover_SolarPanel_LuV.get(1)) - .fluidInputs(Materials.Polybenzimidazole.getMolten(1728)) - .duration(10 * SECONDS) - .eut(TierEU.RECIPE_UV) - .metadata(SOLAR_FACTORY_RECIPE_DATA, new SolarFactoryRecipeData(4, 8)) - .hidden() - .addTo(solarFactoryRecipes); - - GTValues.RA.stdBuilder() - .itemInputs( - getModItem(NewHorizonsCoreMod.ID, "item.IrradiantReinforcedNaquadriaPlate", 8), - ItemList.Circuit_Wafer_QPIC.get(4), - ItemList.Circuit_Chip_NPIC.get(8), - GTOreDictUnificator.get(OrePrefixes.wireGt01, Materials.SuperconductorUV, 32), - GTOreDictUnificator.get(OrePrefixes.circuit.get(Materials.UHV), 2), - GTOreDictUnificator.get(OrePrefixes.circuit.get(Materials.UV), 4)) - .itemOutputs(ItemList.Cover_SolarPanel_ZPM.get(1)) - .fluidInputs(Materials.Polybenzimidazole.getMolten(2304)) - .duration(10 * SECONDS) - .eut(TierEU.RECIPE_UHV) - .metadata(SOLAR_FACTORY_RECIPE_DATA, new SolarFactoryRecipeData(5, 8)) - .hidden() - .addTo(solarFactoryRecipes); - - GTValues.RA.stdBuilder() - .itemInputs( - getModItem(NewHorizonsCoreMod.ID, "item.IrradiantReinforcedNaquadriaPlate", 8), - getModItem(NewHorizonsCoreMod.ID, "item.PicoWafer", 8), - ItemList.Circuit_Chip_PPIC.get(8), - ItemList.Circuit_Chip_CrystalSoC2.get(8), - GTOreDictUnificator.get(OrePrefixes.wireGt04, Materials.SuperconductorUHV, 12), - GTOreDictUnificator.get(OrePrefixes.circuit.get(Materials.UEV), 2), - GTOreDictUnificator.get(OrePrefixes.circuit.get(Materials.UHV), 4), - GTOreDictUnificator.get(OrePrefixes.plateSuperdense.get(Materials.SiliconSG), 4)) - .itemOutputs(ItemList.Cover_SolarPanel_UV.get(1)) - .fluidInputs(new FluidStack(solderIndalloy, 1152)) - .duration(10 * SECONDS) - .eut(TierEU.RECIPE_UEV) - .metadata(SOLAR_FACTORY_RECIPE_DATA, new SolarFactoryRecipeData(5, 8)) - .hidden() - .addTo(solarFactoryRecipes); - } -} From ed844e2320270180456b3a545b82b8dd01ce58ee Mon Sep 17 00:00:00 2001 From: PureBluez Date: Mon, 30 Dec 2024 14:26:42 -0600 Subject: [PATCH 16/22] The mantle runs away --- .../java/gregtech/api/recipe/RecipeMaps.java | 8 +++++- .../metadata/SolarFactoryRecipeDataKey.java | 26 +++++++++++++++++++ .../gregtech/api/util/GTLanguageManager.java | 1 + .../gregtech/api/util/GTRecipeConstants.java | 7 ----- .../util/recipe/SolarFactoryRecipeData.java | 17 +++++++++++- .../machines/multi/MTESolarFactory.java | 4 +-- 6 files changed, 52 insertions(+), 11 deletions(-) create mode 100644 src/main/java/gregtech/api/recipe/metadata/SolarFactoryRecipeDataKey.java diff --git a/src/main/java/gregtech/api/recipe/RecipeMaps.java b/src/main/java/gregtech/api/recipe/RecipeMaps.java index f9f13afb078..84912e77a8b 100644 --- a/src/main/java/gregtech/api/recipe/RecipeMaps.java +++ b/src/main/java/gregtech/api/recipe/RecipeMaps.java @@ -832,8 +832,14 @@ && isArrayEmptyOrNull(b.getFluidOutputs()) .disableOptimize() .build(); public static final RecipeMap solarFactoryRecipes = RecipeMapBuilder.of("gt.recipe.solarfactory") - .maxIO(9, 1, 1, 0) + .maxIO(9, 1, 3, 0) .minInputs(1, 0) + // .neiRecipeComparator( + // Comparator + // .comparing( + // recipe -> recipe + // .getMetadataOrDefault(SolarFactoryRecipeDataKey.INSTANCE, new SolarFactoryRecipeData(0, 0, 0))) + // .thenComparing(GTRecipe::compareTo)) .build(); public static final RecipeMap wiremillRecipes = RecipeMapBuilder.of("gt.recipe.wiremill") .maxIO(2, 1, 0, 0) diff --git a/src/main/java/gregtech/api/recipe/metadata/SolarFactoryRecipeDataKey.java b/src/main/java/gregtech/api/recipe/metadata/SolarFactoryRecipeDataKey.java new file mode 100644 index 00000000000..e53bdceb241 --- /dev/null +++ b/src/main/java/gregtech/api/recipe/metadata/SolarFactoryRecipeDataKey.java @@ -0,0 +1,26 @@ +package gregtech.api.recipe.metadata; + +import static gregtech.api.util.GTUtility.trans; + +import javax.annotation.Nullable; + +import gregtech.api.recipe.RecipeMetadataKey; +import gregtech.api.util.recipe.SolarFactoryRecipeData; +import gregtech.nei.RecipeDisplayInfo; + +public class SolarFactoryRecipeDataKey extends RecipeMetadataKey { + + private SolarFactoryRecipeDataKey() { + super(SolarFactoryRecipeData.class, "solar_factory_wafer_data"); + } + + public static final SolarFactoryRecipeDataKey INSTANCE = new SolarFactoryRecipeDataKey(); + + @Override + public void drawInfo(RecipeDisplayInfo recipeInfo, @Nullable Object value) { + SolarFactoryRecipeData metadata = cast(value); + if (metadata.tierRequired != 0) { + recipeInfo.drawText(trans("337", "Solar Factory Tier required: ") + metadata.tierRequired); + } + } +} diff --git a/src/main/java/gregtech/api/util/GTLanguageManager.java b/src/main/java/gregtech/api/util/GTLanguageManager.java index 02bbbc99f28..2d46dd0eda9 100644 --- a/src/main/java/gregtech/api/util/GTLanguageManager.java +++ b/src/main/java/gregtech/api/util/GTLanguageManager.java @@ -550,6 +550,7 @@ public static void writePlaceholderStrings() { addStringLocalization("Interaction_DESCRIPTION_Index_507", "Safe Mode"); addStringLocalization("Interaction_DESCRIPTION_Index_508", "Requires Stabilized Black Hole"); addStringLocalization("Interaction_DESCRIPTION_Index_509", "Requires HIP Unit"); + addStringLocalization("Interaction_DESCRIPTION_Index_510", "Solar Factory Tier required: "); addStringLocalization("Interaction_DESCRIPTION_Index_602", "Use Private Frequency"); addStringLocalization("Interaction_DESCRIPTION_Index_756", "Connectable: "); addStringLocalization("Interaction_DESCRIPTION_Index_ALL", "All"); diff --git a/src/main/java/gregtech/api/util/GTRecipeConstants.java b/src/main/java/gregtech/api/util/GTRecipeConstants.java index 5ddde7487b4..9b7916d5126 100644 --- a/src/main/java/gregtech/api/util/GTRecipeConstants.java +++ b/src/main/java/gregtech/api/util/GTRecipeConstants.java @@ -27,7 +27,6 @@ import gregtech.api.recipe.RecipeMaps; import gregtech.api.recipe.RecipeMetadataKey; import gregtech.api.recipe.metadata.SimpleRecipeMetadataKey; -import gregtech.api.util.recipe.SolarFactoryRecipeData; import gregtech.common.items.IDMetaItem03; import gregtech.common.items.MetaGeneratedItem03; import gtnhlanth.common.item.ItemPhotolithographicMask; @@ -202,12 +201,6 @@ public class GTRecipeConstants { public static final RecipeMetadataKey COAL_CASING_TIER = SimpleRecipeMetadataKey .create(Integer.class, "coal_casing_tier"); - /** - * Solar Factory recipe data containing minimum wafer tier and count - */ - public static final RecipeMetadataKey SOLAR_FACTORY_RECIPE_DATA = SimpleRecipeMetadataKey - .create(SolarFactoryRecipeData.class, "solar_factory_wafer_data"); - /** * LFTR output power. */ diff --git a/src/main/java/gregtech/api/util/recipe/SolarFactoryRecipeData.java b/src/main/java/gregtech/api/util/recipe/SolarFactoryRecipeData.java index b74ec89d2a5..f480ef6dd65 100644 --- a/src/main/java/gregtech/api/util/recipe/SolarFactoryRecipeData.java +++ b/src/main/java/gregtech/api/util/recipe/SolarFactoryRecipeData.java @@ -1,12 +1,27 @@ package gregtech.api.util.recipe; -public class SolarFactoryRecipeData { +import org.jetbrains.annotations.NotNull; + +public class SolarFactoryRecipeData implements Comparable { public final int minimumWaferTier; public final int minimumWaferCount; + public final int tierRequired; public SolarFactoryRecipeData(int minimumWaferTier, int minimumWaferCount) { this.minimumWaferTier = minimumWaferTier; this.minimumWaferCount = minimumWaferCount; + this.tierRequired = 0; + } + + public SolarFactoryRecipeData(int minimumWaferTier, int minimumWaferCount, int tierRequired) { + this.minimumWaferTier = minimumWaferTier; + this.minimumWaferCount = minimumWaferCount; + this.tierRequired = tierRequired; + } + + @Override + public int compareTo(@NotNull SolarFactoryRecipeData o) { + return 0; } } diff --git a/src/main/java/gregtech/common/tileentities/machines/multi/MTESolarFactory.java b/src/main/java/gregtech/common/tileentities/machines/multi/MTESolarFactory.java index c9dca7215f7..189dbc77a83 100644 --- a/src/main/java/gregtech/common/tileentities/machines/multi/MTESolarFactory.java +++ b/src/main/java/gregtech/common/tileentities/machines/multi/MTESolarFactory.java @@ -49,9 +49,9 @@ import gregtech.api.recipe.check.CheckRecipeResult; import gregtech.api.recipe.check.CheckRecipeResultRegistry; import gregtech.api.recipe.check.SimpleCheckRecipeResult; +import gregtech.api.recipe.metadata.SolarFactoryRecipeDataKey; import gregtech.api.render.TextureFactory; import gregtech.api.util.GTRecipe; -import gregtech.api.util.GTRecipeConstants; import gregtech.api.util.MultiblockTooltipBuilder; import gregtech.api.util.OverclockCalculator; import gregtech.api.util.ParallelHelper; @@ -244,7 +244,7 @@ private void findWaferStack() { @NotNull @Override public CheckRecipeResult validateRecipe(@NotNull GTRecipe recipe) { - SolarFactoryRecipeData data = recipe.getMetadata(GTRecipeConstants.SOLAR_FACTORY_RECIPE_DATA); + SolarFactoryRecipeData data = recipe.getMetadata(SolarFactoryRecipeDataKey.INSTANCE); if (data == null) { shouldMultiplyOutputs = false; return CheckRecipeResultRegistry.SUCCESSFUL; From 35239355206343c585613b8a1ff1a96ef9883f95 Mon Sep 17 00:00:00 2001 From: PureBluez Date: Sun, 12 Jan 2025 14:36:20 -0600 Subject: [PATCH 17/22] implement framework for the new tiers structures and casings are very temporary --- .../metadata/SolarFactoryRecipeDataKey.java | 2 +- .../gregtech/api/util/GTLanguageManager.java | 2 +- .../machines/multi/MTESolarFactory.java | 132 +++++++++++++----- 3 files changed, 101 insertions(+), 35 deletions(-) diff --git a/src/main/java/gregtech/api/recipe/metadata/SolarFactoryRecipeDataKey.java b/src/main/java/gregtech/api/recipe/metadata/SolarFactoryRecipeDataKey.java index e53bdceb241..687a64b1bbf 100644 --- a/src/main/java/gregtech/api/recipe/metadata/SolarFactoryRecipeDataKey.java +++ b/src/main/java/gregtech/api/recipe/metadata/SolarFactoryRecipeDataKey.java @@ -20,7 +20,7 @@ private SolarFactoryRecipeDataKey() { public void drawInfo(RecipeDisplayInfo recipeInfo, @Nullable Object value) { SolarFactoryRecipeData metadata = cast(value); if (metadata.tierRequired != 0) { - recipeInfo.drawText(trans("337", "Solar Factory Tier required: ") + metadata.tierRequired); + recipeInfo.drawText(trans("510", "Tier required: ") + metadata.tierRequired); } } } diff --git a/src/main/java/gregtech/api/util/GTLanguageManager.java b/src/main/java/gregtech/api/util/GTLanguageManager.java index 2d46dd0eda9..998861a2975 100644 --- a/src/main/java/gregtech/api/util/GTLanguageManager.java +++ b/src/main/java/gregtech/api/util/GTLanguageManager.java @@ -550,7 +550,7 @@ public static void writePlaceholderStrings() { addStringLocalization("Interaction_DESCRIPTION_Index_507", "Safe Mode"); addStringLocalization("Interaction_DESCRIPTION_Index_508", "Requires Stabilized Black Hole"); addStringLocalization("Interaction_DESCRIPTION_Index_509", "Requires HIP Unit"); - addStringLocalization("Interaction_DESCRIPTION_Index_510", "Solar Factory Tier required: "); + addStringLocalization("Interaction_DESCRIPTION_Index_510", "Tier required: "); addStringLocalization("Interaction_DESCRIPTION_Index_602", "Use Private Frequency"); addStringLocalization("Interaction_DESCRIPTION_Index_756", "Connectable: "); addStringLocalization("Interaction_DESCRIPTION_Index_ALL", "All"); diff --git a/src/main/java/gregtech/common/tileentities/machines/multi/MTESolarFactory.java b/src/main/java/gregtech/common/tileentities/machines/multi/MTESolarFactory.java index 189dbc77a83..da92cf3ad85 100644 --- a/src/main/java/gregtech/common/tileentities/machines/multi/MTESolarFactory.java +++ b/src/main/java/gregtech/common/tileentities/machines/multi/MTESolarFactory.java @@ -30,7 +30,6 @@ import com.gtnewhorizon.structurelib.structure.IStructureDefinition; import com.gtnewhorizon.structurelib.structure.ISurvivalBuildEnvironment; import com.gtnewhorizon.structurelib.structure.StructureDefinition; -import com.gtnewhorizon.structurelib.structure.StructureUtility; import goodgenerator.loader.Loaders; import gregtech.api.GregTechAPI; @@ -61,7 +60,10 @@ public class MTESolarFactory extends MTEExtendedPowerMultiBlockBase multiDefinition = null; - private static final int CASING_INDEX = 48; + private static final int CASING_T1_INDEX = 17; + private static final int CASING_T2_INDEX = 48; + private static final int CASING_T3_INDEX = 16; + int mTier; int casingAmount; int casingTier; @@ -91,11 +93,16 @@ public IMetaTileEntity newMetaEntity(IGregTechTileEntity aTileEntity) { return new MTESolarFactory(mName); } - private static final String STRUCTURE_PIECE_MAIN = "main"; + private static final String STRUCTURE_TIER_1 = "t1"; + private static final String STRUCTURE_TIER_2 = "t2"; + private static final String STRUCTURE_TIER_3 = "t3"; private static final IStructureDefinition STRUCTURE_DEFINITION = StructureDefinition .builder() .addShape( - STRUCTURE_PIECE_MAIN, + STRUCTURE_TIER_1, + new String[][] { { "YYY", "Y~Y", "YYY" }, { "YYY", "Y Y", "YYY" }, { "YYY", "YYY", "YYY" } }) + .addShape( + STRUCTURE_TIER_2, transpose( new String[][] { { " CCC ", " CCFCC ", " CCFFFCC ", "CCFFFFFCC", " CCFFFCC ", " CCFCC ", " CCC " }, @@ -108,11 +115,35 @@ public IMetaTileEntity newMetaEntity(IGregTechTileEntity aTileEntity) { { " CCC ", " CCCCC ", " CCCCCCC ", "CCCCCCCCC", " CCCCCCC ", " CCCCC ", " CCC " }, { " B~B ", " C C ", " B B ", "C C", " B B ", " C C ", " BBB " }, { " CCC ", " CCFCC ", " CCFFFCC ", "CCFFFFFCC", " CCFFFCC ", " CCFCC ", " CCC " } })) + .addShape( + STRUCTURE_TIER_3, + new String[][] { { "ZZZ", "Z~Z", "ZZZ" }, { "ZZZ", "Z Z", "ZZZ" }, { "ZZZ", "ZFZ", "ZZZ" } }) + .addElement( + 'Y', + buildHatchAdder(MTESolarFactory.class) + .atLeast(InputHatch, InputBus, OutputBus, OutputHatch, Maintenance, Energy, ExoticEnergy) + .casingIndex(CASING_T1_INDEX) + .dot(1) + .buildAndChain(onElementPass(MTESolarFactory::onCasingAdded, ofBlock(GregTechAPI.sBlockCasings2, 1)))) + .addElement( + 'C', + buildHatchAdder(MTESolarFactory.class) + .atLeast(InputHatch, InputBus, OutputBus, Maintenance, Energy.or(ExoticEnergy)) + .casingIndex(CASING_T2_INDEX) + .dot(1) + .buildAndChain(onElementPass(MTESolarFactory::onCasingAdded, ofBlock(sBlockCasings4, 0)))) + .addElement( + 'Z', + buildHatchAdder(MTESolarFactory.class) + .atLeast(InputHatch, InputBus, OutputBus, OutputHatch, Maintenance, Energy, ExoticEnergy) + .casingIndex(CASING_T3_INDEX) + .dot(1) + .buildAndChain(onElementPass(MTESolarFactory::onCasingAdded, ofBlock(GregTechAPI.sBlockCasings2, 0)))) .addElement( 'F', withChannel( "unit casing", - StructureUtility.ofBlocksTiered( + ofBlocksTiered( (block, meta) -> block == Loaders.preciseUnitCasing ? meta : -2, // ^ if block is preciseUnitCasing return meta, otherwise return -2 & fail checkMachine ImmutableList.of( @@ -123,13 +154,6 @@ public IMetaTileEntity newMetaEntity(IGregTechTileEntity aTileEntity) { -3, MTESolarFactory::setCasingTier, MTESolarFactory::getCasingTier))) - .addElement( - 'C', - buildHatchAdder(MTESolarFactory.class) - .atLeast(InputHatch, InputBus, OutputBus, Maintenance, Energy.or(ExoticEnergy)) - .casingIndex(CASING_INDEX) - .dot(1) - .buildAndChain(onElementPass(MTESolarFactory::onCasingAdded, ofBlock(sBlockCasings4, 0)))) .addElement('D', ofBlock(GregTechAPI.sBlockCasings2, 5)) .addElement('B', chainAllGlasses()) .addElement('E', ofFrame(Materials.Tungsten)) @@ -152,43 +176,62 @@ public IStructureDefinition getStructureDefinition() { return STRUCTURE_DEFINITION; } - @Override - public boolean checkMachine(IGregTechTileEntity aBaseMetaTileEntity, ItemStack aStack) { - this.casingAmount = 0; - this.casingTier = -3; - if (checkPiece(STRUCTURE_PIECE_MAIN, 4, 8, 0)) { - getBaseMetaTileEntity().sendBlockEvent(GregTechTileClientEvents.CHANGE_CUSTOM_DATA, getUpdateData()); - return casingAmount >= 8 && casingTier >= -1 && mMaintenanceHatches.size() == 1; - } - return false; - } - @Override public void loadNBTData(NBTTagCompound aNBT) { casingTier = aNBT.getInteger("casingTier"); + mTier = aNBT.getInteger("multiTier"); super.loadNBTData(aNBT); } @Override public void saveNBTData(NBTTagCompound aNBT) { aNBT.setInteger("casingTier", casingTier); + aNBT.setInteger("multiTier", mTier); super.saveNBTData(aNBT); } @Override - public byte getUpdateData() { - return (byte) casingTier; + public boolean checkMachine(IGregTechTileEntity aBaseMetaTileEntity, ItemStack aStack) { + casingAmount = 0; + casingTier = -3; + mTier = 0; + if (checkPiece(STRUCTURE_TIER_1, 1, 1, 0)) { + mTier = 1; + } else if (checkPiece(STRUCTURE_TIER_2, 4, 8, 0)) { + mTier = 2; + } else if (checkPiece(STRUCTURE_TIER_3, 1, 1, 0)) { + mTier = 3; + } else mTier = 0; + getBaseMetaTileEntity().sendBlockEvent(GregTechTileClientEvents.CHANGE_CUSTOM_DATA, getUpdateData()); + return mTier > 0 && casingAmount >= 8 && (mTier < 2 || casingTier >= -1); } @Override - public void construct(ItemStack stackSize, boolean hintsOnly) { - buildPiece(STRUCTURE_PIECE_MAIN, stackSize, hintsOnly, 4, 8, 0); + public void construct(ItemStack holoStack, boolean hintsOnly) { + if (holoStack.stackSize == 1) { + buildPiece(STRUCTURE_TIER_1, holoStack, hintsOnly, 1, 1, 0); + } + if (holoStack.stackSize == 2) { + buildPiece(STRUCTURE_TIER_2, holoStack, hintsOnly, 4, 8, 0); + } + if (holoStack.stackSize >= 3) { + buildPiece(STRUCTURE_TIER_3, holoStack, hintsOnly, 1, 1, 0); + } } @Override - public int survivalConstruct(ItemStack stackSize, int elementBudget, ISurvivalBuildEnvironment env) { + public int survivalConstruct(ItemStack holoStack, int elementBudget, ISurvivalBuildEnvironment env) { if (mMachine) return -1; - return survivialBuildPiece(STRUCTURE_PIECE_MAIN, stackSize, 4, 8, 0, elementBudget, env, false, true); + if (holoStack.stackSize == 1) { + return survivialBuildPiece(STRUCTURE_TIER_1, holoStack, 1, 0, 1, elementBudget, env, false, true); + } + if (holoStack.stackSize == 2) { + return survivialBuildPiece(STRUCTURE_TIER_2, holoStack, 4, 8, 0, elementBudget, env, false, true); + } + if (holoStack.stackSize >= 3) { + return survivialBuildPiece(STRUCTURE_TIER_3, holoStack, 1, 0, 1, elementBudget, env, false, true); + } + return 0; } protected ItemStack[] calculateNewOutput(ItemStack currentOutput, int seed) { @@ -245,10 +288,13 @@ private void findWaferStack() { @Override public CheckRecipeResult validateRecipe(@NotNull GTRecipe recipe) { SolarFactoryRecipeData data = recipe.getMetadata(SolarFactoryRecipeDataKey.INSTANCE); - if (data == null) { + if (data == null || mTier < 2) { shouldMultiplyOutputs = false; return CheckRecipeResultRegistry.SUCCESSFUL; } + if (mTier < data.tierRequired) { + return CheckRecipeResultRegistry.insufficientMachineTier(data.tierRequired); + } minimumTierForRecipe = data.minimumWaferTier; waferAmountInRecipe = data.minimumWaferCount; findWaferStack(); @@ -286,6 +332,7 @@ protected ParallelHelper createParallelHelper(@Nonnull GTRecipe recipe) { // 2^(casingTier + 3) protected int getMaxParallel() { + if (mTier <= 1) return 1; return (int) Math.pow(2, 1 + (casingTier + 2)); } @@ -323,11 +370,30 @@ protected MultiblockTooltipBuilder createTooltip() { return tt; } + private int getIndex(int tier) { + if (tier <= 1) return CASING_T1_INDEX; + if (tier == 2) return CASING_T2_INDEX; + return CASING_T3_INDEX; + } + + @Override + public byte getUpdateData() { + return (byte) mTier; + } + + @Override + public void receiveClientEvent(byte aEventID, byte aValue) { + super.receiveClientEvent(aEventID, aValue); + if (aEventID == GregTechTileClientEvents.CHANGE_CUSTOM_DATA && ((aValue & 0x80) == 0 || aValue == -1)) { + mTier = aValue; + } + } + @Override public ITexture[] getTexture(IGregTechTileEntity aBaseMetaTileEntity, ForgeDirection side, ForgeDirection aFacing, int colorIndex, boolean aActive, boolean redstoneLevel) { if (side == aFacing) { - if (aActive) return new ITexture[] { Textures.BlockIcons.getCasingTextureForId(CASING_INDEX), + if (aActive) return new ITexture[] { Textures.BlockIcons.getCasingTextureForId(getIndex(mTier)), TextureFactory.builder() .addIcon(OVERLAY_FRONT_SOLAR_FACTORY_ACTIVE) .extFacing() @@ -337,7 +403,7 @@ public ITexture[] getTexture(IGregTechTileEntity aBaseMetaTileEntity, ForgeDirec .extFacing() .glow() .build() }; - return new ITexture[] { Textures.BlockIcons.getCasingTextureForId(CASING_INDEX), TextureFactory.builder() + return new ITexture[] { Textures.BlockIcons.getCasingTextureForId(getIndex(mTier)), TextureFactory.builder() .addIcon(OVERLAY_FRONT_SOLAR_FACTORY_INACTIVE) .extFacing() .build(), @@ -347,7 +413,7 @@ public ITexture[] getTexture(IGregTechTileEntity aBaseMetaTileEntity, ForgeDirec .glow() .build() }; } - return new ITexture[] { Textures.BlockIcons.getCasingTextureForId(CASING_INDEX) }; + return new ITexture[] { Textures.BlockIcons.getCasingTextureForId(getIndex(mTier)) }; } @Override From 7cecaf8f6ce2a6c61e6a23b514d1ecb3412c71f2 Mon Sep 17 00:00:00 2001 From: PureBluez Date: Sun, 12 Jan 2025 22:29:37 -0600 Subject: [PATCH 18/22] update tooltip for new tiers --- .../gregtech/api/util/GTLanguageManager.java | 2 +- .../machines/multi/MTESolarFactory.java | 27 ++++++++++++------- 2 files changed, 19 insertions(+), 10 deletions(-) diff --git a/src/main/java/gregtech/api/util/GTLanguageManager.java b/src/main/java/gregtech/api/util/GTLanguageManager.java index 998861a2975..50e61be359a 100644 --- a/src/main/java/gregtech/api/util/GTLanguageManager.java +++ b/src/main/java/gregtech/api/util/GTLanguageManager.java @@ -550,7 +550,7 @@ public static void writePlaceholderStrings() { addStringLocalization("Interaction_DESCRIPTION_Index_507", "Safe Mode"); addStringLocalization("Interaction_DESCRIPTION_Index_508", "Requires Stabilized Black Hole"); addStringLocalization("Interaction_DESCRIPTION_Index_509", "Requires HIP Unit"); - addStringLocalization("Interaction_DESCRIPTION_Index_510", "Tier required: "); + addStringLocalization("Interaction_DESCRIPTION_Index_510", "Multi Tier required: "); addStringLocalization("Interaction_DESCRIPTION_Index_602", "Use Private Frequency"); addStringLocalization("Interaction_DESCRIPTION_Index_756", "Connectable: "); addStringLocalization("Interaction_DESCRIPTION_Index_ALL", "All"); diff --git a/src/main/java/gregtech/common/tileentities/machines/multi/MTESolarFactory.java b/src/main/java/gregtech/common/tileentities/machines/multi/MTESolarFactory.java index da92cf3ad85..438d793132a 100644 --- a/src/main/java/gregtech/common/tileentities/machines/multi/MTESolarFactory.java +++ b/src/main/java/gregtech/common/tileentities/machines/multi/MTESolarFactory.java @@ -12,6 +12,8 @@ import static gregtech.api.util.GTStructureUtility.ofFrame; import static gregtech.api.util.GTUtility.copyAmount; import static gregtech.api.util.GTUtility.copyAmountUnsafe; +import static net.minecraft.util.EnumChatFormatting.AQUA; +import static net.minecraft.util.EnumChatFormatting.BOLD; import static net.minecraft.util.EnumChatFormatting.WHITE; import javax.annotation.Nonnull; @@ -56,6 +58,8 @@ import gregtech.api.util.ParallelHelper; import gregtech.api.util.recipe.SolarFactoryRecipeData; +// TODO: add actual structures and update tooltip structure info accordingly + public class MTESolarFactory extends MTEExtendedPowerMultiBlockBase implements IConstructable, ISurvivalConstructable { @@ -68,7 +72,7 @@ public class MTESolarFactory extends MTEExtendedPowerMultiBlockBase> validWafers = ImmutableList.of( @@ -201,7 +205,7 @@ public boolean checkMachine(IGregTechTileEntity aBaseMetaTileEntity, ItemStack a mTier = 2; } else if (checkPiece(STRUCTURE_TIER_3, 1, 1, 0)) { mTier = 3; - } else mTier = 0; + } getBaseMetaTileEntity().sendBlockEvent(GregTechTileClientEvents.CHANGE_CUSTOM_DATA, getUpdateData()); return mTier > 0 && casingAmount >= 8 && (mTier < 2 || casingTier >= -1); } @@ -235,8 +239,8 @@ public int survivalConstruct(ItemStack holoStack, int elementBudget, ISurvivalBu } protected ItemStack[] calculateNewOutput(ItemStack currentOutput, int seed) { - double calculatedMultiplier = ((outputMultiplierSlope * seed) + 1) > outputMultiplierCap ? outputMultiplierCap - : ((outputMultiplierSlope * seed) + 1); + outputMultiplierSlope = mTier >= 3 ? 0.50 : 0.25; + double calculatedMultiplier = Math.min((outputMultiplierSlope * seed) + 1, outputMultiplierCap); int outputSize = (int) Math.floor(currentOutput.stackSize * calculatedMultiplier); return new ItemStack[] { copyAmountUnsafe(outputSize, currentOutput) }; } @@ -348,11 +352,16 @@ protected MultiblockTooltipBuilder createTooltip() { tt.addMachineType("Solar Factory") .addInfo("Controller block for the Solar Factory") .addInfo("Produces solar panels in bulk") - .addInfo("Receives a 25% bonus to output for each Wafer tier above the minimum required") - .addInfo("The bonus to output occurs after parallels, and cannot be greater than 100%") - .addInfo("The recipes shown in NEI display the minimum wafer tier required") - .addInfo("Parallels are based on Precise Casing Tier") - .addInfo("MK-I = 8x, MK-II = 16x, MK-III = 32x, MK-IV = 64x") + .addInfo("The structure has 3 tiers, each allowing greater production than the last") + .addInfo(WHITE + "" + BOLD + "Tier " + AQUA + BOLD + "2" + WHITE + BOLD + " and above:") + .addInfo(" 25% more outputs for every Wafer tier used above the minimum required") + .addInfo(" The bonus to output occurs after parallels, and cannot be greater than 100%") + .addInfo(" The recipes shown in NEI display the minimum wafer tier required") + .addInfo(" Parallels are based on Precise Casing Tier") + .addInfo(" MK-I = 8x, MK-II = 16x, MK-III = 32x, MK-IV = 64x") + .addInfo(WHITE + "" + BOLD + "Tier " + AQUA + BOLD + "3" + WHITE + BOLD + " and above:") + .addInfo(" Solar Panels can be made without the previous panel, but at a higher cost") + .addInfo(" Bonus per increased wafer tier is raised to 50%") .addTecTechHatchInfo() .beginStructureBlock(7, 10, 9, true) .addStructureInfo(WHITE + "Imprecise Unit Casings cannot be used") From 9aa6f7756ccce6cd22f829c06c22887e353aa6c1 Mon Sep 17 00:00:00 2001 From: PureBluez Date: Wed, 22 Jan 2025 18:49:26 -0600 Subject: [PATCH 19/22] remove temp structures and some other misc fixes --- .../machines/multi/MTESolarFactory.java | 92 ++++++++++++------- 1 file changed, 57 insertions(+), 35 deletions(-) diff --git a/src/main/java/gregtech/common/tileentities/machines/multi/MTESolarFactory.java b/src/main/java/gregtech/common/tileentities/machines/multi/MTESolarFactory.java index 438d793132a..bfcb18c104f 100644 --- a/src/main/java/gregtech/common/tileentities/machines/multi/MTESolarFactory.java +++ b/src/main/java/gregtech/common/tileentities/machines/multi/MTESolarFactory.java @@ -63,10 +63,9 @@ public class MTESolarFactory extends MTEExtendedPowerMultiBlockBase implements IConstructable, ISurvivalConstructable { - protected IStructureDefinition multiDefinition = null; - private static final int CASING_T1_INDEX = 17; + private static final int CASING_T1_INDEX = 49; private static final int CASING_T2_INDEX = 48; - private static final int CASING_T3_INDEX = 16; + private static final int CASING_T3_INDEX = 183; int mTier; int casingAmount; int casingTier; @@ -104,47 +103,73 @@ public IMetaTileEntity newMetaEntity(IGregTechTileEntity aTileEntity) { .builder() .addShape( STRUCTURE_TIER_1, - new String[][] { { "YYY", "Y~Y", "YYY" }, { "YYY", "Y Y", "YYY" }, { "YYY", "YYY", "YYY" } }) + transpose( + new String[][] { { "EAAAE", "AAAAA", "AAAAA", "AAAAA", "EAAAE" }, + { "E E", " GGG ", " G G ", " GGG ", "E E" }, { "E E", " GGG ", " G G ", " GGG ", "E E" }, + { "E E", " GGG ", " G G ", " GGG ", "E E" }, { "EA~AE", "AAAAA", "AAAAA", "AAAAA", "EAAAE" } })) .addShape( STRUCTURE_TIER_2, transpose( new String[][] { - { " CCC ", " CCFCC ", " CCFFFCC ", "CCFFFFFCC", " CCFFFCC ", " CCFCC ", " CCC " }, - { " BBB ", " C C ", " B B ", "C C", " B B ", " C C ", " BBB " }, - { " CCC ", " CCCCC ", " CCCCCCC ", "CCCCCCCCC", " CCCCCCC ", " CCCCC ", " CCC " }, - { " ", " EBBBE ", " B B ", "E B D B E", " B B ", " EBBBE ", " " }, - { " ", " EBBBE ", " B B ", "E B D B E", " B B ", " EBBBE ", " " }, - { " ", " EBBBE ", " B B ", "E B D B E", " B B ", " EBBBE ", " " }, - { " ", " EBBBE ", " B B ", "E B D B E", " B B ", " EBBBE ", " " }, - { " CCC ", " CCCCC ", " CCCCCCC ", "CCCCCCCCC", " CCCCCCC ", " CCCCC ", " CCC " }, - { " B~B ", " C C ", " B B ", "C C", " B B ", " C C ", " BBB " }, - { " CCC ", " CCFCC ", " CCFFFCC ", "CCFFFFFCC", " CCFFFCC ", " CCFCC ", " CCC " } })) + { " F F ", "FFF FFF", " FFF FFF ", " FBBBF ", " FBBBF ", " FFFFFFF ", "FFF FFF", + " F F " }, + { "BBB BBB", "BBB BBB", "BB BB", " BBB ", " BBB ", "BB BB", "BBB BBB", + "BBB BBB" }, + { "BF FB", "FBGGGGGBF", " GGGGGGG ", " GGGGGGG ", " GGGGGGG ", " GGGGGGG ", "FBGGGGGBF", + "BF FB" }, + { "BF FB", "FBGGGGGBF", " G G ", " G G ", " G G ", " G G ", "FBGGGGGBF", + "BF FB" }, + { "BF FB", "FBGGGGGBF", " G G ", " G G ", " G G ", " G G ", "FBGGGGGBF", + "BF FB" }, + { "BBBB~BBBB", "BBFFFFFBB", "BFPPPPPFB", "BFPPPPPFB", "BFPPPPPFB", "BFPPPPPFB", "BBFFFFFBB", + "BBBBBBBBB" } })) .addShape( STRUCTURE_TIER_3, - new String[][] { { "ZZZ", "Z~Z", "ZZZ" }, { "ZZZ", "Z Z", "ZZZ" }, { "ZZZ", "ZFZ", "ZZZ" } }) + transpose( + new String[][] { + { " CCC ", " CCPCC ", " CCPPPCC ", "CCPPPPPCC", " CCPPPCC ", " CCPCC ", " CCC " }, + { " GGG ", " C C ", " G G ", "C C", " G G ", " C C ", " GGG " }, + { " CCC ", " CCCCC ", " CCCCCCC ", "CCCCHCCCC", " CCCCCCC ", " CCCCC ", " CCC " }, + { " ", " FGGGF ", " G G ", "F G H G F", " G G ", " FGGGF ", " " }, + { " ", " FGGGF ", " G G ", "F G H G F", " G G ", " FGGGF ", " " }, + { " ", " FGGGF ", " G G ", "F G H G F", " G G ", " FGGGF ", " " }, + { " ", " FGGGF ", " G G ", "F G H G F", " G G ", " FGGGF ", " " }, + { " CCC ", " CCCCC ", " CCCCCCC ", "CCCCHCCCC", " CCCCCCC ", " CCCCC ", " CCC " }, + { " G~G ", " C C ", " G G ", "C C", " G G ", " C C ", " GGG " }, + { " CCC ", " CCPCC ", " CCPPPCC ", "CCPPPPPCC", " CCPPPCC ", " CCPCC ", " CCC " } })) + // Clean stainless steel .addElement( - 'Y', + 'A', buildHatchAdder(MTESolarFactory.class) .atLeast(InputHatch, InputBus, OutputBus, OutputHatch, Maintenance, Energy, ExoticEnergy) .casingIndex(CASING_T1_INDEX) .dot(1) - .buildAndChain(onElementPass(MTESolarFactory::onCasingAdded, ofBlock(GregTechAPI.sBlockCasings2, 1)))) + .buildAndChain(onElementPass(MTESolarFactory::onCasingAdded, ofBlock(sBlockCasings4, 1)))) + // Tungstensteel .addElement( - 'C', + 'B', buildHatchAdder(MTESolarFactory.class) - .atLeast(InputHatch, InputBus, OutputBus, Maintenance, Energy.or(ExoticEnergy)) + .atLeast(InputHatch, InputBus, OutputBus, Maintenance, Energy, ExoticEnergy) .casingIndex(CASING_T2_INDEX) .dot(1) .buildAndChain(onElementPass(MTESolarFactory::onCasingAdded, ofBlock(sBlockCasings4, 0)))) + // Advanced iridium .addElement( - 'Z', + 'C', buildHatchAdder(MTESolarFactory.class) .atLeast(InputHatch, InputBus, OutputBus, OutputHatch, Maintenance, Energy, ExoticEnergy) .casingIndex(CASING_T3_INDEX) .dot(1) - .buildAndChain(onElementPass(MTESolarFactory::onCasingAdded, ofBlock(GregTechAPI.sBlockCasings2, 0)))) + .buildAndChain(onElementPass(MTESolarFactory::onCasingAdded, ofBlock(GregTechAPI.sBlockCasings8, 7)))) + .addElement('E', ofFrame(Materials.DamascusSteel)) + .addElement('F', ofFrame(Materials.Tungsten)) + // G for Glass ^-^ + .addElement('G', chainAllGlasses()) + // Black plutonium item pipe + .addElement('H', ofBlock(GregTechAPI.sBlockCasings11, 7)) + // P for Precise Electronic Unit Casing ^-^ .addElement( - 'F', + 'P', withChannel( "unit casing", ofBlocksTiered( @@ -158,9 +183,6 @@ public IMetaTileEntity newMetaEntity(IGregTechTileEntity aTileEntity) { -3, MTESolarFactory::setCasingTier, MTESolarFactory::getCasingTier))) - .addElement('D', ofBlock(GregTechAPI.sBlockCasings2, 5)) - .addElement('B', chainAllGlasses()) - .addElement('E', ofFrame(Materials.Tungsten)) .build(); public int getCasingTier() { @@ -199,27 +221,27 @@ public boolean checkMachine(IGregTechTileEntity aBaseMetaTileEntity, ItemStack a casingAmount = 0; casingTier = -3; mTier = 0; - if (checkPiece(STRUCTURE_TIER_1, 1, 1, 0)) { + if (checkPiece(STRUCTURE_TIER_1, 2, 4, 0)) { mTier = 1; - } else if (checkPiece(STRUCTURE_TIER_2, 4, 8, 0)) { + } else if (checkPiece(STRUCTURE_TIER_2, 4, 5, 0)) { mTier = 2; - } else if (checkPiece(STRUCTURE_TIER_3, 1, 1, 0)) { + } else if (checkPiece(STRUCTURE_TIER_3, 4, 8, 0)) { mTier = 3; } getBaseMetaTileEntity().sendBlockEvent(GregTechTileClientEvents.CHANGE_CUSTOM_DATA, getUpdateData()); - return mTier > 0 && casingAmount >= 8 && (mTier < 2 || casingTier >= -1); + return mTier > 0 && casingAmount >= 8 && (mTier == 1 || casingTier >= -1); } @Override public void construct(ItemStack holoStack, boolean hintsOnly) { if (holoStack.stackSize == 1) { - buildPiece(STRUCTURE_TIER_1, holoStack, hintsOnly, 1, 1, 0); + buildPiece(STRUCTURE_TIER_1, holoStack, hintsOnly, 2, 4, 0); } if (holoStack.stackSize == 2) { - buildPiece(STRUCTURE_TIER_2, holoStack, hintsOnly, 4, 8, 0); + buildPiece(STRUCTURE_TIER_2, holoStack, hintsOnly, 4, 5, 0); } if (holoStack.stackSize >= 3) { - buildPiece(STRUCTURE_TIER_3, holoStack, hintsOnly, 1, 1, 0); + buildPiece(STRUCTURE_TIER_3, holoStack, hintsOnly, 4, 8, 0); } } @@ -227,13 +249,13 @@ public void construct(ItemStack holoStack, boolean hintsOnly) { public int survivalConstruct(ItemStack holoStack, int elementBudget, ISurvivalBuildEnvironment env) { if (mMachine) return -1; if (holoStack.stackSize == 1) { - return survivialBuildPiece(STRUCTURE_TIER_1, holoStack, 1, 0, 1, elementBudget, env, false, true); + return survivialBuildPiece(STRUCTURE_TIER_1, holoStack, 2, 4, 0, elementBudget, env, false, true); } if (holoStack.stackSize == 2) { - return survivialBuildPiece(STRUCTURE_TIER_2, holoStack, 4, 8, 0, elementBudget, env, false, true); + return survivialBuildPiece(STRUCTURE_TIER_2, holoStack, 4, 5, 0, elementBudget, env, false, true); } if (holoStack.stackSize >= 3) { - return survivialBuildPiece(STRUCTURE_TIER_3, holoStack, 1, 0, 1, elementBudget, env, false, true); + return survivialBuildPiece(STRUCTURE_TIER_3, holoStack, 4, 8, 0, elementBudget, env, false, true); } return 0; } From b1fd6f9efd16663cf0d20bdc9a23f6d3bf48518f Mon Sep 17 00:00:00 2001 From: PureBluez Date: Wed, 22 Jan 2025 20:39:08 -0600 Subject: [PATCH 20/22] fix build error sorry maya, had to use checkProcessing --- .../machines/multi/MTESolarFactory.java | 70 +++++++++++-------- 1 file changed, 42 insertions(+), 28 deletions(-) diff --git a/src/main/java/gregtech/common/tileentities/machines/multi/MTESolarFactory.java b/src/main/java/gregtech/common/tileentities/machines/multi/MTESolarFactory.java index bfcb18c104f..72d351fea7b 100644 --- a/src/main/java/gregtech/common/tileentities/machines/multi/MTESolarFactory.java +++ b/src/main/java/gregtech/common/tileentities/machines/multi/MTESolarFactory.java @@ -54,7 +54,6 @@ import gregtech.api.render.TextureFactory; import gregtech.api.util.GTRecipe; import gregtech.api.util.MultiblockTooltipBuilder; -import gregtech.api.util.OverclockCalculator; import gregtech.api.util.ParallelHelper; import gregtech.api.util.recipe.SolarFactoryRecipeData; @@ -70,6 +69,12 @@ public class MTESolarFactory extends MTEExtendedPowerMultiBlockBase pair : validWafers) { @@ -297,19 +324,6 @@ private void findWaferStack() { } } - @Override - protected @NotNull CheckRecipeResult applyRecipe(@NotNull GTRecipe recipe, @NotNull ParallelHelper helper, - @NotNull OverclockCalculator calculator, @NotNull CheckRecipeResult result) { - result = super.applyRecipe(recipe, helper, calculator, result); - if (shouldMultiplyOutputs) { - // We multiply outputs here since its after parallels are calculated, however this is after void - // protection checks so void protection is not supported. - outputItems = calculateNewOutput(outputItems[0], (foundWaferTier - minimumTierForRecipe)); - } - clearVars(); - return result; - } - @NotNull @Override public CheckRecipeResult validateRecipe(@NotNull GTRecipe recipe) { From 832929d30076fc9cfd6cb8185b95a7520800e7b3 Mon Sep 17 00:00:00 2001 From: PureBluez Date: Wed, 22 Jan 2025 21:10:03 -0600 Subject: [PATCH 21/22] update structure tooltip and improve structure code --- .../machines/multi/MTESolarFactory.java | 42 +++++++++++++------ 1 file changed, 29 insertions(+), 13 deletions(-) diff --git a/src/main/java/gregtech/common/tileentities/machines/multi/MTESolarFactory.java b/src/main/java/gregtech/common/tileentities/machines/multi/MTESolarFactory.java index 72d351fea7b..69cc0a270df 100644 --- a/src/main/java/gregtech/common/tileentities/machines/multi/MTESolarFactory.java +++ b/src/main/java/gregtech/common/tileentities/machines/multi/MTESolarFactory.java @@ -68,6 +68,7 @@ public class MTESolarFactory extends MTEExtendedPowerMultiBlockBase= 15; } else if (checkPiece(STRUCTURE_TIER_2, 4, 5, 0)) { mTier = 2; + hasEnoughCasings = casingAmount >= 35; } else if (checkPiece(STRUCTURE_TIER_3, 4, 8, 0)) { mTier = 3; + hasEnoughCasings = casingAmount >= 50; } getBaseMetaTileEntity().sendBlockEvent(GregTechTileClientEvents.CHANGE_CUSTOM_DATA, getUpdateData()); - return mTier > 0 && casingAmount >= 8 && (mTier == 1 || casingTier >= -1); + return mTier > 0 && hasEnoughCasings && (mTier == 1 || casingTier >= -1); } @Override @@ -399,18 +404,29 @@ protected MultiblockTooltipBuilder createTooltip() { .addInfo(" Solar Panels can be made without the previous panel, but at a higher cost") .addInfo(" Bonus per increased wafer tier is raised to 50%") .addTecTechHatchInfo() - .beginStructureBlock(7, 10, 9, true) - .addStructureInfo(WHITE + "Imprecise Unit Casings cannot be used") - .addCasingInfoRange("Tungstensteel Machine Casing", 120, 142, false) + .beginStructureBlock(7, 10, 9, false) + .addStructureInfo(WHITE + "" + BOLD + "Tier " + AQUA + BOLD + "1:") + .addCasingInfoRange("Clean Stainless Steel Machine Casing", 15, 41, false) + .addCasingInfoExactly("Any Glass", 24, false) + .addCasingInfoExactly("Damascus Steel Frame Box", 20, false) + .addStructureInfo(WHITE + "" + BOLD + "Tier " + AQUA + BOLD + "2:") + .addCasingInfoRange("Tungstensteel Machine Casing", 35, 101, false) + .addCasingInfoExactly("Any Glass", 74, false) + .addCasingInfoExactly("Tungsten Frame Box", 75, false) + .addCasingInfoExactly("Precise Electronic Unit Casing", 20, true) + .addStructureInfo(WHITE + "" + BOLD + "Tier " + AQUA + BOLD + "3:") + .addCasingInfoRange("Advanced Iridium Machine Casing", 50, 140, false) .addCasingInfoExactly("Any Glass", 67, false) - .addCasingInfoExactly("Precise Electronic Unit Casing", 26, true) .addCasingInfoExactly("Tungsten Frame Box", 24, false) - .addCasingInfoExactly("Assembling Line Casing", 4, false) - .addInputHatch("Any Tungstensteel Machine Casing") - .addInputBus("Any Tungstensteel Machine Casing") - .addOutputBus("Any Tungstensteel Machine Casing") - .addEnergyHatch("Any Tungstensteel Machine Casing") - .addMaintenanceHatch("Any Tungstensteel Machine Casing") + .addCasingInfoExactly("Precise Electronic Unit Casing", 26, true) + .addCasingInfoExactly("Black Plutonium Item Pipe", 6, false) + .addStructureInfo(WHITE + "" + BOLD + "All Tiers: ") + .addStructureInfo(WHITE + "Imprecise Unit Casings cannot be used") + .addInputHatch("Any Machine Casing") + .addInputBus("Any Machine Casing") + .addOutputBus("Any Machine Casing") + .addEnergyHatch("Any Machine Casing") + .addMaintenanceHatch("Any Machine Casing") .toolTipFinisher(GTValues.AuthorPureBluez); return tt; } From 796260c536450f855a6662faf051413dff9e23f4 Mon Sep 17 00:00:00 2001 From: PureBluez Date: Sat, 25 Jan 2025 12:50:59 -0600 Subject: [PATCH 22/22] update tooltip --- .../common/tileentities/machines/multi/MTESolarFactory.java | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/main/java/gregtech/common/tileentities/machines/multi/MTESolarFactory.java b/src/main/java/gregtech/common/tileentities/machines/multi/MTESolarFactory.java index 69cc0a270df..3ddae49d0e9 100644 --- a/src/main/java/gregtech/common/tileentities/machines/multi/MTESolarFactory.java +++ b/src/main/java/gregtech/common/tileentities/machines/multi/MTESolarFactory.java @@ -398,10 +398,11 @@ protected MultiblockTooltipBuilder createTooltip() { .addInfo(" 25% more outputs for every Wafer tier used above the minimum required") .addInfo(" The bonus to output occurs after parallels, and cannot be greater than 100%") .addInfo(" The recipes shown in NEI display the minimum wafer tier required") + .addInfo(" LV-LuV Solar Panels can be made without the previous panel, but at a higher cost") .addInfo(" Parallels are based on Precise Casing Tier") .addInfo(" MK-I = 8x, MK-II = 16x, MK-III = 32x, MK-IV = 64x") - .addInfo(WHITE + "" + BOLD + "Tier " + AQUA + BOLD + "3" + WHITE + BOLD + " and above:") - .addInfo(" Solar Panels can be made without the previous panel, but at a higher cost") + .addInfo(WHITE + "" + BOLD + "Tier " + AQUA + BOLD + "3") + .addInfo(" ZPM-UV Solar Panels can be made without the previous panel, but at a higher cost") .addInfo(" Bonus per increased wafer tier is raised to 50%") .addTecTechHatchInfo() .beginStructureBlock(7, 10, 9, false)