Skip to content

Commit

Permalink
Add new SMD components (#16)
Browse files Browse the repository at this point in the history
* Update GregTech Circuits diagram with optical SMD components and SMD inductors
 * Small fix for error log message and add a comment about arithmetic overflow
  • Loading branch information
D-Cysteine authored Dec 28, 2022
1 parent 601f4a4 commit 941b31a
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 7 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -243,6 +243,8 @@ void initialize() {
ItemList.Circuit_Biowaresupercomputer),
GregTechOreDictUtil.getComponent(ItemList.Circuit_Biomainframe))
.build());
// If we need to add any more circuit lines, we'll probably just want to add an entire
// second page of circuit lines.
circuitLines = circuitLinesBuilder.build();

ImmutableList.Builder<CircuitLine> individualCircuitsBuilder = ImmutableList.builder();
Expand Down Expand Up @@ -288,24 +290,32 @@ void initialize() {
ImmutableList.of(
GregTechOreDictUtil.getComponent(ItemList.Circuit_Parts_Resistor),
GregTechOreDictUtil.getComponent(ItemList.Circuit_Parts_ResistorSMD),
GregTechOreDictUtil.getComponent(ItemList.Circuit_Parts_ResistorASMD)));
GregTechOreDictUtil.getComponent(ItemList.Circuit_Parts_ResistorASMD),
GregTechOreDictUtil.getComponent(ItemList.Circuit_Parts_ResistorXSMD)));
circuitPartsBuilder.add(
ImmutableList.of(
GregTechOreDictUtil.getComponent(ItemList.Circuit_Parts_Diode),
GregTechOreDictUtil.getComponent(ItemList.Circuit_Parts_DiodeSMD),
GregTechOreDictUtil.getComponent(ItemList.Circuit_Parts_DiodeASMD)));
GregTechOreDictUtil.getComponent(ItemList.Circuit_Parts_DiodeASMD),
GregTechOreDictUtil.getComponent(ItemList.Circuit_Parts_DiodeXSMD)));
circuitPartsBuilder.add(
ImmutableList.of(
GregTechOreDictUtil.getComponent(ItemList.Circuit_Parts_Transistor),
GregTechOreDictUtil.getComponent(ItemList.Circuit_Parts_TransistorSMD),
GregTechOreDictUtil.getComponent(ItemList.Circuit_Parts_TransistorASMD)));
GregTechOreDictUtil.getComponent(ItemList.Circuit_Parts_TransistorASMD),
GregTechOreDictUtil.getComponent(ItemList.Circuit_Parts_TransistorXSMD)));
circuitPartsBuilder.add(
ImmutableList.of(
GregTechOreDictUtil.getComponent(ItemList.Circuit_Parts_Capacitor),
GregTechOreDictUtil.getComponent(ItemList.Circuit_Parts_CapacitorSMD),
GregTechOreDictUtil.getComponent(ItemList.Circuit_Parts_CapacitorASMD)));
GregTechOreDictUtil.getComponent(ItemList.Circuit_Parts_CapacitorASMD),
GregTechOreDictUtil.getComponent(ItemList.Circuit_Parts_CapacitorXSMD)));
circuitPartsBuilder.add(
ImmutableList.of(GregTechOreDictUtil.getComponent(ItemList.Circuit_Parts_Coil)));
ImmutableList.of(
GregTechOreDictUtil.getComponent(ItemList.Circuit_Parts_Coil),
GregTechOreDictUtil.getComponent(ItemList.Circuit_Parts_InductorSMD),
GregTechOreDictUtil.getComponent(ItemList.Circuit_Parts_InductorASMD),
GregTechOreDictUtil.getComponent(ItemList.Circuit_Parts_InductorXSMD)));
circuitParts = circuitPartsBuilder.build();

ImmutableMap.Builder<ItemComponent, CircuitLineCircuits> circuitLineCircuitsBuilder =
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -141,6 +141,9 @@ static CircuitRecipe create(int itemInputsSize, Collection<Recipe> recipes) {
ImmutableSortedSet<DisplayComponent> fluidInputs = fluidInputsBuilder.build();

boolean missingCombinations = false;
// This was changed to long because we were getting overflows earlier.
// But it might no longer be needed.
// I tried loading up the pack (2.2.8) without this logic on 2022-12-25 and it didn't error.
long expectedNumberOfRecipes = fluidInputs.size();
try {
expectedNumberOfRecipes *=
Expand All @@ -151,11 +154,12 @@ static CircuitRecipe create(int itemInputsSize, Collection<Recipe> recipes) {
.reduce(1, Math::multiplyExact);
} catch (ArithmeticException e) {
Logger.GREGTECH_5_CIRCUITS.error(
"Arithmetic exception when calculating number of recipes for circuit "
+ output.toPrettyString(), e);
"Arithmetic exception when calculating number of recipes for circuit: [{}] [{}]",
output.toPrettyString(), e);
// Assume a valid number of recipes when calculation fails
expectedNumberOfRecipes = recipes.size();
}

if (expectedNumberOfRecipes != recipes.size()) {
Logger.GREGTECH_5_CIRCUITS.warn(
"Expected {} recipes but got {} for circuit: [{}]",
Expand Down

0 comments on commit 941b31a

Please sign in to comment.