-
Notifications
You must be signed in to change notification settings - Fork 11
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Added configs for the quantum computer
- Loading branch information
Showing
6 changed files
with
150 additions
and
25 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,19 +1,139 @@ | ||
package net.pedroksl.advanced_ae; | ||
|
||
import net.neoforged.bus.api.SubscribeEvent; | ||
import net.neoforged.fml.common.EventBusSubscriber; | ||
import net.neoforged.fml.event.config.ModConfigEvent; | ||
import net.neoforged.fml.ModContainer; | ||
import net.neoforged.fml.config.ModConfig; | ||
import net.neoforged.neoforge.common.ModConfigSpec; | ||
|
||
@EventBusSubscriber(modid = AdvancedAE.MOD_ID, bus = EventBusSubscriber.Bus.MOD) | ||
public class AAEConfig { | ||
|
||
private static final ModConfigSpec.Builder BUILDER = new ModConfigSpec.Builder(); | ||
private final AAEConfig.ClientConfig client = new AAEConfig.ClientConfig(); | ||
private final AAEConfig.CommonConfig common = new AAEConfig.CommonConfig(); | ||
|
||
public static final ModConfigSpec SPEC = BUILDER.build(); | ||
private static AAEConfig INSTANCE; | ||
|
||
@SubscribeEvent | ||
static void onLoad(final ModConfigEvent event) { | ||
if (event.getConfig().getSpec() == SPEC) {} | ||
AAEConfig(ModContainer container) { | ||
container.registerConfig(ModConfig.Type.CLIENT, client.spec); | ||
container.registerConfig(ModConfig.Type.COMMON, common.spec); | ||
} | ||
|
||
public int getQuantumComputerMaxSize() { | ||
return common.quantumComputerMaxSize.get(); | ||
} | ||
|
||
public int getQuantumComputerMaxMultiThreaders() { | ||
return common.quantumComputerMaxMultiThreaders.get(); | ||
} | ||
|
||
public int getQuantumComputermaxDataEntanglers() { | ||
return common.quantumComputermaxDataEntanglers.get(); | ||
} | ||
|
||
public int getQuantumComputerMultiThreaderMultiplication() { | ||
return common.quantumComputerMultiThreaderMultiplication.get(); | ||
} | ||
|
||
public int getQuantumComputerDataEntanglerMultiplication() { | ||
return common.quantumComputerDataEntanglerMultiplication.get(); | ||
} | ||
|
||
public void save() { | ||
common.spec.save(); | ||
client.spec.save(); | ||
} | ||
|
||
public static void register(ModContainer container) { | ||
if (!container.getModId().equals(AdvancedAE.MOD_ID)) { | ||
throw new IllegalArgumentException(); | ||
} | ||
INSTANCE = new AAEConfig(container); | ||
} | ||
|
||
public static AAEConfig instance() { | ||
return INSTANCE; | ||
} | ||
|
||
private static class ClientConfig { | ||
private final ModConfigSpec spec; | ||
|
||
public ClientConfig() { | ||
var builder = new ModConfigSpec.Builder(); | ||
|
||
this.spec = builder.build(); | ||
} | ||
} | ||
|
||
private static class CommonConfig { | ||
private final ModConfigSpec spec; | ||
|
||
public final ModConfigSpec.IntValue quantumComputerMaxSize; | ||
public final ModConfigSpec.IntValue quantumComputerMaxMultiThreaders; | ||
public final ModConfigSpec.IntValue quantumComputermaxDataEntanglers; | ||
public final ModConfigSpec.IntValue quantumComputerMultiThreaderMultiplication; | ||
public final ModConfigSpec.IntValue quantumComputerDataEntanglerMultiplication; | ||
|
||
public CommonConfig() { | ||
var builder = new ModConfigSpec.Builder(); | ||
|
||
builder.push("quantum computer"); | ||
quantumComputerMaxSize = define( | ||
builder, | ||
"quantumComputerMaxSize", | ||
5, | ||
5, | ||
16, | ||
"Define the maximum dimensions of the Quantum Computer Multiblock."); | ||
quantumComputerMaxMultiThreaders = define( | ||
builder, | ||
"quantumComputerMaxMultiThreaders", | ||
1, | ||
0, | ||
2, | ||
"Define the maximum amount of multi threaders per Quantum Computer Multiblock."); | ||
quantumComputermaxDataEntanglers = define( | ||
builder, | ||
"quantumComputermaxDataEntanglers", | ||
1, | ||
0, | ||
2, | ||
"Define the maximum amount of Data Entanglers per Quantum Computer Multiblock."); | ||
quantumComputerMultiThreaderMultiplication = define( | ||
builder, | ||
"quantumComputerMultiThreaderMultiplication", | ||
4, | ||
2, | ||
8, | ||
"Define the multiplication factor of the multi threaders."); | ||
quantumComputerDataEntanglerMultiplication = define( | ||
builder, | ||
"quantumComputerDataEntanglerMultiplication", | ||
4, | ||
2, | ||
8, | ||
"Define the multiplication factor of the data entanglers."); | ||
builder.pop(); | ||
|
||
this.spec = builder.build(); | ||
} | ||
|
||
private static ModConfigSpec.IntValue define( | ||
ModConfigSpec.Builder builder, String name, int defaultValue, String comment) { | ||
builder.comment(comment); | ||
return define(builder, name, defaultValue); | ||
} | ||
|
||
private static ModConfigSpec.IntValue define( | ||
ModConfigSpec.Builder builder, String name, int defaultValue, int min, int max, String comment) { | ||
builder.comment(comment); | ||
return define(builder, name, defaultValue, min, max); | ||
} | ||
|
||
private static ModConfigSpec.IntValue define( | ||
ModConfigSpec.Builder builder, String name, int defaultValue, int min, int max) { | ||
return builder.defineInRange(name, defaultValue, min, max); | ||
} | ||
|
||
private static ModConfigSpec.IntValue define(ModConfigSpec.Builder builder, String name, int defaultValue) { | ||
return define(builder, name, defaultValue, Integer.MIN_VALUE, Integer.MAX_VALUE); | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
2 changes: 1 addition & 1 deletion
2
src/main/java/net/pedroksl/advanced_ae/xmod/emi/recipes/AAERecipeCategory.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters