2013-12-22 07:49:55 +01:00
|
|
|
package mekanism.common.network;
|
|
|
|
|
2014-06-02 23:57:40 +02:00
|
|
|
import io.netty.buffer.ByteBuf;
|
2014-06-16 02:09:31 +02:00
|
|
|
import mekanism.common.EnergyDisplay.EnergyType;
|
2014-01-03 20:26:41 +01:00
|
|
|
import mekanism.common.IModule;
|
2013-12-22 07:49:55 +01:00
|
|
|
import mekanism.common.Mekanism;
|
2014-06-11 11:57:49 +02:00
|
|
|
import mekanism.common.network.PacketConfigSync.ConfigSyncMessage;
|
|
|
|
import cpw.mods.fml.common.network.simpleimpl.IMessage;
|
|
|
|
import cpw.mods.fml.common.network.simpleimpl.IMessageHandler;
|
|
|
|
import cpw.mods.fml.common.network.simpleimpl.MessageContext;
|
2013-12-22 07:49:55 +01:00
|
|
|
|
2014-06-11 11:57:49 +02:00
|
|
|
public class PacketConfigSync implements IMessageHandler<ConfigSyncMessage, IMessage>
|
2013-12-22 07:49:55 +01:00
|
|
|
{
|
2014-06-02 17:33:19 +02:00
|
|
|
@Override
|
2014-06-11 11:57:49 +02:00
|
|
|
public IMessage onMessage(ConfigSyncMessage message, MessageContext context)
|
2014-03-08 02:00:25 +01:00
|
|
|
{
|
2014-06-11 11:57:49 +02:00
|
|
|
return null;
|
2013-12-22 07:49:55 +01:00
|
|
|
}
|
2014-06-11 11:57:49 +02:00
|
|
|
|
|
|
|
public static class ConfigSyncMessage implements IMessage
|
2014-04-20 22:15:44 +02:00
|
|
|
{
|
2014-06-11 11:57:49 +02:00
|
|
|
public ConfigSyncMessage() {}
|
|
|
|
|
|
|
|
@Override
|
|
|
|
public void toBytes(ByteBuf dataStream)
|
2014-06-02 17:33:19 +02:00
|
|
|
{
|
2014-06-11 11:57:49 +02:00
|
|
|
dataStream.writeBoolean(Mekanism.updateNotifications);
|
|
|
|
dataStream.writeBoolean(Mekanism.controlCircuitOreDict);
|
|
|
|
dataStream.writeBoolean(Mekanism.logPackets);
|
|
|
|
dataStream.writeBoolean(Mekanism.dynamicTankEasterEgg);
|
|
|
|
dataStream.writeBoolean(Mekanism.voiceServerEnabled);
|
|
|
|
dataStream.writeBoolean(Mekanism.cardboardSpawners);
|
2014-07-17 05:53:00 +02:00
|
|
|
dataStream.writeBoolean(Mekanism.creativeOverrideElectricChest);
|
2014-07-17 05:59:07 +02:00
|
|
|
dataStream.writeBoolean(Mekanism.spawnBabySkeletons);
|
2014-06-11 11:57:49 +02:00
|
|
|
dataStream.writeInt(Mekanism.obsidianTNTDelay);
|
|
|
|
dataStream.writeInt(Mekanism.obsidianTNTBlastRadius);
|
|
|
|
dataStream.writeInt(Mekanism.UPDATE_DELAY);
|
|
|
|
dataStream.writeDouble(Mekanism.FROM_IC2);
|
|
|
|
dataStream.writeDouble(Mekanism.TO_IC2);
|
|
|
|
dataStream.writeDouble(Mekanism.FROM_BC);
|
|
|
|
dataStream.writeDouble(Mekanism.TO_BC);
|
|
|
|
dataStream.writeDouble(Mekanism.FROM_H2);
|
|
|
|
dataStream.writeDouble(Mekanism.ENERGY_PER_REDSTONE);
|
|
|
|
dataStream.writeInt(Mekanism.VOICE_PORT);
|
|
|
|
dataStream.writeInt(Mekanism.maxUpgradeMultiplier);
|
2014-06-16 02:09:31 +02:00
|
|
|
dataStream.writeInt(Mekanism.activeType.ordinal());
|
2014-06-11 11:57:49 +02:00
|
|
|
|
|
|
|
dataStream.writeDouble(Mekanism.enrichmentChamberUsage);
|
|
|
|
dataStream.writeDouble(Mekanism.osmiumCompressorUsage);
|
|
|
|
dataStream.writeDouble(Mekanism.combinerUsage);
|
|
|
|
dataStream.writeDouble(Mekanism.crusherUsage);
|
|
|
|
dataStream.writeDouble(Mekanism.factoryUsage);
|
|
|
|
dataStream.writeDouble(Mekanism.metallurgicInfuserUsage);
|
|
|
|
dataStream.writeDouble(Mekanism.purificationChamberUsage);
|
|
|
|
dataStream.writeDouble(Mekanism.energizedSmelterUsage);
|
|
|
|
dataStream.writeDouble(Mekanism.digitalMinerUsage);
|
|
|
|
dataStream.writeDouble(Mekanism.electricPumpUsage);
|
|
|
|
dataStream.writeDouble(Mekanism.rotaryCondensentratorUsage);
|
|
|
|
dataStream.writeDouble(Mekanism.oxidationChamberUsage);
|
|
|
|
dataStream.writeDouble(Mekanism.chemicalInfuserUsage);
|
|
|
|
dataStream.writeDouble(Mekanism.chemicalInjectionChamberUsage);
|
|
|
|
dataStream.writeDouble(Mekanism.precisionSawmillUsage);
|
|
|
|
dataStream.writeDouble(Mekanism.chemicalDissolutionChamberUsage);
|
|
|
|
dataStream.writeDouble(Mekanism.chemicalWasherUsage);
|
|
|
|
dataStream.writeDouble(Mekanism.chemicalCrystallizerUsage);
|
|
|
|
dataStream.writeDouble(Mekanism.seismicVibratorUsage);
|
2014-06-19 12:42:59 +02:00
|
|
|
dataStream.writeDouble(Mekanism.fluidicPlenisherUsage);
|
2014-06-11 11:57:49 +02:00
|
|
|
|
|
|
|
try {
|
|
|
|
for(IModule module : Mekanism.modulesLoaded)
|
|
|
|
{
|
|
|
|
module.writeConfig(dataStream);
|
|
|
|
}
|
|
|
|
} catch(Exception e) {
|
|
|
|
e.printStackTrace();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
@Override
|
|
|
|
public void fromBytes(ByteBuf dataStream)
|
|
|
|
{
|
|
|
|
Mekanism.updateNotifications = dataStream.readBoolean();
|
|
|
|
Mekanism.controlCircuitOreDict = dataStream.readBoolean();
|
|
|
|
Mekanism.logPackets = dataStream.readBoolean();
|
|
|
|
Mekanism.dynamicTankEasterEgg = dataStream.readBoolean();
|
|
|
|
Mekanism.voiceServerEnabled = dataStream.readBoolean();
|
|
|
|
Mekanism.cardboardSpawners = dataStream.readBoolean();
|
2014-07-17 05:53:00 +02:00
|
|
|
Mekanism.creativeOverrideElectricChest = dataStream.readBoolean();
|
2014-07-17 05:59:07 +02:00
|
|
|
Mekanism.spawnBabySkeletons = dataStream.readBoolean();
|
2014-06-11 11:57:49 +02:00
|
|
|
Mekanism.obsidianTNTDelay = dataStream.readInt();
|
|
|
|
Mekanism.obsidianTNTBlastRadius = dataStream.readInt();
|
|
|
|
Mekanism.UPDATE_DELAY = dataStream.readInt();
|
|
|
|
Mekanism.FROM_IC2 = dataStream.readDouble();
|
|
|
|
Mekanism.TO_IC2 = dataStream.readDouble();
|
|
|
|
Mekanism.FROM_BC = dataStream.readDouble();
|
|
|
|
Mekanism.TO_BC = dataStream.readDouble();
|
|
|
|
Mekanism.FROM_H2 = dataStream.readDouble();
|
|
|
|
Mekanism.ENERGY_PER_REDSTONE = dataStream.readDouble();
|
|
|
|
Mekanism.VOICE_PORT = dataStream.readInt();
|
|
|
|
Mekanism.maxUpgradeMultiplier = dataStream.readInt();
|
2014-06-16 02:09:31 +02:00
|
|
|
Mekanism.activeType = EnergyType.values()[dataStream.readInt()];
|
2014-06-11 11:57:49 +02:00
|
|
|
|
|
|
|
Mekanism.TO_TE = Mekanism.TO_BC*10;
|
|
|
|
Mekanism.FROM_TE = Mekanism.FROM_BC/10;
|
|
|
|
|
|
|
|
Mekanism.enrichmentChamberUsage = dataStream.readDouble();
|
|
|
|
Mekanism.osmiumCompressorUsage = dataStream.readDouble();
|
|
|
|
Mekanism.combinerUsage = dataStream.readDouble();
|
|
|
|
Mekanism.crusherUsage = dataStream.readDouble();
|
|
|
|
Mekanism.factoryUsage = dataStream.readDouble();
|
|
|
|
Mekanism.metallurgicInfuserUsage = dataStream.readDouble();
|
|
|
|
Mekanism.purificationChamberUsage = dataStream.readDouble();
|
|
|
|
Mekanism.energizedSmelterUsage = dataStream.readDouble();
|
|
|
|
Mekanism.digitalMinerUsage = dataStream.readDouble();
|
|
|
|
Mekanism.electricPumpUsage = dataStream.readDouble();
|
|
|
|
Mekanism.rotaryCondensentratorUsage = dataStream.readDouble();
|
|
|
|
Mekanism.oxidationChamberUsage = dataStream.readDouble();
|
|
|
|
Mekanism.chemicalInfuserUsage = dataStream.readDouble();
|
|
|
|
Mekanism.chemicalInjectionChamberUsage = dataStream.readDouble();
|
|
|
|
Mekanism.precisionSawmillUsage = dataStream.readDouble();
|
|
|
|
Mekanism.chemicalDissolutionChamberUsage = dataStream.readDouble();
|
|
|
|
Mekanism.chemicalWasherUsage = dataStream.readDouble();
|
|
|
|
Mekanism.chemicalCrystallizerUsage = dataStream.readDouble();
|
|
|
|
Mekanism.seismicVibratorUsage = dataStream.readDouble();
|
2014-06-19 12:42:59 +02:00
|
|
|
Mekanism.fluidicPlenisherUsage = dataStream.readDouble();
|
2014-06-11 11:57:49 +02:00
|
|
|
|
|
|
|
try {
|
|
|
|
for(IModule module : Mekanism.modulesLoaded)
|
|
|
|
{
|
|
|
|
module.readConfig(dataStream);
|
|
|
|
}
|
|
|
|
} catch(Exception e) {
|
|
|
|
e.printStackTrace();
|
|
|
|
}
|
|
|
|
|
|
|
|
Mekanism.proxy.onConfigSync();
|
2014-06-02 17:33:19 +02:00
|
|
|
}
|
2014-04-20 22:15:44 +02:00
|
|
|
}
|
2013-12-22 07:49:55 +01:00
|
|
|
}
|