Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Nanochip Assembly Complex #2903

Draft
wants to merge 45 commits into
base: master
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
45 commits
Select commit Hold shift + click to select a range
4fea8bf
create nanochip assembly complex controller
NotAPenguin0 Aug 14, 2024
ec7ce63
add debug structure
NotAPenguin0 Aug 14, 2024
5a6cf1e
module structure defs
NotAPenguin0 Aug 14, 2024
3f057ef
load assembly matrix module and disable maintenance
NotAPenguin0 Aug 14, 2024
0244494
run fake recipe in NAC
NotAPenguin0 Aug 14, 2024
e6a60e8
create vacuum conveyors
NotAPenguin0 Aug 14, 2024
25dbc96
texture index and only accept hatches
NotAPenguin0 Aug 14, 2024
494b8bd
use proper pipe type and merge circuit component inputs
NotAPenguin0 Aug 14, 2024
0b00f5e
circuit component consumption and routing
NotAPenguin0 Aug 14, 2024
e8d6e8e
fix inconsistencies in hatch map when they are detected
NotAPenguin0 Aug 14, 2024
782fb1d
skip incorrectly colored hatches again
NotAPenguin0 Aug 14, 2024
452909f
fiddle with recipemap and fake items
NotAPenguin0 Aug 14, 2024
0537428
injecting fake items into recipemap works
NotAPenguin0 Aug 14, 2024
1c6f973
slightly change fake item api
NotAPenguin0 Aug 15, 2024
8e3c3e2
start some refactors
NotAPenguin0 Aug 15, 2024
6b79876
recipemap traversal and autogenerating basics work
NotAPenguin0 Aug 16, 2024
a76ce2a
delete old conversion map
NotAPenguin0 Aug 16, 2024
3a5ab91
add debug recipes for crystalproc and add all components for it
NotAPenguin0 Aug 16, 2024
68125b9
optimize nanochip recipe generation transformer
NotAPenguin0 Aug 16, 2024
f63177a
create empty smd processor and make modules accept vacum conveyors
NotAPenguin0 Aug 16, 2024
e589fef
THE GREAT RECIPECHECK
NotAPenguin0 Aug 16, 2024
be63ab5
add fake item outputs properly
NotAPenguin0 Aug 16, 2024
4c2ae6b
drain energy
NotAPenguin0 Aug 16, 2024
6fab2f7
fix recipe generation by ignoring stack sizes in map traversal
NotAPenguin0 Aug 16, 2024
95bc6f7
add frame box processing recipe
NotAPenguin0 Aug 16, 2024
d0859e5
save vacuum conveyor hatch contents in nbt
NotAPenguin0 Aug 17, 2024
eb992a0
generate localized names for components semi automagically
NotAPenguin0 Aug 17, 2024
d37305d
proper naming of fake items in nei and machine display
NotAPenguin0 Aug 17, 2024
a85f9e5
sa
Dream-Master Aug 18, 2024
a637761
implement new main structure
NotAPenguin0 Aug 21, 2024
f2bee2c
some work on module rotation
NotAPenguin0 Aug 21, 2024
557a70c
move module controllers to base structures
NotAPenguin0 Aug 26, 2024
5ea7406
add new structurecheck for modules
NotAPenguin0 Aug 26, 2024
31a4ce6
fix texture
NotAPenguin0 Aug 26, 2024
ff9f30c
Add simple modules with no real behaviour and fix consumption bug
NotAPenguin0 Aug 26, 2024
ce77dd3
make it run recipes
NotAPenguin0 Aug 26, 2024
1e55ef0
the final step towards NAC circuit production
NotAPenguin0 Aug 26, 2024
bb05a46
fix fluid input
NotAPenguin0 Aug 26, 2024
df491e1
limit recipe tier of Assembly Matrix with robot arms
NotAPenguin0 Aug 27, 2024
debcb5e
assign unique ids to hatches on splitter
NotAPenguin0 Aug 30, 2024
1f41f8d
fix compilation + spotless
NotAPenguin0 Dec 22, 2024
1e932f4
spotless
NotAPenguin0 Dec 22, 2024
e8625eb
add glass to structure
NotAPenguin0 Jan 5, 2025
801f41c
show nac recipe for circuits
NotAPenguin0 Jan 6, 2025
ddce335
wip item nonsense
NotAPenguin0 Jan 9, 2025
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions src/main/java/gregtech/GTMod.java
Original file line number Diff line number Diff line change
Expand Up @@ -94,6 +94,7 @@
import gregtech.common.misc.spaceprojects.commands.SPMCommand;
import gregtech.common.misc.spaceprojects.commands.SpaceProjectCommand;
import gregtech.common.tileentities.machines.MTEHatchCraftingInputME;
import gregtech.common.tileentities.machines.multi.nanochip.util.RecipeHandlers;
import gregtech.common.tileentities.storage.MTEDigitalChestBase;
import gregtech.crossmod.holoinventory.HoloInventory;
import gregtech.crossmod.waila.Waila;
Expand Down Expand Up @@ -389,6 +390,10 @@ public boolean test(ItemStack stack) {

GT_FML_LOGGER.debug("Registering SpaceDimensions");
SpaceDimRegisterer.register();
// This needs to run BEFORE creating any circuit assembler recipes, since the downstream
// recipe map for the assembly matrix relies on doing recipe lookups here.
// I really hope I can put this here without breaking something
RecipeHandlers.populateCircuitComponentRecipeMaps();

GregTechAPI.sLoadFinished = true;
GTLog.out.println("GTMod: Load-Phase finished!");
Expand Down
15 changes: 15 additions & 0 deletions src/main/java/gregtech/api/GregTechAPI.java
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,7 @@
import gregtech.api.util.item.ItemHolder;
import gregtech.api.world.GTWorldgen;
import gregtech.common.GTDummyWorld;
import gregtech.common.blocks.BlockCasingsAbstract;
import gregtech.common.items.ItemIntegratedCircuit;

/**
Expand Down Expand Up @@ -669,4 +670,18 @@ public static TileEntity createTileEntity(int meta) {
if (teCreators[meta] == null) return null;
return teCreators[meta].apply(meta);
}

/**
* Get the texture index of a casing block and meta.
*
* @param block Block to check, must extend GT_Block_Casings_Abstract
* @param meta Meta of the block to check
* @return A valid texture index
*/
public static int getCasingTextureIndex(Block block, int meta) {
if (block instanceof BlockCasingsAbstract gtBlock) {
return gtBlock.getTextureIndex(meta);
}
throw new IllegalArgumentException("Passed non-gt casing block to getCasingTextureIndex");
}
}
13 changes: 12 additions & 1 deletion src/main/java/gregtech/api/enums/ItemList.java
Original file line number Diff line number Diff line change
Expand Up @@ -1515,11 +1515,22 @@ public enum ItemList implements IItemContainer {
Casing_Laser,

Machine_Multi_IndustrialExtractor,

Machine_Multi_Lathe,
Machine_Multi_Autoclave,
Casing_Autoclave,

Machine_Multi_NanochipAssemblyComplex,
Hatch_VacuumConveyor_Input,
Hatch_VacuumConveyor_Output,
VacuumConveyorPipe,
NanoChipModule_AssemblyMatrix,
NanoChipModule_SMDProcessor,
NanoChipModule_BoardProcessor,
NanoChipModule_EtchingArray,
NanoChipModule_CuttingChamber,
NanoChipModule_WireTracer,
NanoChipModule_Splitter,

Machine_LV_Miner,
Machine_MV_Miner,
Machine_HV_Miner,
Expand Down
11 changes: 11 additions & 0 deletions src/main/java/gregtech/api/enums/MetaTileEntityIDs.java
Original file line number Diff line number Diff line change
Expand Up @@ -846,6 +846,17 @@ public enum MetaTileEntityIDs {
PURIFICATION_UNIT_DEGASIFIER(9412),
HATCH_DEGASIFIER_CONTROL(9413),
PURIFICATION_UNIT_PARTICLE_EXTRACTOR(9414),
NANOCHIP_ASSEMBLY_CONTROLLER(9500),
HATCH_VACUUM_CONVEYOR_INPUT(9501),
HATCH_VACUUM_CONVEYOR_OUTPUT(9502),
VACUUM_CONVEYOR_PIPE(9503),
NANOCHIP_MODULE_ASSEMBLY_MATRIX(9504),
NANOCHIP_MODULE_SMD_PROCESSOR(9505),
NANOCHIP_MODULE_BOARD_PROCESSOR(9506),
NANOCHIP_MODULE_ETCHING_ARRAY(9507),
NANOCHIP_MODULE_CUTTING_CHAMBER(9508),
NANOCHIP_MODULE_WIRE_TRACER(9509),
NANOCHIP_MODULE_SPLITTER(9510),
PLASMA_GENERATOR_ZPM(10752),
PLASMA_GENERATOR_UV(10753),
ALLOY_SMELTER_LuV(10760),
Expand Down
50 changes: 50 additions & 0 deletions src/main/java/gregtech/api/items/CircuitComponentFakeItem.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
package gregtech.api.items;

import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.item.ItemStack;

import gregtech.common.tileentities.machines.multi.nanochip.util.CircuitComponent;
import net.minecraft.util.IIcon;

import java.util.List;

public class CircuitComponentFakeItem extends GTGenericItem {

public static CircuitComponentFakeItem INSTANCE = null;

public CircuitComponentFakeItem() {
super("gt.fakecircuitcomponent", "Fake Circuit Component Item", null);
setMaxDamage(0);
setHasSubtypes(true);
INSTANCE = this;
}

@Override
public String getUnlocalizedName(ItemStack aStack) {
CircuitComponent component = CircuitComponent.getFromFakeStackUnsafe(aStack);
return component.unlocalizedName;
}

@Override
public String getItemStackDisplayName(ItemStack stack) {
CircuitComponent component = CircuitComponent.getFromFakeStackUnsafe(stack);
return component.getLocalizedName();
}

@Override
public void addInformation(ItemStack aStack, EntityPlayer aPlayer, List<String> aList, boolean aF3_H) {
aList.add("Item in the Nanochip Assembly Complex vacuum pipe system");
super.addInformation(aStack, aPlayer, aList, aF3_H);
}

@Override
public IIcon getIconFromDamage(int meta) {
// If the component stores an icon, use that
CircuitComponent component = CircuitComponent.getFromMetaDataUnsafe(meta);
if (component.icon != null) return component.icon;
// Else just use the texture that should be assigned to it
return super.getIconFromDamage(meta);
}


}
126 changes: 109 additions & 17 deletions src/main/java/gregtech/api/recipe/RecipeMaps.java
Original file line number Diff line number Diff line change
Expand Up @@ -7,18 +7,11 @@
import static gregtech.api.enums.Mods.Railcraft;
import static gregtech.api.enums.TickTime.TICK;
import static gregtech.api.util.GTModHandler.getModItem;
import static gregtech.api.util.GTRecipeConstants.ADDITIVE_AMOUNT;
import static gregtech.api.util.GTRecipeConstants.FUEL_VALUE;
import static gregtech.api.util.GTRecipeConstants.SIEVERTS;
import static gregtech.api.util.GTRecipeMapUtil.GTRecipeTemplate;
import static gregtech.api.util.GTRecipeConstants.*;
import static gregtech.api.util.GTRecipeMapUtil.asTemplate;
import static gregtech.api.util.GTRecipeMapUtil.buildOrEmpty;
import static gregtech.api.util.GTUtility.clamp;
import static gregtech.api.util.GTUtility.copyAmount;
import static gregtech.api.util.GTUtility.getFluidForFilledItem;
import static gregtech.api.util.GTUtility.isArrayEmptyOrNull;
import static gregtech.api.util.GTUtility.isArrayOfLength;
import static gregtech.api.util.GTUtility.multiplyStack;
import static gregtech.api.util.GTUtility.*;
import static gregtech.common.tileentities.machines.multi.nanochip.util.RecipeHandlers.assemblyMatrixRecipeTransformer;

import java.util.ArrayList;
import java.util.Collection;
Expand Down Expand Up @@ -74,11 +67,10 @@
import gregtech.api.recipe.metadata.CompressionTierKey;
import gregtech.api.recipe.metadata.PCBFactoryTierKey;
import gregtech.api.recipe.metadata.PurificationPlantBaseChanceKey;
import gregtech.api.util.GTModHandler;
import gregtech.api.util.GTOreDictUnificator;
import gregtech.api.util.GTRecipe;
import gregtech.api.util.GTRecipeConstants;
import gregtech.api.util.GTUtility;
import gregtech.api.util.*;
import gregtech.common.tileentities.machines.multi.nanochip.MTENanochipAssemblyComplex;
import gregtech.common.tileentities.machines.multi.nanochip.modules.*;
import gregtech.common.tileentities.machines.multi.nanochip.util.CircuitComponent;
import gregtech.common.tileentities.machines.multi.purification.PurifiedWaterHelpers;
import gregtech.nei.formatter.FuelSpecialValueFormatter;
import gregtech.nei.formatter.FusionSpecialValueFormatter;
Expand Down Expand Up @@ -619,7 +611,7 @@ public final class RecipeMaps {
return Collections.emptyList();
int aCoalAmount = builder.getMetadataOrDefault(ADDITIVE_AMOUNT, 0);
if (aCoalAmount <= 0) return Collections.emptyList();
GTRecipeTemplate coll = asTemplate(rr.get());
GTRecipeMapUtil.GTRecipeTemplate coll = asTemplate(rr.get());
for (Materials coal : new Materials[] { Materials.Coal, Materials.Charcoal }) {
coll.derive()
.setInputs(aInput1, aInput2, coal.getGems(aCoalAmount))
Expand Down Expand Up @@ -722,7 +714,7 @@ public final class RecipeMaps {
.build();
if (!t.isPresent()) return Collections.emptyList();
ItemStack input = b.getItemInputBasic(0);
GTRecipeTemplate coll = asTemplate(t.get());
GTRecipeMapUtil.GTRecipeTemplate coll = asTemplate(t.get());
int tExplosives = Math.min(b.getMetadataOrDefault(ADDITIVE_AMOUNT, 0), 64);
int tGunpowder = tExplosives << 1; // Worst
int tDynamite = Math.max(1, tExplosives >> 1); // good
Expand Down Expand Up @@ -1195,6 +1187,103 @@ && isArrayEmptyOrNull(b.getFluidOutputs())
.neiHandlerInfo(builder -> builder.setDisplayStack(GTModHandler.getIC2Item("nuclearReactor", 1, null)))
.build();

public static final RecipeMap<RecipeMapBackend> nanochipConversionRecipes = RecipeMapBuilder
.of("gt.recipe.nanochip.conversion")
.maxIO(1, 1, 0, 0)
.minInputs(1, 0)
.disableOptimize()
.recipeTransformer(recipe -> {
// Register fallback localized name based on input item
ItemStack input = recipe.mInputs[0];
CircuitComponent output = CircuitComponent.getFromFakeStackUnsafe(recipe.mOutputs[0]);
MTENanochipAssemblyComplex.registerLocalName(input, output);
return recipe;
})
.build();

public static final RecipeMap<RecipeMapBackend> nanochipAssemblyMatrixRecipes = RecipeMapBuilder
.of("gt.recipe.nanochip.assemblymatrix")
.maxIO(9, 1, 4, 0)
.minInputs(0, 0)
.disableOptimize()
.recipeTransformer(recipe -> {
CircuitComponent output = CircuitComponent.tryGetFromFakeStack(recipe.mOutputs[0]);
// Fake recipes for the assembly matrix may not have this
if (output == null) return recipe;
if (output.realCircuit != null) {
AssemblyMatrix.registerLocalName(output.realCircuit, output);
}
return recipe;
})
.build();

public static final RecipeMap<RecipeMapBackend> nanochipSMDProcessorRecipes = RecipeMapBuilder
.of("gt.recipe.nanochip.smdprocessor")
.maxIO(2, 1, 2, 0)
.minInputs(0, 0)
.disableOptimize()
.recipeTransformer(recipe -> {
CircuitComponent output = CircuitComponent.getFromFakeStackUnsafe(recipe.mOutputs[0]);
CircuitComponent input = CircuitComponent.getFromFakeStackUnsafe(recipe.mInputs[0]);
SMDProcessor.registerLocalName(input.getLocalizedName(), output);
return recipe;
})
.build();
public static final RecipeMap<RecipeMapBackend> nanochipBoardProcessorRecipes = RecipeMapBuilder
.of("gt.recipe.nanochip.boardprocessor")
.maxIO(2, 1, 2, 0)
.minInputs(0, 0)
.disableOptimize()
.recipeTransformer(recipe -> {
CircuitComponent output = CircuitComponent.getFromFakeStackUnsafe(recipe.mOutputs[0]);
CircuitComponent input = CircuitComponent.getFromFakeStackUnsafe(recipe.mInputs[0]);
BoardProcessor.registerLocalName(input.getLocalizedName(), output);
return recipe;
})
.build();
public static final RecipeMap<RecipeMapBackend> nanochipEtchingArray = RecipeMapBuilder
.of("gt.recipe.nanochip.etchingarray")
.maxIO(2, 1, 2, 0)
.minInputs(0, 0)
.disableOptimize()
.recipeTransformer(recipe -> {
CircuitComponent output = CircuitComponent.getFromFakeStackUnsafe(recipe.mOutputs[0]);
CircuitComponent input = CircuitComponent.getFromFakeStackUnsafe(recipe.mInputs[0]);
EtchingArray.registerLocalName(input.getLocalizedName(), output);
return recipe;
})
.build();
public static final RecipeMap<RecipeMapBackend> nanochipCuttingChamber = RecipeMapBuilder
.of("gt.recipe.nanochip.cuttingchamber")
.maxIO(2, 1, 2, 0)
.minInputs(0, 0)
.disableOptimize()
.recipeTransformer(recipe -> {
CircuitComponent output = CircuitComponent.getFromFakeStackUnsafe(recipe.mOutputs[0]);
CircuitComponent input = CircuitComponent.getFromFakeStackUnsafe(recipe.mInputs[0]);
CuttingChamber.registerLocalName(input.getLocalizedName(), output);
return recipe;
})
.build();
public static final RecipeMap<RecipeMapBackend> nanochipWireTracer = RecipeMapBuilder
.of("gt.recipe.nanochip.wiretracer")
.maxIO(2, 1, 2, 0)
.minInputs(0, 0)
.disableOptimize()
.recipeTransformer(recipe -> {
CircuitComponent output = CircuitComponent.getFromFakeStackUnsafe(recipe.mOutputs[0]);
CircuitComponent input = CircuitComponent.getFromFakeStackUnsafe(recipe.mInputs[0]);
WireTracer.registerLocalName(input.getLocalizedName(), output);
return recipe;
})
.build();
public static final RecipeMap<RecipeMapBackend> nanochipSuperconductorSplitter = RecipeMapBuilder
.of("gt.recipe.nanochip.superconductorsplitter")
.maxIO(2, 1, 2, 0)
.minInputs(0, 0)
.disableOptimize()
.build();

static {
RecipeMaps.dieselFuels.addDownstream(
IRecipeMap.newRecipeMap(
Expand Down Expand Up @@ -1229,5 +1318,8 @@ && isArrayEmptyOrNull(b.getFluidOutputs())
b.copy()
.duration(1 * TICK)
.eut(TierEU.RECIPE_UEV))));

// Add transformer from circuit assembler recipes to nanochip assembly matrix recipe
RecipeMaps.circuitAssemblerRecipes.addDownstream(assemblyMatrixRecipeTransformer);
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
package gregtech.api.recipe.metadata;

import javax.annotation.ParametersAreNonnullByDefault;

import org.jetbrains.annotations.Nullable;

import gregtech.api.recipe.RecipeMetadataKey;
import gregtech.api.util.MethodsReturnNonnullByDefault;
import gregtech.common.tileentities.machines.multi.nanochip.util.ModuleRecipeInfo;
import gregtech.nei.RecipeDisplayInfo;

@ParametersAreNonnullByDefault
@MethodsReturnNonnullByDefault
public class NanochipAssemblyRecipeInfo extends RecipeMetadataKey<ModuleRecipeInfo> {

public static final NanochipAssemblyRecipeInfo INSTANCE = new NanochipAssemblyRecipeInfo();

private NanochipAssemblyRecipeInfo() {
super(ModuleRecipeInfo.class, "nanochip_assembly_module_recipe_info");
}

@Override
public void drawInfo(RecipeDisplayInfo recipeInfo, @Nullable Object value) {
// TODO: Implement
}
}
Loading
Loading