Redesigned Solar Evaporation Controller to dynamically update heat instead of the simple linear algorithm used before
- Plant height determines overall rate of temperature change, rate of processing - Biomes determine base temperature of plants, meaning a desert could process small amounts of brine on its own - Rate of heat decay exponentially increases as heat increases, meaning large amounts of heat are needed to greatly increase temperature - System of heat management designed for integration with heat API in near future
This commit is contained in:
parent
56d3a68199
commit
203890ca88
20 changed files with 134 additions and 407 deletions
|
@ -45,8 +45,6 @@ public class MekanismConfig
|
|||
public static boolean blacklistIC2;
|
||||
public static boolean blacklistRF;
|
||||
public static boolean destroyDisabledBlocks;
|
||||
public static boolean enableAmbientLighting;
|
||||
public static int ambientLightingLevel;
|
||||
public static boolean prefilledPortableTanks;
|
||||
public static double armoredJetpackDamageRatio;
|
||||
public static int armoredJetpackDamageMax;
|
||||
|
@ -59,6 +57,10 @@ public class MekanismConfig
|
|||
public static int maxPumpRange;
|
||||
public static boolean pumpWaterSources;
|
||||
public static int maxPlenisherNodes;
|
||||
public static double evaporationHeatDissipation = 0.02;
|
||||
public static double evaporationTempMultiplier = 0.1;
|
||||
public static double evaporationSolarMultiplier = 0.2;
|
||||
public static double evaporationMaxTemp = 3000;
|
||||
}
|
||||
|
||||
public static class client
|
||||
|
@ -72,6 +74,8 @@ public class MekanismConfig
|
|||
public static boolean oldTransmitterRender = false;
|
||||
public static boolean replaceSoundsWhenResuming = true;
|
||||
public static boolean renderCTM = true;
|
||||
public static boolean enableAmbientLighting;
|
||||
public static int ambientLightingLevel;
|
||||
}
|
||||
|
||||
public static class machines
|
||||
|
|
|
@ -212,6 +212,8 @@ public class ClientProxy extends CommonProxy
|
|||
client.replaceSoundsWhenResuming = Mekanism.configuration.get("client", "ReplaceSoundsWhenResuming", true,
|
||||
"If true, will reduce lagging between player sounds. Setting to false will reduce GC load").getBoolean();
|
||||
client.renderCTM = Mekanism.configuration.get("client", "CTMRenderer", true).getBoolean();
|
||||
client.enableAmbientLighting = Mekanism.configuration.get("general", "EnableAmbientLighting", true).getBoolean();
|
||||
client.ambientLightingLevel = Mekanism.configuration.get("general", "AmbientLightingLevel", 15).getInt();
|
||||
|
||||
if(Mekanism.configuration.hasChanged())
|
||||
{
|
||||
|
|
|
@ -1,18 +1,15 @@
|
|||
package mekanism.client.gui;
|
||||
|
||||
import mekanism.api.gas.GasStack;
|
||||
import mekanism.api.util.UnitDisplayUtils.TemperatureUnit;
|
||||
import mekanism.client.gui.element.GuiFluidGauge;
|
||||
import mekanism.client.gui.element.GuiGauge;
|
||||
import mekanism.client.gui.element.GuiFluidGauge.IFluidInfoHandler;
|
||||
import mekanism.client.render.MekanismRenderer;
|
||||
import mekanism.client.gui.element.GuiGauge;
|
||||
import mekanism.common.inventory.container.ContainerSolarEvaporationController;
|
||||
import mekanism.common.tile.TileEntitySolarEvaporationController;
|
||||
import mekanism.common.util.LangUtils;
|
||||
import mekanism.common.util.MekanismUtils;
|
||||
import mekanism.common.util.MekanismUtils.ResourceType;
|
||||
import net.minecraft.entity.player.InventoryPlayer;
|
||||
import net.minecraftforge.fluids.FluidStack;
|
||||
import net.minecraftforge.fluids.FluidTank;
|
||||
|
||||
import org.lwjgl.opengl.GL11;
|
||||
|
@ -57,8 +54,8 @@ public class GuiSolarEvaporationController extends GuiMekanism
|
|||
|
||||
fontRendererObj.drawString(getStruct(), 50, 21, 0x00CD00);
|
||||
fontRendererObj.drawString(LangUtils.localize("gui.height") + ": " + tileEntity.height, 50, 30, 0x00CD00);
|
||||
fontRendererObj.drawString(LangUtils.localize("gui.mult") + ": " + getTempMult(), 50, 39, 0x00CD00);
|
||||
fontRendererObj.drawString(LangUtils.localize("gui.max") + ": " + getMaxTemp(), 50, 48, 0x00CD00);
|
||||
fontRendererObj.drawString(LangUtils.localize("gui.temp") + ": " + getTemp(), 50, 39, 0x00CD00);
|
||||
renderScaledText(LangUtils.localize("gui.production") + ": " + Math.round(tileEntity.lastGain*100D)/100D + " mB/t", 50, 48, 0x00CD00, 76);
|
||||
|
||||
if(xAxis >= 7 && xAxis <= 23 && yAxis >= 14 && yAxis <= 72)
|
||||
{
|
||||
|
@ -97,25 +94,11 @@ public class GuiSolarEvaporationController extends GuiMekanism
|
|||
|
||||
private String getTemp()
|
||||
{
|
||||
float temp = tileEntity.getTemperature()*200;
|
||||
float temp = tileEntity.getTemperature();
|
||||
|
||||
return MekanismUtils.getTemperatureDisplay(temp, TemperatureUnit.AMBIENT);
|
||||
}
|
||||
|
||||
private String getMaxTemp()
|
||||
{
|
||||
float temp = tileEntity.getMaxTemperature()*200;
|
||||
|
||||
return MekanismUtils.getTemperatureDisplay(temp, TemperatureUnit.AMBIENT);
|
||||
}
|
||||
|
||||
private String getTempMult()
|
||||
{
|
||||
float temp = (float)Math.round((tileEntity.getTempMultiplier())*10)/10F;
|
||||
|
||||
return temp + "x";
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void drawGuiContainerBackgroundLayer(float partialTick, int mouseX, int mouseY)
|
||||
{
|
||||
|
|
|
@ -59,7 +59,7 @@ public class GuiEnergyInfo extends GuiElement
|
|||
info.add(s);
|
||||
}
|
||||
|
||||
info.add(LangUtils.localize("gui.energyType") + ": " + general.activeType);
|
||||
info.add(LangUtils.localize("gui.unit") + ": " + general.activeType);
|
||||
displayTooltips(info, xAxis, yAxis);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -270,6 +270,10 @@ public class CommonProxy implements IGuiProvider
|
|||
general.maxPumpRange = Mekanism.configuration.get(Configuration.CATEGORY_GENERAL, "MaxPumpRange", 80).getInt();
|
||||
general.pumpWaterSources = Mekanism.configuration.get(Configuration.CATEGORY_GENERAL, "PumpWaterSources", false).getBoolean();
|
||||
general.maxPlenisherNodes = Mekanism.configuration.get(Configuration.CATEGORY_GENERAL, "MaxPlenisherNodes", 4000).getInt();
|
||||
general.evaporationHeatDissipation = Mekanism.configuration.get(Configuration.CATEGORY_GENERAL, "EvaporationHeatDissipation", 0.02D).getDouble();
|
||||
general.evaporationTempMultiplier = Mekanism.configuration.get(Configuration.CATEGORY_GENERAL, "EvaporationTempMultiplier", 0.1D).getDouble();
|
||||
general.evaporationSolarMultiplier = Mekanism.configuration.get(Configuration.CATEGORY_GENERAL, "EvaporationSolarMultiplier", 0.2D).getDouble();
|
||||
general.evaporationMaxTemp = Mekanism.configuration.get(Configuration.CATEGORY_GENERAL, "EvaporationMaxTemp", 3000D).getDouble();
|
||||
|
||||
general.blacklistIC2 = Mekanism.configuration.get(Configuration.CATEGORY_GENERAL, "BlacklistIC2Power", false).getBoolean();
|
||||
general.blacklistRF = Mekanism.configuration.get(Configuration.CATEGORY_GENERAL, "BlacklistRFPower", false).getBoolean();
|
||||
|
@ -325,8 +329,7 @@ public class CommonProxy implements IGuiProvider
|
|||
general.laserRange = Mekanism.configuration.get("general", "LaserRange", 64).getInt();
|
||||
general.laserEnergyNeededPerHardness = Mekanism.configuration.get("general", "LaserDiggingEnergy", 100000).getInt();
|
||||
general.destroyDisabledBlocks = Mekanism.configuration.get("general", "DestroyDisabledBlocks", true).getBoolean();
|
||||
general.enableAmbientLighting = Mekanism.configuration.get("general", "EnableAmbientLighting", true).getBoolean();
|
||||
general.ambientLightingLevel = Mekanism.configuration.get("general", "AmbientLightingLevel", 15).getInt();
|
||||
|
||||
|
||||
for(MachineType type : MachineType.getValidMachines())
|
||||
{
|
||||
|
|
|
@ -377,7 +377,7 @@ public class BlockMachine extends BlockContainer implements ISpecialBounds, IBlo
|
|||
@Override
|
||||
public int getLightValue(IBlockAccess world, int x, int y, int z)
|
||||
{
|
||||
if(general.enableAmbientLighting)
|
||||
if(client.enableAmbientLighting)
|
||||
{
|
||||
TileEntity tileEntity = world.getTileEntity(x, y, z);
|
||||
|
||||
|
@ -385,7 +385,7 @@ public class BlockMachine extends BlockContainer implements ISpecialBounds, IBlo
|
|||
{
|
||||
if(((IActiveState)tileEntity).getActive() && ((IActiveState)tileEntity).lightUpdate())
|
||||
{
|
||||
return general.ambientLightingLevel;
|
||||
return client.ambientLightingLevel;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -29,7 +29,6 @@ public class PacketConfigSync implements IMessageHandler<ConfigSyncMessage, IMes
|
|||
@Override
|
||||
public void toBytes(ByteBuf dataStream)
|
||||
{
|
||||
dataStream.writeBoolean(general.updateNotifications);
|
||||
dataStream.writeBoolean(general.controlCircuitOreDict);
|
||||
dataStream.writeBoolean(general.logPackets);
|
||||
dataStream.writeBoolean(general.dynamicTankEasterEgg);
|
||||
|
@ -62,6 +61,13 @@ public class PacketConfigSync implements IMessageHandler<ConfigSyncMessage, IMes
|
|||
dataStream.writeInt(general.maxJetpackGas);
|
||||
dataStream.writeInt(general.maxScubaGas);
|
||||
dataStream.writeInt(general.maxFlamethrowerGas);
|
||||
dataStream.writeInt(general.maxPumpRange);
|
||||
dataStream.writeBoolean(general.pumpWaterSources);
|
||||
dataStream.writeInt(general.maxPlenisherNodes);
|
||||
dataStream.writeDouble(general.evaporationHeatDissipation);
|
||||
dataStream.writeDouble(general.evaporationTempMultiplier);
|
||||
dataStream.writeDouble(general.evaporationSolarMultiplier);
|
||||
dataStream.writeDouble(general.evaporationMaxTemp);
|
||||
|
||||
for(MachineType type : MachineType.getValidMachines())
|
||||
{
|
||||
|
@ -106,7 +112,6 @@ public class PacketConfigSync implements IMessageHandler<ConfigSyncMessage, IMes
|
|||
@Override
|
||||
public void fromBytes(ByteBuf dataStream)
|
||||
{
|
||||
general.updateNotifications = dataStream.readBoolean();
|
||||
general.controlCircuitOreDict = dataStream.readBoolean();
|
||||
general.logPackets = dataStream.readBoolean();
|
||||
general.dynamicTankEasterEgg = dataStream.readBoolean();
|
||||
|
@ -139,6 +144,13 @@ public class PacketConfigSync implements IMessageHandler<ConfigSyncMessage, IMes
|
|||
general.maxJetpackGas = dataStream.readInt();
|
||||
general.maxScubaGas = dataStream.readInt();
|
||||
general.maxFlamethrowerGas = dataStream.readInt();
|
||||
general.maxPumpRange = dataStream.readInt();
|
||||
general.pumpWaterSources = dataStream.readBoolean();
|
||||
general.maxPlenisherNodes = dataStream.readInt();
|
||||
general.evaporationHeatDissipation = dataStream.readDouble();
|
||||
general.evaporationTempMultiplier = dataStream.readDouble();
|
||||
general.evaporationSolarMultiplier = dataStream.readDouble();
|
||||
general.evaporationMaxTemp = dataStream.readDouble();
|
||||
|
||||
for(MachineType type : MachineType.getValidMachines())
|
||||
{
|
||||
|
|
|
@ -38,7 +38,7 @@ public class TileEntitySolarEvaporationController extends TileEntitySolarEvapora
|
|||
{
|
||||
public static final int MAX_OUTPUT = 10000;
|
||||
public static final int MAX_SOLARS = 4;
|
||||
public static final int WARMUP = 10000;
|
||||
public static final int MAX_HEIGHT = 18;
|
||||
|
||||
public FluidTank inputTank = new FluidTank(0);
|
||||
public FluidTank outputTank = new FluidTank(MAX_OUTPUT);
|
||||
|
@ -53,6 +53,9 @@ public class TileEntitySolarEvaporationController extends TileEntitySolarEvapora
|
|||
|
||||
public float biomeTemp = 0;
|
||||
public float temperature = 0;
|
||||
public float tempToAdd = 0;
|
||||
|
||||
public float lastGain = 0;
|
||||
|
||||
public int height = 0;
|
||||
|
||||
|
@ -89,7 +92,11 @@ public class TileEntitySolarEvaporationController extends TileEntitySolarEvapora
|
|||
refresh();
|
||||
}
|
||||
|
||||
updateTemperature();
|
||||
if(structured)
|
||||
{
|
||||
updateTemperature();
|
||||
}
|
||||
|
||||
manageBuckets();
|
||||
|
||||
SolarEvaporationRecipe recipe = getRecipe();
|
||||
|
@ -99,7 +106,12 @@ public class TileEntitySolarEvaporationController extends TileEntitySolarEvapora
|
|||
int outputNeeded = outputTank.getCapacity()-outputTank.getFluidAmount();
|
||||
int inputStored = inputTank.getFluidAmount();
|
||||
|
||||
partialInput += Math.min(inputTank.getFluidAmount(), getTemperature()*recipe.recipeInput.ingredient.amount);
|
||||
double tempMult = Math.max(0, getTemperature())*general.evaporationTempMultiplier.getDouble();
|
||||
double inputToUse = (tempMult*recipe.recipeInput.ingredient.amount)*((float)height/(float)MAX_HEIGHT);
|
||||
inputToUse = Math.min(inputTank.getFluidAmount(), inputToUse);
|
||||
|
||||
lastGain = (float)inputToUse/(float)recipe.recipeInput.ingredient.amount;
|
||||
partialInput += inputToUse;
|
||||
|
||||
if(partialInput >= 1)
|
||||
{
|
||||
|
@ -116,6 +128,9 @@ public class TileEntitySolarEvaporationController extends TileEntitySolarEvapora
|
|||
partialOutput %= 1;
|
||||
}
|
||||
}
|
||||
else {
|
||||
lastGain = 0;
|
||||
}
|
||||
|
||||
if(structured)
|
||||
{
|
||||
|
@ -183,8 +198,6 @@ public class TileEntitySolarEvaporationController extends TileEntitySolarEvapora
|
|||
{
|
||||
inputTank.getFluid().amount = Math.min(inputTank.getFluid().amount, getMaxFluid());
|
||||
}
|
||||
|
||||
temperature = Math.min(getMaxTemperature(), getTemperature());
|
||||
}
|
||||
else {
|
||||
clearStructure();
|
||||
|
@ -195,7 +208,7 @@ public class TileEntitySolarEvaporationController extends TileEntitySolarEvapora
|
|||
|
||||
public boolean canOperate(SolarEvaporationRecipe recipe)
|
||||
{
|
||||
if(!structured || height < 3 || height > 18 || inputTank.getFluid() == null)
|
||||
if(!structured || height < 3 || height > MAX_HEIGHT || inputTank.getFluid() == null)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
@ -308,35 +321,6 @@ public class TileEntitySolarEvaporationController extends TileEntitySolarEvapora
|
|||
}
|
||||
|
||||
private void updateTemperature()
|
||||
{
|
||||
float max = getMaxTemperature();
|
||||
float incr = (max/WARMUP)*getTempMultiplier();
|
||||
|
||||
if(getTempMultiplier() == 0)
|
||||
{
|
||||
temperature = Math.max(0, getTemperature()-(max/(WARMUP*16)));
|
||||
}
|
||||
else {
|
||||
temperature = Math.min(max, getTemperature()+incr);
|
||||
}
|
||||
}
|
||||
|
||||
public float getTemperature()
|
||||
{
|
||||
return temperature;
|
||||
}
|
||||
|
||||
public float getMaxTemperature()
|
||||
{
|
||||
if(!structured)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
return 1 + (height-3)*(float)general.solarEvaporationSpeed;
|
||||
}
|
||||
|
||||
public float getTempMultiplier()
|
||||
{
|
||||
if(!temperatureSet)
|
||||
{
|
||||
|
@ -344,7 +328,30 @@ public class TileEntitySolarEvaporationController extends TileEntitySolarEvapora
|
|||
temperatureSet = true;
|
||||
}
|
||||
|
||||
return biomeTemp*((float)getActiveSolars()/MAX_SOLARS);
|
||||
tempToAdd += getActiveSolars()*general.evaporationSolarMultiplier.getDouble();
|
||||
temperature += tempToAdd/(float)height;
|
||||
|
||||
float biome = biomeTemp-0.5F;
|
||||
float base = biome > 0 ? biome*20 : biomeTemp*40;
|
||||
float incr = (float)Math.sqrt(Math.abs(temperature-base))*(float)general.evaporationHeatDissipation.getDouble();
|
||||
|
||||
if(temperature > base)
|
||||
{
|
||||
incr = -incr;
|
||||
}
|
||||
|
||||
System.out.println(incr + " " + biome + " " + base);
|
||||
|
||||
temperature = (float)Math.min(general.evaporationMaxTemp.getDouble(), temperature + incr/(float)height);
|
||||
|
||||
tempToAdd = 0;
|
||||
|
||||
MekanismUtils.saveChunk(this);
|
||||
}
|
||||
|
||||
public float getTemperature()
|
||||
{
|
||||
return temperature;
|
||||
}
|
||||
|
||||
public int getActiveSolars()
|
||||
|
@ -402,7 +409,7 @@ public class TileEntitySolarEvaporationController extends TileEntitySolarEvapora
|
|||
middlePointer = middlePointer.getFromSide(ForgeDirection.DOWN);
|
||||
}
|
||||
|
||||
if(height < 3 || height > 18)
|
||||
if(height < 3 || height > MAX_HEIGHT)
|
||||
{
|
||||
height = 0;
|
||||
return false;
|
||||
|
@ -587,7 +594,7 @@ public class TileEntitySolarEvaporationController extends TileEntitySolarEvapora
|
|||
|
||||
public int getScaledTempLevel(int i)
|
||||
{
|
||||
return (int)(getMaxTemperature() == 0 ? 0 : getTemperature()*i/getMaxTemperature());
|
||||
return (int)(i*Math.min(1, getTemperature()/general.evaporationMaxTemp.getDouble()));
|
||||
}
|
||||
|
||||
public Coord4D getRenderLocation()
|
||||
|
@ -637,6 +644,7 @@ public class TileEntitySolarEvaporationController extends TileEntitySolarEvapora
|
|||
temperature = dataStream.readFloat();
|
||||
biomeTemp = dataStream.readFloat();
|
||||
isLeftOnFace = dataStream.readBoolean();
|
||||
lastGain = dataStream.readFloat();
|
||||
|
||||
if(structured != prev)
|
||||
{
|
||||
|
@ -690,6 +698,7 @@ public class TileEntitySolarEvaporationController extends TileEntitySolarEvapora
|
|||
data.add(temperature);
|
||||
data.add(biomeTemp);
|
||||
data.add(isLeftOnFace);
|
||||
data.add(lastGain);
|
||||
|
||||
return data;
|
||||
}
|
||||
|
|
|
@ -1186,6 +1186,7 @@ public final class MekanismUtils
|
|||
public static String getTemperatureDisplay(double T, TemperatureUnit unit)
|
||||
{
|
||||
double TK = unit.convertToK(T);
|
||||
|
||||
switch(general.tempUnit)
|
||||
{
|
||||
case K:
|
||||
|
|
|
@ -8,24 +8,23 @@ import mekanism.api.gas.GasTank;
|
|||
import mekanism.api.util.ListUtils;
|
||||
import mekanism.client.gui.GuiMekanism;
|
||||
import mekanism.client.gui.element.GuiEnergyInfo;
|
||||
import mekanism.client.gui.element.GuiGasGauge;
|
||||
import mekanism.client.gui.element.GuiProgress;
|
||||
import mekanism.client.gui.element.GuiEnergyInfo.IInfoHandler;
|
||||
import mekanism.client.gui.element.GuiGasGauge;
|
||||
import mekanism.client.gui.element.GuiGasGauge.IGasInfoHandler;
|
||||
import mekanism.client.gui.element.GuiGauge.Type;
|
||||
import mekanism.client.gui.element.GuiProgress;
|
||||
import mekanism.client.gui.element.GuiProgress.IProgressInfoHandler;
|
||||
import mekanism.client.gui.element.GuiProgress.ProgressBar;
|
||||
import mekanism.client.sound.SoundHandler;
|
||||
import mekanism.common.Mekanism;
|
||||
import mekanism.common.inventory.container.ContainerNull;
|
||||
import mekanism.common.network.PacketSimpleGui.SimpleGuiMessage;
|
||||
import mekanism.common.network.PacketTileEntity.TileEntityMessage;
|
||||
import mekanism.common.util.LangUtils;
|
||||
import mekanism.common.util.MekanismUtils;
|
||||
import mekanism.common.util.MekanismUtils.ResourceType;
|
||||
import mekanism.generators.client.gui.element.GuiHeatTab;
|
||||
import mekanism.generators.client.gui.element.GuiStatTab;
|
||||
import mekanism.generators.common.MekanismGenerators;
|
||||
import mekanism.generators.common.network.PacketGeneratorsGui.GeneratorsGuiMessage;
|
||||
import mekanism.generators.common.tile.reactor.TileEntityReactorController;
|
||||
import net.minecraft.client.gui.GuiTextField;
|
||||
import net.minecraft.entity.player.InventoryPlayer;
|
||||
|
@ -160,7 +159,7 @@ public class GuiReactorFuel extends GuiMekanism
|
|||
if(xAxis >= 6 && xAxis <= 20 && yAxis >= 6 && yAxis <= 20)
|
||||
{
|
||||
SoundHandler.playSound("gui.button.press");
|
||||
MekanismGenerators.packetHandler.sendToServer(new GeneratorsGuiMessage(Coord4D.get(tileEntity), 10));
|
||||
Mekanism.packetHandler.sendToServer(new SimpleGuiMessage(Coord4D.get(tileEntity), 1, 10));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -9,36 +9,37 @@ import mekanism.api.util.ListUtils;
|
|||
import mekanism.api.util.UnitDisplayUtils.TemperatureUnit;
|
||||
import mekanism.client.gui.GuiMekanism;
|
||||
import mekanism.client.gui.element.GuiEnergyGauge;
|
||||
import mekanism.client.gui.element.GuiEnergyInfo;
|
||||
import mekanism.client.gui.element.GuiFluidGauge;
|
||||
import mekanism.client.gui.element.GuiNumberGauge;
|
||||
import mekanism.client.gui.element.GuiProgress;
|
||||
import mekanism.client.gui.element.GuiEnergyGauge.IEnergyInfoHandler;
|
||||
import mekanism.client.gui.element.GuiEnergyInfo;
|
||||
import mekanism.client.gui.element.GuiEnergyInfo.IInfoHandler;
|
||||
import mekanism.client.gui.element.GuiFluidGauge;
|
||||
import mekanism.client.gui.element.GuiFluidGauge.IFluidInfoHandler;
|
||||
import mekanism.client.gui.element.GuiGauge.Type;
|
||||
import mekanism.client.gui.element.GuiNumberGauge;
|
||||
import mekanism.client.gui.element.GuiNumberGauge.INumberInfoHandler;
|
||||
import mekanism.client.gui.element.GuiProgress;
|
||||
import mekanism.client.gui.element.GuiProgress.IProgressInfoHandler;
|
||||
import mekanism.client.gui.element.GuiProgress.ProgressBar;
|
||||
import mekanism.client.sound.SoundHandler;
|
||||
import mekanism.common.Mekanism;
|
||||
import mekanism.common.inventory.container.ContainerNull;
|
||||
import mekanism.common.network.PacketSimpleGui.SimpleGuiMessage;
|
||||
import mekanism.common.util.LangUtils;
|
||||
import mekanism.common.util.MekanismUtils;
|
||||
import mekanism.common.util.MekanismUtils.ResourceType;
|
||||
import mekanism.generators.client.gui.element.GuiFuelTab;
|
||||
import mekanism.generators.client.gui.element.GuiStatTab;
|
||||
import mekanism.generators.common.MekanismGenerators;
|
||||
import mekanism.generators.common.network.PacketGeneratorsGui.GeneratorsGuiMessage;
|
||||
import mekanism.generators.common.tile.reactor.TileEntityReactorController;
|
||||
import net.minecraft.block.BlockStaticLiquid;
|
||||
import net.minecraft.entity.player.InventoryPlayer;
|
||||
import net.minecraft.util.IIcon;
|
||||
import net.minecraftforge.fluids.FluidTank;
|
||||
import cpw.mods.fml.relauncher.Side;
|
||||
import cpw.mods.fml.relauncher.SideOnly;
|
||||
|
||||
import org.lwjgl.opengl.GL11;
|
||||
|
||||
import cpw.mods.fml.relauncher.Side;
|
||||
import cpw.mods.fml.relauncher.SideOnly;
|
||||
|
||||
@SideOnly(Side.CLIENT)
|
||||
public class GuiReactorHeat extends GuiMekanism
|
||||
{
|
||||
|
@ -206,9 +207,8 @@ public class GuiReactorHeat extends GuiMekanism
|
|||
if(xAxis >= 6 && xAxis <= 20 && yAxis >= 6 && yAxis <= 20)
|
||||
{
|
||||
SoundHandler.playSound("gui.button.press");
|
||||
MekanismGenerators.packetHandler.sendToServer(new GeneratorsGuiMessage(Coord4D.get(tileEntity), 10));
|
||||
Mekanism.packetHandler.sendToServer(new SimpleGuiMessage(Coord4D.get(tileEntity), 1, 10));
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -8,25 +8,26 @@ import mekanism.api.Coord4D;
|
|||
import mekanism.api.EnumColor;
|
||||
import mekanism.api.util.ListUtils;
|
||||
import mekanism.api.util.UnitDisplayUtils.TemperatureUnit;
|
||||
import mekanism.client.gui.GuiMekanism;
|
||||
import mekanism.client.gui.element.GuiEnergyInfo;
|
||||
import mekanism.client.gui.element.GuiEnergyInfo.IInfoHandler;
|
||||
import mekanism.client.gui.GuiMekanism;
|
||||
import mekanism.client.sound.SoundHandler;
|
||||
import mekanism.common.Mekanism;
|
||||
import mekanism.common.inventory.container.ContainerNull;
|
||||
import mekanism.common.network.PacketSimpleGui.SimpleGuiMessage;
|
||||
import mekanism.common.util.LangUtils;
|
||||
import mekanism.common.util.MekanismUtils;
|
||||
import mekanism.common.util.MekanismUtils.ResourceType;
|
||||
import mekanism.generators.client.gui.element.GuiFuelTab;
|
||||
import mekanism.generators.client.gui.element.GuiHeatTab;
|
||||
import mekanism.generators.common.MekanismGenerators;
|
||||
import mekanism.generators.common.network.PacketGeneratorsGui.GeneratorsGuiMessage;
|
||||
import mekanism.generators.common.tile.reactor.TileEntityReactorController;
|
||||
import net.minecraft.entity.player.InventoryPlayer;
|
||||
import cpw.mods.fml.relauncher.Side;
|
||||
import cpw.mods.fml.relauncher.SideOnly;
|
||||
|
||||
import org.lwjgl.opengl.GL11;
|
||||
|
||||
import cpw.mods.fml.relauncher.Side;
|
||||
import cpw.mods.fml.relauncher.SideOnly;
|
||||
|
||||
@SideOnly(Side.CLIENT)
|
||||
public class GuiReactorStats extends GuiMekanism
|
||||
{
|
||||
|
@ -113,7 +114,7 @@ public class GuiReactorStats extends GuiMekanism
|
|||
if(xAxis >= 6 && xAxis <= 20 && yAxis >= 6 && yAxis <= 20)
|
||||
{
|
||||
SoundHandler.playSound("gui.button.press");
|
||||
MekanismGenerators.packetHandler.sendToServer(new GeneratorsGuiMessage(Coord4D.get(tileEntity), 10));
|
||||
Mekanism.packetHandler.sendToServer(new SimpleGuiMessage(Coord4D.get(tileEntity), 1, 10));
|
||||
}
|
||||
}
|
||||
}}
|
||||
|
|
|
@ -4,16 +4,16 @@ import mekanism.api.Coord4D;
|
|||
import mekanism.client.gui.IGuiWrapper;
|
||||
import mekanism.client.gui.element.GuiElement;
|
||||
import mekanism.client.sound.SoundHandler;
|
||||
import mekanism.common.Mekanism;
|
||||
import mekanism.common.network.PacketSimpleGui.SimpleGuiMessage;
|
||||
import mekanism.common.util.LangUtils;
|
||||
import mekanism.common.util.MekanismUtils;
|
||||
import mekanism.common.util.MekanismUtils.ResourceType;
|
||||
import mekanism.generators.common.MekanismGenerators;
|
||||
import mekanism.generators.common.network.PacketGeneratorsGui.GeneratorsGuiMessage;
|
||||
import net.minecraft.tileentity.TileEntity;
|
||||
import net.minecraft.util.ResourceLocation;
|
||||
import codechicken.lib.vec.Rectangle4i;
|
||||
import cpw.mods.fml.relauncher.Side;
|
||||
import cpw.mods.fml.relauncher.SideOnly;
|
||||
import codechicken.lib.vec.Rectangle4i;
|
||||
|
||||
@SideOnly(Side.CLIENT)
|
||||
public class GuiFuelTab extends GuiElement
|
||||
|
@ -74,7 +74,7 @@ public class GuiFuelTab extends GuiElement
|
|||
{
|
||||
if(xAxis >= -21 && xAxis <= -3 && yAxis >= 38 && yAxis <= 56)
|
||||
{
|
||||
MekanismGenerators.packetHandler.sendToServer(new GeneratorsGuiMessage(Coord4D.get(tileEntity), 12));
|
||||
Mekanism.packetHandler.sendToServer(new SimpleGuiMessage(Coord4D.get(tileEntity), 1, 12));
|
||||
SoundHandler.playSound("gui.button.press");
|
||||
}
|
||||
}
|
||||
|
|
|
@ -4,16 +4,16 @@ import mekanism.api.Coord4D;
|
|||
import mekanism.client.gui.IGuiWrapper;
|
||||
import mekanism.client.gui.element.GuiElement;
|
||||
import mekanism.client.sound.SoundHandler;
|
||||
import mekanism.common.Mekanism;
|
||||
import mekanism.common.network.PacketSimpleGui.SimpleGuiMessage;
|
||||
import mekanism.common.util.LangUtils;
|
||||
import mekanism.common.util.MekanismUtils;
|
||||
import mekanism.common.util.MekanismUtils.ResourceType;
|
||||
import mekanism.generators.common.MekanismGenerators;
|
||||
import mekanism.generators.common.network.PacketGeneratorsGui.GeneratorsGuiMessage;
|
||||
import net.minecraft.tileentity.TileEntity;
|
||||
import net.minecraft.util.ResourceLocation;
|
||||
import codechicken.lib.vec.Rectangle4i;
|
||||
import cpw.mods.fml.relauncher.Side;
|
||||
import cpw.mods.fml.relauncher.SideOnly;
|
||||
import codechicken.lib.vec.Rectangle4i;
|
||||
|
||||
@SideOnly(Side.CLIENT)
|
||||
public class GuiHeatTab extends GuiElement
|
||||
|
@ -74,7 +74,7 @@ public class GuiHeatTab extends GuiElement
|
|||
{
|
||||
if(xAxis >= -21 && xAxis <= -3 && yAxis >= 10 && yAxis <= 28)
|
||||
{
|
||||
MekanismGenerators.packetHandler.sendToServer(new GeneratorsGuiMessage(Coord4D.get(tileEntity), 11));
|
||||
Mekanism.packetHandler.sendToServer(new SimpleGuiMessage(Coord4D.get(tileEntity), 1, 11));
|
||||
SoundHandler.playSound("gui.button.press");
|
||||
}
|
||||
}
|
||||
|
|
|
@ -4,16 +4,16 @@ import mekanism.api.Coord4D;
|
|||
import mekanism.client.gui.IGuiWrapper;
|
||||
import mekanism.client.gui.element.GuiElement;
|
||||
import mekanism.client.sound.SoundHandler;
|
||||
import mekanism.common.Mekanism;
|
||||
import mekanism.common.network.PacketSimpleGui.SimpleGuiMessage;
|
||||
import mekanism.common.util.LangUtils;
|
||||
import mekanism.common.util.MekanismUtils;
|
||||
import mekanism.common.util.MekanismUtils.ResourceType;
|
||||
import mekanism.generators.common.MekanismGenerators;
|
||||
import mekanism.generators.common.network.PacketGeneratorsGui.GeneratorsGuiMessage;
|
||||
import net.minecraft.tileentity.TileEntity;
|
||||
import net.minecraft.util.ResourceLocation;
|
||||
import codechicken.lib.vec.Rectangle4i;
|
||||
import cpw.mods.fml.relauncher.Side;
|
||||
import cpw.mods.fml.relauncher.SideOnly;
|
||||
import codechicken.lib.vec.Rectangle4i;
|
||||
|
||||
@SideOnly(Side.CLIENT)
|
||||
public class GuiStatTab extends GuiElement
|
||||
|
@ -74,7 +74,7 @@ public class GuiStatTab extends GuiElement
|
|||
{
|
||||
if(xAxis >= -21 && xAxis <= -3 && yAxis >= 66 && yAxis <= 84)
|
||||
{
|
||||
MekanismGenerators.packetHandler.sendToServer(new GeneratorsGuiMessage(Coord4D.get(tileEntity), 13));
|
||||
Mekanism.packetHandler.sendToServer(new SimpleGuiMessage(Coord4D.get(tileEntity), 1, 13));
|
||||
SoundHandler.playSound("gui.button.press");
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,183 +0,0 @@
|
|||
package mekanism.generators.common;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
import mekanism.common.Mekanism;
|
||||
import mekanism.generators.common.network.PacketGeneratorsGui;
|
||||
import mekanism.generators.common.network.PacketGeneratorsGui.GeneratorsGuiMessage;
|
||||
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.entity.player.EntityPlayerMP;
|
||||
import net.minecraft.server.MinecraftServer;
|
||||
import net.minecraft.util.AxisAlignedBB;
|
||||
import net.minecraft.util.Vec3;
|
||||
import cpw.mods.fml.common.network.NetworkRegistry;
|
||||
import cpw.mods.fml.common.network.simpleimpl.IMessage;
|
||||
import cpw.mods.fml.common.network.simpleimpl.MessageContext;
|
||||
import cpw.mods.fml.common.network.simpleimpl.SimpleNetworkWrapper;
|
||||
import cpw.mods.fml.relauncher.Side;
|
||||
|
||||
import io.netty.buffer.ByteBuf;
|
||||
|
||||
/**
|
||||
* Mekanism packet handler. As always, use packets sparingly!
|
||||
* @author AidanBrady
|
||||
*
|
||||
*/
|
||||
public class GeneratorsPacketHandler
|
||||
{
|
||||
public SimpleNetworkWrapper netHandler = NetworkRegistry.INSTANCE.newSimpleChannel("MEKGEN");
|
||||
|
||||
public void initialize()
|
||||
{
|
||||
netHandler.registerMessage(PacketGeneratorsGui.class, GeneratorsGuiMessage.class, 0, Side.SERVER);
|
||||
netHandler.registerMessage(PacketGeneratorsGui.class, GeneratorsGuiMessage.class, 0, Side.CLIENT);
|
||||
}
|
||||
|
||||
/**
|
||||
* Encodes an Object[] of data into a DataOutputStream.
|
||||
* @param dataValues - an Object[] of data to encode
|
||||
* @param output - the output stream to write to
|
||||
*/
|
||||
public static void encode(Object[] dataValues, ByteBuf output)
|
||||
{
|
||||
try {
|
||||
for(Object data : dataValues)
|
||||
{
|
||||
if(data instanceof Integer)
|
||||
{
|
||||
output.writeInt((Integer)data);
|
||||
}
|
||||
else if(data instanceof Boolean)
|
||||
{
|
||||
output.writeBoolean((Boolean)data);
|
||||
}
|
||||
else if(data instanceof Double)
|
||||
{
|
||||
output.writeDouble((Double)data);
|
||||
}
|
||||
else if(data instanceof Float)
|
||||
{
|
||||
output.writeFloat((Float)data);
|
||||
}
|
||||
else if(data instanceof String)
|
||||
{
|
||||
writeString(output, (String)data);
|
||||
}
|
||||
else if(data instanceof Byte)
|
||||
{
|
||||
output.writeByte((Byte)data);
|
||||
}
|
||||
else if(data instanceof int[])
|
||||
{
|
||||
for(int i : (int[])data)
|
||||
{
|
||||
output.writeInt(i);
|
||||
}
|
||||
}
|
||||
else if(data instanceof byte[])
|
||||
{
|
||||
for(byte b : (byte[])data)
|
||||
{
|
||||
output.writeByte(b);
|
||||
}
|
||||
}
|
||||
else if(data instanceof ArrayList)
|
||||
{
|
||||
encode(((ArrayList)data).toArray(), output);
|
||||
}
|
||||
}
|
||||
} catch(Exception e) {
|
||||
Mekanism.logger.error("Error while encoding packet data.");
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
|
||||
public static void writeString(ByteBuf output, String s)
|
||||
{
|
||||
output.writeInt(s.getBytes().length);
|
||||
output.writeBytes(s.getBytes());
|
||||
}
|
||||
|
||||
public static String readString(ByteBuf input)
|
||||
{
|
||||
return new String(input.readBytes(input.readInt()).array());
|
||||
}
|
||||
|
||||
public static EntityPlayer getPlayer(MessageContext context)
|
||||
{
|
||||
return Mekanism.proxy.getPlayer(context);
|
||||
}
|
||||
|
||||
/**
|
||||
* Send this message to everyone.
|
||||
* @param message - the message to send
|
||||
*/
|
||||
public void sendToAll(IMessage message)
|
||||
{
|
||||
netHandler.sendToAll(message);
|
||||
}
|
||||
|
||||
/**
|
||||
* Send this message to the specified player.
|
||||
* @param message - the message to send
|
||||
* @param player - the player to send it to
|
||||
*/
|
||||
public void sendTo(IMessage message, EntityPlayerMP player)
|
||||
{
|
||||
netHandler.sendTo(message, player);
|
||||
}
|
||||
|
||||
/**
|
||||
* Send this message to everyone within a certain range of a point.
|
||||
*
|
||||
* @param message - the message to send
|
||||
* @param point - the TargetPoint around which to send
|
||||
*/
|
||||
public void sendToAllAround(IMessage message, NetworkRegistry.TargetPoint point)
|
||||
{
|
||||
netHandler.sendToAllAround(message, point);
|
||||
}
|
||||
|
||||
/**
|
||||
* Send this message to everyone within the supplied dimension.
|
||||
* @param message - the message to send
|
||||
* @param dimensionId - the dimension id to target
|
||||
*/
|
||||
public void sendToDimension(IMessage message, int dimensionId)
|
||||
{
|
||||
netHandler.sendToDimension(message, dimensionId);
|
||||
}
|
||||
|
||||
/**
|
||||
* Send this message to the server.
|
||||
* @param message - the message to send
|
||||
*/
|
||||
public void sendToServer(IMessage message)
|
||||
{
|
||||
netHandler.sendToServer(message);
|
||||
}
|
||||
|
||||
/**
|
||||
* Send this message to all players within a defined AABB cuboid.
|
||||
* @param message - the message to send
|
||||
* @param cuboid - the AABB cuboid to send the packet in
|
||||
* @param dimId - the dimension the cuboid is in
|
||||
*/
|
||||
public void sendToCuboid(IMessage message, AxisAlignedBB cuboid, int dimId)
|
||||
{
|
||||
MinecraftServer server = MinecraftServer.getServer();
|
||||
|
||||
if(server != null && cuboid != null)
|
||||
{
|
||||
for(EntityPlayerMP player : (List<EntityPlayerMP>)server.getConfigurationManager().playerEntityList)
|
||||
{
|
||||
if(player.dimension == dimId && cuboid.isVecInside(Vec3.createVectorHelper(player.posX, player.posY, player.posZ)))
|
||||
{
|
||||
sendTo(message, player);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
|
@ -45,9 +45,6 @@ import cpw.mods.fml.common.network.NetworkRegistry;
|
|||
@Mod(modid = "MekanismGenerators", name = "MekanismGenerators", version = "9.0.0", dependencies = "required-after:Mekanism", guiFactory = "mekanism.generators.client.gui.GeneratorsGuiFactory")
|
||||
public class MekanismGenerators implements IModule
|
||||
{
|
||||
/** Mekanism Generators Packet Pipeline */
|
||||
public static GeneratorsPacketHandler packetHandler = new GeneratorsPacketHandler();
|
||||
|
||||
@SidedProxy(clientSide = "mekanism.generators.client.GeneratorsClientProxy", serverSide = "mekanism.generators.common.GeneratorsCommonProxy")
|
||||
public static GeneratorsCommonProxy proxy;
|
||||
|
||||
|
@ -71,8 +68,6 @@ public class MekanismGenerators implements IModule
|
|||
{
|
||||
//Add this module to the core list
|
||||
Mekanism.modulesLoaded.add(this);
|
||||
|
||||
packetHandler.initialize();
|
||||
|
||||
//Register this module's GUI handler in the simple packet protocol
|
||||
PacketSimpleGui.handlers.add(1, proxy);
|
||||
|
@ -207,10 +202,17 @@ public class MekanismGenerators implements IModule
|
|||
dataStream.writeDouble(generators.heatGenerationLava);
|
||||
dataStream.writeDouble(generators.heatGenerationNether);
|
||||
dataStream.writeDouble(generators.solarGeneration);
|
||||
|
||||
dataStream.writeDouble(generators.windGenerationMin);
|
||||
dataStream.writeDouble(generators.windGenerationMax);
|
||||
|
||||
dataStream.writeInt(generators.windGenerationMinY);
|
||||
dataStream.writeInt(generators.windGenerationMaxY);
|
||||
|
||||
dataStream.writeInt(generators.turbineBladesPerCoil);
|
||||
dataStream.writeDouble(generators.turbineBaseEnergyPerSteam);
|
||||
dataStream.writeDouble(generators.turbineVentGasFlow);
|
||||
dataStream.writeDouble(generators.turbineDisperserGasFlow);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -222,10 +224,17 @@ public class MekanismGenerators implements IModule
|
|||
generators.heatGenerationLava = dataStream.readDouble();
|
||||
generators.heatGenerationNether = dataStream.readDouble();
|
||||
generators.solarGeneration = dataStream.readDouble();
|
||||
|
||||
generators.windGenerationMin = dataStream.readDouble();
|
||||
generators.windGenerationMax = dataStream.readDouble();
|
||||
|
||||
generators.windGenerationMinY = dataStream.readInt();
|
||||
generators.windGenerationMaxY = dataStream.readInt();
|
||||
|
||||
generators.turbineBladesPerCoil = dataStream.readInt();
|
||||
generators.turbineBaseEnergyPerSteam = dataStream.readDouble();
|
||||
generators.turbineVentGasFlow = dataStream.readDouble();
|
||||
generators.turbineDisperserGasFlow = dataStream.readDouble();
|
||||
}
|
||||
|
||||
@SubscribeEvent
|
||||
|
|
|
@ -4,6 +4,7 @@ import java.util.Arrays;
|
|||
import java.util.List;
|
||||
import java.util.Random;
|
||||
|
||||
import mekanism.api.MekanismConfig.client;
|
||||
import mekanism.api.MekanismConfig.general;
|
||||
import mekanism.api.energy.IEnergizedItem;
|
||||
import mekanism.common.CTMData;
|
||||
|
@ -231,7 +232,7 @@ public class BlockGenerator extends BlockContainer implements ISpecialBounds, IB
|
|||
@Override
|
||||
public int getLightValue(IBlockAccess world, int x, int y, int z)
|
||||
{
|
||||
if(general.enableAmbientLighting)
|
||||
if(client.enableAmbientLighting)
|
||||
{
|
||||
TileEntity tileEntity = world.getTileEntity(x, y, z);
|
||||
|
||||
|
@ -239,7 +240,7 @@ public class BlockGenerator extends BlockContainer implements ISpecialBounds, IB
|
|||
{
|
||||
if(((IActiveState)tileEntity).getActive() && ((IActiveState)tileEntity).lightUpdate())
|
||||
{
|
||||
return general.ambientLightingLevel;
|
||||
return client.ambientLightingLevel;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,115 +0,0 @@
|
|||
package mekanism.generators.common.network;
|
||||
|
||||
import mekanism.api.Coord4D;
|
||||
import mekanism.common.tile.TileEntityBasicBlock;
|
||||
import mekanism.generators.common.GeneratorsPacketHandler;
|
||||
import mekanism.generators.common.MekanismGenerators;
|
||||
import mekanism.generators.common.network.PacketGeneratorsGui.GeneratorsGuiMessage;
|
||||
|
||||
import net.minecraft.client.gui.GuiScreen;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.entity.player.EntityPlayerMP;
|
||||
import net.minecraft.world.World;
|
||||
import cpw.mods.fml.common.FMLCommonHandler;
|
||||
import cpw.mods.fml.common.network.simpleimpl.IMessage;
|
||||
import cpw.mods.fml.common.network.simpleimpl.IMessageHandler;
|
||||
import cpw.mods.fml.common.network.simpleimpl.MessageContext;
|
||||
import cpw.mods.fml.relauncher.Side;
|
||||
import cpw.mods.fml.relauncher.SideOnly;
|
||||
|
||||
import io.netty.buffer.ByteBuf;
|
||||
|
||||
public class PacketGeneratorsGui implements IMessageHandler<GeneratorsGuiMessage, IMessage>
|
||||
{
|
||||
@Override
|
||||
public IMessage onMessage(GeneratorsGuiMessage message, MessageContext context)
|
||||
{
|
||||
EntityPlayer player = GeneratorsPacketHandler.getPlayer(context);
|
||||
|
||||
if(!player.worldObj.isRemote)
|
||||
{
|
||||
World worldServer = FMLCommonHandler.instance().getMinecraftServerInstance().worldServerForDimension(message.coord4D.dimensionId);
|
||||
|
||||
if(worldServer != null && message.coord4D.getTileEntity(worldServer) instanceof TileEntityBasicBlock)
|
||||
{
|
||||
if(message.guiId == -1)
|
||||
{
|
||||
return null;
|
||||
}
|
||||
|
||||
GeneratorsGuiMessage.openServerGui(message.guiId, (EntityPlayerMP)player, player.worldObj, message.coord4D);
|
||||
}
|
||||
}
|
||||
else {
|
||||
FMLCommonHandler.instance().showGuiScreen(GeneratorsGuiMessage.getGui(message.guiId, player, player.worldObj, message.coord4D));
|
||||
player.openContainer.windowId = message.windowId;
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
public static class GeneratorsGuiMessage implements IMessage
|
||||
{
|
||||
public Coord4D coord4D;
|
||||
|
||||
public int guiId;
|
||||
|
||||
public int windowId;
|
||||
|
||||
public GeneratorsGuiMessage() {}
|
||||
|
||||
public GeneratorsGuiMessage(Coord4D coord, int gui)
|
||||
{
|
||||
coord4D = coord;
|
||||
guiId = gui;
|
||||
}
|
||||
|
||||
public GeneratorsGuiMessage(Coord4D coord, int gui, int id)
|
||||
{
|
||||
this(coord, gui);
|
||||
windowId = id;
|
||||
}
|
||||
|
||||
public static void openServerGui(int id, EntityPlayerMP playerMP, World world, Coord4D obj)
|
||||
{
|
||||
playerMP.closeContainer();
|
||||
playerMP.getNextWindowId();
|
||||
|
||||
int window = playerMP.currentWindowId;
|
||||
|
||||
MekanismGenerators.packetHandler.sendTo(new GeneratorsGuiMessage(obj, id, window), playerMP);
|
||||
|
||||
playerMP.openContainer = MekanismGenerators.proxy.getServerGui(id, playerMP, world, obj.xCoord, obj.yCoord, obj.zCoord);
|
||||
playerMP.openContainer.windowId = window;
|
||||
playerMP.openContainer.addCraftingToCrafters(playerMP);
|
||||
}
|
||||
|
||||
@SideOnly(Side.CLIENT)
|
||||
public static GuiScreen getGui(int id, EntityPlayer player, World world, Coord4D obj)
|
||||
{
|
||||
return (GuiScreen)MekanismGenerators.proxy.getClientGui(id, player, world, obj.xCoord, obj.yCoord, obj.zCoord);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void toBytes(ByteBuf dataStream)
|
||||
{
|
||||
dataStream.writeInt(coord4D.xCoord);
|
||||
dataStream.writeInt(coord4D.yCoord);
|
||||
dataStream.writeInt(coord4D.zCoord);
|
||||
|
||||
dataStream.writeInt(coord4D.dimensionId);
|
||||
|
||||
dataStream.writeInt(guiId);
|
||||
dataStream.writeInt(windowId);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void fromBytes(ByteBuf dataStream)
|
||||
{
|
||||
coord4D = new Coord4D(dataStream.readInt(), dataStream.readInt(), dataStream.readInt(), dataStream.readInt());
|
||||
|
||||
guiId = dataStream.readInt();
|
||||
windowId = dataStream.readInt();
|
||||
}
|
||||
}
|
||||
}
|
|
@ -497,7 +497,8 @@ gui.maxProduction=Max Production
|
|||
gui.limiting=Limiting
|
||||
gui.steamInput=Steam Input
|
||||
gui.capacity=Capacity
|
||||
gui.energyType=Energy Type
|
||||
gui.unit=Unit
|
||||
gui.temp=Temp
|
||||
|
||||
gui.reactor.injectionRate=Injection Rate
|
||||
|
||||
|
|
Loading…
Reference in a new issue