mirror of
https://github.com/Thorfusion/Mekanism-Community-Edition.git
synced 2026-11-26 14:52:58 +00:00
Port config rewrite (#5378)
Port Config system, Remove some unused code, Refactored various Tier enums out into their own package
This commit is contained in:
1 parent
a776879eed
commit
9d98ef575d
209 files changed
+3275
-2763
No files matched your search
@@ -26,15 +26,14 @@ import mekanism.api.transmitters.DynamicNetwork.NetworkClientRequest;
|
||||
import mekanism.api.transmitters.DynamicNetwork.TransmittersAddedEvent;
|
||||
import mekanism.api.transmitters.TransmitterNetworkRegistry;
|
||||
import mekanism.client.ClientTickHandler;
|
||||
import mekanism.common.Tier.BaseTier;
|
||||
import mekanism.common.tier.BaseTier;
|
||||
import mekanism.common.base.IModule;
|
||||
import mekanism.common.block.states.BlockStateMachine;
|
||||
import mekanism.common.block.states.BlockStateTransmitter.TransmitterType;
|
||||
import mekanism.common.capabilities.Capabilities;
|
||||
import mekanism.common.chunkloading.ChunkManager;
|
||||
import mekanism.common.command.CommandMek;
|
||||
import mekanism.common.config.MekanismConfig.general;
|
||||
import mekanism.common.config.MekanismConfig.usage;
|
||||
import mekanism.common.config.MekanismConfig;
|
||||
import mekanism.common.content.boiler.SynchronizedBoilerData;
|
||||
import mekanism.common.content.entangloporter.InventoryFrequency;
|
||||
import mekanism.common.content.matrix.SynchronizedMatrixData;
|
||||
@@ -358,7 +357,8 @@ public class Mekanism {
|
||||
new ItemStack(MekanismItems.Ingot, 1, 6), 0.0F);
|
||||
|
||||
//Enrichment Chamber Recipes
|
||||
if (general.machinesManager.isEnabled(BlockStateMachine.MachineType.ENRICHMENT_CHAMBER)) {
|
||||
if (MekanismConfig.current().general.machinesManager
|
||||
.isEnabled(BlockStateMachine.MachineType.ENRICHMENT_CHAMBER)) {
|
||||
RecipeHandler
|
||||
.addEnrichmentChamberRecipe(new ItemStack(Blocks.REDSTONE_ORE), new ItemStack(Items.REDSTONE, 12));
|
||||
RecipeHandler.addEnrichmentChamberRecipe(new ItemStack(Blocks.OBSIDIAN),
|
||||
@@ -405,7 +405,7 @@ public class Mekanism {
|
||||
}
|
||||
|
||||
//Combiner recipes
|
||||
if (general.machinesManager.isEnabled(BlockStateMachine.MachineType.COMBINER)) {
|
||||
if (MekanismConfig.current().general.machinesManager.isEnabled(BlockStateMachine.MachineType.COMBINER)) {
|
||||
RecipeHandler.addCombinerRecipe(new ItemStack(Items.REDSTONE, 16), new ItemStack(Blocks.COBBLESTONE),
|
||||
new ItemStack(Blocks.REDSTONE_ORE));
|
||||
RecipeHandler.addCombinerRecipe(new ItemStack(Items.DYE, 16, 4), new ItemStack(Blocks.COBBLESTONE),
|
||||
@@ -421,13 +421,14 @@ public class Mekanism {
|
||||
}
|
||||
|
||||
//Osmium Compressor Recipes
|
||||
if (general.machinesManager.isEnabled(BlockStateMachine.MachineType.OSMIUM_COMPRESSOR)) {
|
||||
if (MekanismConfig.current().general.machinesManager
|
||||
.isEnabled(BlockStateMachine.MachineType.OSMIUM_COMPRESSOR)) {
|
||||
RecipeHandler.addOsmiumCompressorRecipe(new ItemStack(Items.GLOWSTONE_DUST),
|
||||
new ItemStack(MekanismItems.Ingot, 1, 3));
|
||||
}
|
||||
|
||||
//Crusher Recipes
|
||||
if (general.machinesManager.isEnabled(BlockStateMachine.MachineType.CRUSHER)) {
|
||||
if (MekanismConfig.current().general.machinesManager.isEnabled(BlockStateMachine.MachineType.CRUSHER)) {
|
||||
RecipeHandler.addCrusherRecipe(new ItemStack(Items.DIAMOND), new ItemStack(MekanismItems.OtherDust, 1, 0));
|
||||
RecipeHandler.addCrusherRecipe(new ItemStack(Items.IRON_INGOT),
|
||||
new ItemStack(MekanismItems.Dust, 1, Resource.IRON.ordinal()));
|
||||
@@ -472,12 +473,14 @@ public class Mekanism {
|
||||
}
|
||||
|
||||
//Purification Chamber Recipes
|
||||
if (general.machinesManager.isEnabled(BlockStateMachine.MachineType.PURIFICATION_CHAMBER)) {
|
||||
if (MekanismConfig.current().general.machinesManager
|
||||
.isEnabled(BlockStateMachine.MachineType.PURIFICATION_CHAMBER)) {
|
||||
RecipeHandler.addPurificationChamberRecipe(new ItemStack(Blocks.GRAVEL), new ItemStack(Items.FLINT));
|
||||
}
|
||||
|
||||
//Chemical Injection Chamber Recipes
|
||||
if (general.machinesManager.isEnabled(BlockStateMachine.MachineType.CHEMICAL_INJECTION_CHAMBER)) {
|
||||
if (MekanismConfig.current().general.machinesManager
|
||||
.isEnabled(BlockStateMachine.MachineType.CHEMICAL_INJECTION_CHAMBER)) {
|
||||
RecipeHandler.addChemicalInjectionChamberRecipe(new ItemStack(Blocks.DIRT), MekanismFluids.Water,
|
||||
new ItemStack(Blocks.CLAY));
|
||||
RecipeHandler.addChemicalInjectionChamberRecipe(new ItemStack(Blocks.HARDENED_CLAY), MekanismFluids.Water,
|
||||
@@ -490,7 +493,8 @@ public class Mekanism {
|
||||
}
|
||||
|
||||
//Precision Sawmill Recipes
|
||||
if (general.machinesManager.isEnabled(BlockStateMachine.MachineType.PRECISION_SAWMILL)) {
|
||||
if (MekanismConfig.current().general.machinesManager
|
||||
.isEnabled(BlockStateMachine.MachineType.PRECISION_SAWMILL)) {
|
||||
RecipeHandler.addPrecisionSawmillRecipe(new ItemStack(Blocks.LADDER, 3), new ItemStack(Items.STICK, 7));
|
||||
RecipeHandler.addPrecisionSawmillRecipe(new ItemStack(Blocks.TORCH, 4), new ItemStack(Items.STICK),
|
||||
new ItemStack(Items.COAL), 1);
|
||||
@@ -546,7 +550,8 @@ public class Mekanism {
|
||||
}
|
||||
|
||||
//Metallurgic Infuser Recipes
|
||||
if (general.machinesManager.isEnabled(BlockStateMachine.MachineType.METALLURGIC_INFUSER)) {
|
||||
if (MekanismConfig.current().general.machinesManager
|
||||
.isEnabled(BlockStateMachine.MachineType.METALLURGIC_INFUSER)) {
|
||||
RecipeHandler.addMetallurgicInfuserRecipe(InfuseRegistry.get("CARBON"), 10, new ItemStack(Items.IRON_INGOT),
|
||||
new ItemStack(MekanismItems.EnrichedIron));
|
||||
RecipeHandler.addMetallurgicInfuserRecipe(InfuseRegistry.get("CARBON"), 10,
|
||||
@@ -572,7 +577,8 @@ public class Mekanism {
|
||||
}
|
||||
|
||||
//Chemical Infuser Recipes
|
||||
if (general.machinesManager.isEnabled(BlockStateMachine.MachineType.CHEMICAL_INFUSER)) {
|
||||
if (MekanismConfig.current().general.machinesManager
|
||||
.isEnabled(BlockStateMachine.MachineType.CHEMICAL_INFUSER)) {
|
||||
RecipeHandler.addChemicalInfuserRecipe(new GasStack(MekanismFluids.Oxygen, 1),
|
||||
new GasStack(MekanismFluids.SulfurDioxide, 2), new GasStack(MekanismFluids.SulfurTrioxide, 2));
|
||||
RecipeHandler.addChemicalInfuserRecipe(new GasStack(MekanismFluids.SulfurTrioxide, 1),
|
||||
@@ -584,13 +590,17 @@ public class Mekanism {
|
||||
}
|
||||
|
||||
//Electrolytic Separator Recipes
|
||||
if (general.machinesManager.isEnabled(BlockStateMachine.MachineType.ELECTROLYTIC_SEPARATOR)) {
|
||||
RecipeHandler.addElectrolyticSeparatorRecipe(FluidRegistry.getFluidStack("water", 2), 2 * general.FROM_H2,
|
||||
if (MekanismConfig.current().general.machinesManager
|
||||
.isEnabled(BlockStateMachine.MachineType.ELECTROLYTIC_SEPARATOR)) {
|
||||
RecipeHandler.addElectrolyticSeparatorRecipe(FluidRegistry.getFluidStack("water", 2),
|
||||
2 * MekanismConfig.current().general.FROM_H2.val(),
|
||||
new GasStack(MekanismFluids.Hydrogen, 2), new GasStack(MekanismFluids.Oxygen, 1));
|
||||
RecipeHandler.addElectrolyticSeparatorRecipe(FluidRegistry.getFluidStack("brine", 10), 2 * general.FROM_H2,
|
||||
RecipeHandler.addElectrolyticSeparatorRecipe(FluidRegistry.getFluidStack("brine", 10),
|
||||
2 * MekanismConfig.current().general.FROM_H2.val(),
|
||||
new GasStack(MekanismFluids.Sodium, 1), new GasStack(MekanismFluids.Chlorine, 1));
|
||||
RecipeHandler.addElectrolyticSeparatorRecipe(FluidRegistry.getFluidStack("heavywater", 2),
|
||||
usage.heavyWaterElectrolysisUsage, new GasStack(MekanismFluids.Deuterium, 2),
|
||||
MekanismConfig.current().usage.heavyWaterElectrolysisUsage.val(),
|
||||
new GasStack(MekanismFluids.Deuterium, 2),
|
||||
new GasStack(MekanismFluids.Oxygen, 1));
|
||||
}
|
||||
|
||||
@@ -601,7 +611,8 @@ public class Mekanism {
|
||||
FluidRegistry.getFluidStack("liquidlithium", 1));
|
||||
|
||||
//Chemical Crystallizer Recipes
|
||||
if (general.machinesManager.isEnabled(BlockStateMachine.MachineType.CHEMICAL_CRYSTALLIZER)) {
|
||||
if (MekanismConfig.current().general.machinesManager
|
||||
.isEnabled(BlockStateMachine.MachineType.CHEMICAL_CRYSTALLIZER)) {
|
||||
RecipeHandler.addChemicalCrystallizerRecipe(new GasStack(MekanismFluids.Lithium, 100),
|
||||
new ItemStack(MekanismItems.OtherDust, 1, 4));
|
||||
RecipeHandler.addChemicalCrystallizerRecipe(new GasStack(MekanismFluids.Brine, 15),
|
||||
@@ -613,14 +624,15 @@ public class Mekanism {
|
||||
if (gas instanceof OreGas && !((OreGas) gas).isClean()) {
|
||||
OreGas oreGas = (OreGas) gas;
|
||||
|
||||
if (general.machinesManager.isEnabled(BlockStateMachine.MachineType.CHEMICAL_WASHER)) {
|
||||
if (MekanismConfig.current().general.machinesManager
|
||||
.isEnabled(BlockStateMachine.MachineType.CHEMICAL_WASHER)) {
|
||||
RecipeHandler
|
||||
.addChemicalWasherRecipe(new GasStack(oreGas, 1), new GasStack(oreGas.getCleanGas(), 1));
|
||||
}
|
||||
|
||||
//do the crystallizer only if it's one of ours!
|
||||
Resource gasResource = Resource.getFromName(oreGas.getName());
|
||||
if (gasResource != null && general.machinesManager
|
||||
if (gasResource != null && MekanismConfig.current().general.machinesManager
|
||||
.isEnabled(BlockStateMachine.MachineType.CHEMICAL_CRYSTALLIZER)) {
|
||||
RecipeHandler.addChemicalCrystallizerRecipe(new GasStack(oreGas.getCleanGas(), 200),
|
||||
new ItemStack(MekanismItems.Crystal, 1, gasResource.ordinal()));
|
||||
@@ -629,7 +641,8 @@ public class Mekanism {
|
||||
}
|
||||
|
||||
//Pressurized Reaction Chamber Recipes
|
||||
if (general.machinesManager.isEnabled(BlockStateMachine.MachineType.PRESSURIZED_REACTION_CHAMBER)) {
|
||||
if (MekanismConfig.current().general.machinesManager
|
||||
.isEnabled(BlockStateMachine.MachineType.PRESSURIZED_REACTION_CHAMBER)) {
|
||||
RecipeHandler.addPRCRecipe(
|
||||
new ItemStack(MekanismItems.BioFuel, 2), new FluidStack(FluidRegistry.WATER, 10),
|
||||
new GasStack(MekanismFluids.Hydrogen, 100),
|
||||
@@ -654,7 +667,8 @@ public class Mekanism {
|
||||
}
|
||||
|
||||
//Solar Neutron Activator Recipes
|
||||
if (general.machinesManager.isEnabled(BlockStateMachine.MachineType.SOLAR_NEUTRON_ACTIVATOR)) {
|
||||
if (MekanismConfig.current().general.machinesManager
|
||||
.isEnabled(BlockStateMachine.MachineType.SOLAR_NEUTRON_ACTIVATOR)) {
|
||||
RecipeHandler.addSolarNeutronRecipe(new GasStack(MekanismFluids.Lithium, 1),
|
||||
new GasStack(MekanismFluids.Tritium, 1));
|
||||
}
|
||||
@@ -688,7 +702,7 @@ public class Mekanism {
|
||||
new InfuseObject(InfuseRegistry.get("OBSIDIAN"), 80));
|
||||
|
||||
//Fuel Gases
|
||||
FuelHandler.addGas(MekanismFluids.Hydrogen, 1, general.FROM_H2);
|
||||
FuelHandler.addGas(MekanismFluids.Hydrogen, 1, MekanismConfig.current().general.FROM_H2.val());
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -764,7 +778,7 @@ public class Mekanism {
|
||||
OreDictionary.registerOre("oreCopper", new ItemStack(MekanismBlocks.OreBlock, 1, 1));
|
||||
OreDictionary.registerOre("oreTin", new ItemStack(MekanismBlocks.OreBlock, 1, 2));
|
||||
|
||||
if (general.controlCircuitOreDict) {
|
||||
if (MekanismConfig.current().general.controlCircuitOreDict.val()) {
|
||||
OreDictionary.registerOre("circuitBasic", new ItemStack(MekanismItems.ControlCircuit, 1, 0));
|
||||
OreDictionary.registerOre("circuitAdvanced", new ItemStack(MekanismItems.ControlCircuit, 1, 1));
|
||||
OreDictionary.registerOre("circuitElite", new ItemStack(MekanismItems.ControlCircuit, 1, 2));
|
||||
@@ -869,7 +883,7 @@ public class Mekanism {
|
||||
|
||||
@EventHandler
|
||||
public void serverStarting(FMLServerStartingEvent event) {
|
||||
if (general.voiceServerEnabled) {
|
||||
if (MekanismConfig.current().general.voiceServerEnabled.val()) {
|
||||
voiceManager.start();
|
||||
}
|
||||
CommandMek.register(event);
|
||||
@@ -877,7 +891,7 @@ public class Mekanism {
|
||||
|
||||
@EventHandler
|
||||
public void serverStopping(FMLServerStoppingEvent event) {
|
||||
if (general.voiceServerEnabled) {
|
||||
if (MekanismConfig.current().general.voiceServerEnabled.val()) {
|
||||
voiceManager.stop();
|
||||
}
|
||||
|
||||
@@ -917,9 +931,6 @@ public class Mekanism {
|
||||
//Set the mod's configuration
|
||||
configuration = new Configuration(config);
|
||||
|
||||
//Register tier information
|
||||
Tier.init();
|
||||
|
||||
//Load configuration
|
||||
proxy.loadConfiguration();
|
||||
proxy.onConfigSync(false);
|
||||
@@ -992,7 +1003,7 @@ public class Mekanism {
|
||||
PacketSimpleGui.handlers.add(0, proxy);
|
||||
|
||||
//Set up VoiceServerManager
|
||||
if (general.voiceServerEnabled) {
|
||||
if (MekanismConfig.current().general.voiceServerEnabled.val()) {
|
||||
voiceManager = new VoiceServerManager();
|
||||
}
|
||||
|
||||
@@ -1000,7 +1011,7 @@ public class Mekanism {
|
||||
TransmitterNetworkRegistry.initiate();
|
||||
|
||||
//Add baby skeleton spawner
|
||||
if (general.spawnBabySkeletons) {
|
||||
if (MekanismConfig.current().general.spawnBabySkeletons.val()) {
|
||||
for (Biome biome : BiomeProvider.allowedBiomes) {
|
||||
if (biome.getSpawnableList(EnumCreatureType.MONSTER) != null
|
||||
&& biome.getSpawnableList(EnumCreatureType.MONSTER).size() > 0) {
|
||||
@@ -1160,18 +1171,19 @@ public class Mekanism {
|
||||
NBTTagCompound nbtTags = event.getData();
|
||||
|
||||
nbtTags.setInteger("MekanismWorldGen", baseWorldGenVersion);
|
||||
nbtTags.setInteger("MekanismUserWorldGen", general.userWorldGenVersion);
|
||||
nbtTags.setInteger("MekanismUserWorldGen", MekanismConfig.current().general.userWorldGenVersion.val());
|
||||
}
|
||||
}
|
||||
|
||||
@SubscribeEvent
|
||||
public synchronized void onChunkDataLoad(ChunkDataEvent.Load event) {
|
||||
if (!event.getWorld().isRemote) {
|
||||
if (general.enableWorldRegeneration) {
|
||||
if (MekanismConfig.current().general.enableWorldRegeneration.val()) {
|
||||
NBTTagCompound loadData = event.getData();
|
||||
|
||||
if (loadData.getInteger("MekanismWorldGen") == baseWorldGenVersion
|
||||
&& loadData.getInteger("MekanismUserWorldGen") == general.userWorldGenVersion) {
|
||||
&& loadData.getInteger("MekanismUserWorldGen") == MekanismConfig
|
||||
.current().general.userWorldGenVersion.val()) {
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
Reference in new issue
Block a user