Skip to content

Commit

Permalink
port terralizationcompat stuff to mekanism ce
Browse files Browse the repository at this point in the history
fixes #30
also voiceserver is now disabled by default
  • Loading branch information
maggi373 committed Sep 4, 2022
1 parent 293f109 commit fb92953
Show file tree
Hide file tree
Showing 5 changed files with 76 additions and 9 deletions.
5 changes: 4 additions & 1 deletion src/main/java/mekanism/api/MekanismConfig.java
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ public static class general
public static boolean controlCircuitOreDict = true;
public static boolean logPackets = false;
public static boolean dynamicTankEasterEgg = false;
public static boolean voiceServerEnabled = true;
public static boolean voiceServerEnabled = false;
public static boolean cardboardSpawners = true;
public static boolean enableWorldRegeneration = true;
public static boolean spawnBabySkeletons = true;
Expand Down Expand Up @@ -67,6 +67,9 @@ public static class general
public static double heatPerFuelTick = 4;
public static boolean allowTransmitterAlloyUpgrade;
public static boolean allowProtection = true;
public static boolean EnableQuartzCompat;
public static boolean EnableDiamondCompat;
public static boolean EnablePoorOresCompat;
}

public static class client
Expand Down
6 changes: 5 additions & 1 deletion src/main/java/mekanism/common/CommonProxy.java
Original file line number Diff line number Diff line change
Expand Up @@ -252,7 +252,7 @@ public void loadConfiguration()
general.controlCircuitOreDict = Mekanism.configuration.get(Configuration.CATEGORY_GENERAL, "ControlCircuitOreDict", true).getBoolean();
general.logPackets = Mekanism.configuration.get(Configuration.CATEGORY_GENERAL, "LogPackets", false).getBoolean();
general.dynamicTankEasterEgg = Mekanism.configuration.get(Configuration.CATEGORY_GENERAL, "DynamicTankEasterEgg", false).getBoolean();
general.voiceServerEnabled = Mekanism.configuration.get(Configuration.CATEGORY_GENERAL, "VoiceServerEnabled", true).getBoolean();
general.voiceServerEnabled = Mekanism.configuration.get(Configuration.CATEGORY_GENERAL, "VoiceServerEnabled", false).getBoolean();
general.cardboardSpawners = Mekanism.configuration.get(Configuration.CATEGORY_GENERAL, "AllowSpawnerBoxPickup", true).getBoolean();
general.enableWorldRegeneration = Mekanism.configuration.get(Configuration.CATEGORY_GENERAL, "EnableWorldRegeneration", false).getBoolean();
general.spawnBabySkeletons = Mekanism.configuration.get(Configuration.CATEGORY_GENERAL, "SpawnBabySkeletons", true).getBoolean();
Expand Down Expand Up @@ -302,6 +302,10 @@ public void loadConfiguration()

general.blacklistIC2 = Mekanism.configuration.get(Configuration.CATEGORY_GENERAL, "BlacklistIC2Power", false).getBoolean();
general.blacklistRF = Mekanism.configuration.get(Configuration.CATEGORY_GENERAL, "BlacklistRFPower", false).getBoolean();

general.EnableQuartzCompat = Mekanism.configuration.get(Configuration.CATEGORY_GENERAL, "EnableQuartzCompat", true).getBoolean();
general.EnableDiamondCompat = Mekanism.configuration.get(Configuration.CATEGORY_GENERAL, "EnableDiamondCompat", true).getBoolean();
general.EnablePoorOresCompat = Mekanism.configuration.get(Configuration.CATEGORY_GENERAL, "EnablePoorOresCompat", true).getBoolean();

String s = Mekanism.configuration.get(Configuration.CATEGORY_GENERAL, "EnergyType", "J", null, new String[]{"J", "RF", "MJ", "EU"}).getString();

Expand Down
13 changes: 6 additions & 7 deletions src/main/java/mekanism/common/Mekanism.java
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
import java.util.Set;
import java.util.UUID;

import cpw.mods.fml.common.event.*;
import mekanism.api.Coord4D;
import mekanism.api.EnumColor;
import mekanism.api.MekanismAPI;
Expand Down Expand Up @@ -124,13 +125,6 @@
import cpw.mods.fml.common.Mod.EventHandler;
import cpw.mods.fml.common.Mod.Instance;
import cpw.mods.fml.common.SidedProxy;
import cpw.mods.fml.common.event.FMLInitializationEvent;
import cpw.mods.fml.common.event.FMLInterModComms;
import cpw.mods.fml.common.event.FMLLoadCompleteEvent;
import cpw.mods.fml.common.event.FMLPostInitializationEvent;
import cpw.mods.fml.common.event.FMLPreInitializationEvent;
import cpw.mods.fml.common.event.FMLServerStartingEvent;
import cpw.mods.fml.common.event.FMLServerStoppingEvent;
import cpw.mods.fml.common.eventhandler.SubscribeEvent;
import cpw.mods.fml.common.network.NetworkRegistry;
import cpw.mods.fml.common.registry.EntityRegistry;
Expand Down Expand Up @@ -1329,6 +1323,11 @@ public void postInit(FMLPostInitializationEvent event)
logger.info("Hooking complete.");
}

@Mod.EventHandler
public void onServerAboutToStart(FMLServerAboutToStartEvent event) {
OreDictManager.terralizationcompat();
}

@SubscribeEvent
public void onEnergyTransferred(EnergyTransferEvent event)
{
Expand Down
55 changes: 55 additions & 0 deletions src/main/java/mekanism/common/integration/OreDictManager.java
Original file line number Diff line number Diff line change
Expand Up @@ -7,10 +7,13 @@
import java.util.Arrays;
import java.util.List;

import mekanism.api.ItemRetriever;
import mekanism.api.MekanismConfig;
import mekanism.api.gas.GasRegistry;
import mekanism.api.gas.GasStack;
import mekanism.api.infuse.InfuseObject;
import mekanism.api.infuse.InfuseRegistry;
import mekanism.api.recipe.RecipeHelper;
import mekanism.api.util.StackUtils;
import mekanism.common.Mekanism;
import mekanism.common.MekanismItems;
Expand Down Expand Up @@ -384,4 +387,56 @@ public boolean canInteractWith(EntityPlayer player)
}
}
}
public static void terralizationcompat() {
if (MekanismConfig.general.EnableQuartzCompat) {
// Enrich quartz dust into quartz
for (ItemStack ore : OreDictionary.getOres("dustQuartz")) {
RecipeHelper.addEnrichmentChamberRecipe(StackUtils.size(ore, 1), new ItemStack(Items.quartz));
}
for (ItemStack ore : OreDictionary.getOres("dustNetherQuartz")) {
RecipeHelper.addEnrichmentChamberRecipe(StackUtils.size(ore, 1), new ItemStack(Items.quartz));
}
// Enrich quartz ore into 2 quartz dust
for (ItemStack ore : OreDictionary.getOres("dustQuartz")) {
RecipeHelper.addEnrichmentChamberRecipe(new ItemStack(Blocks.quartz_ore), StackUtils.size(ore, 2));
}
for (ItemStack ore : OreDictionary.getOres("dustNetherQuartz")) {
RecipeHelper.addEnrichmentChamberRecipe(new ItemStack(Blocks.quartz_ore), StackUtils.size(ore, 2));
}
}
// Add gemdiamond oredict for compressed diamond
if (MekanismConfig.general.EnableDiamondCompat) {
for (ItemStack ore : OreDictionary.getOres("gemDiamond")) {
InfuseRegistry.registerInfuseObject(ore, new InfuseObject(InfuseRegistry.get("DIAMOND"), 10));
RecipeHelper.addEnrichmentChamberRecipe(StackUtils.size(ore, 1), ItemRetriever.getItem("CompressedDiamond"));
}
}
if (MekanismConfig.general.EnablePoorOresCompat) {
for (ItemStack ore : OreDictionary.getOres("orePoorIron")) {
for (ItemStack ore2 : OreDictionary.getOres("clumpIron")) {
RecipeHelper.addPurificationChamberRecipe(ore, ore2);
}
}
for (ItemStack ore : OreDictionary.getOres("orePoorGold")) {
for (ItemStack ore2 : OreDictionary.getOres("clumpGold")) {
RecipeHelper.addPurificationChamberRecipe(ore, ore2);
}
}
for (ItemStack ore : OreDictionary.getOres("orePoorCopper")) {
for (ItemStack ore2 : OreDictionary.getOres("clumpCopper")) {
RecipeHelper.addPurificationChamberRecipe(ore, ore2);
}
}
for (ItemStack ore : OreDictionary.getOres("orePoorTin")) {
for (ItemStack ore2 : OreDictionary.getOres("clumpTin")) {
RecipeHelper.addPurificationChamberRecipe(ore, ore2);
}
}
for (ItemStack ore : OreDictionary.getOres("orePoorLead")) {
for (ItemStack ore2 : OreDictionary.getOres("clumpLead")) {
RecipeHelper.addPurificationChamberRecipe(ore, ore2);
}
}
}
}
}
6 changes: 6 additions & 0 deletions src/main/java/mekanism/common/network/PacketConfigSync.java
Original file line number Diff line number Diff line change
Expand Up @@ -73,6 +73,9 @@ public void toBytes(ByteBuf dataStream)
dataStream.writeDouble(general.heatPerFuelTick);
dataStream.writeBoolean(general.allowTransmitterAlloyUpgrade);
dataStream.writeBoolean(general.allowProtection);
dataStream.writeBoolean(general.EnableQuartzCompat);
dataStream.writeBoolean(general.EnableDiamondCompat);
dataStream.writeBoolean(general.EnablePoorOresCompat);

for(MachineType type : MachineType.getValidMachines())
{
Expand Down Expand Up @@ -162,6 +165,9 @@ public void fromBytes(ByteBuf dataStream)
general.heatPerFuelTick = dataStream.readDouble();
general.allowTransmitterAlloyUpgrade = dataStream.readBoolean();
general.allowProtection = dataStream.readBoolean();
general.EnableQuartzCompat = dataStream.readBoolean();
general.EnableDiamondCompat = dataStream.readBoolean();
general.EnablePoorOresCompat = dataStream.readBoolean();

for(MachineType type : MachineType.getValidMachines())
{
Expand Down

0 comments on commit fb92953

Please sign in to comment.