diff --git a/src/main/java/mekanism/generators/client/gui/GuiWindGenerator.java b/src/main/java/mekanism/generators/client/gui/GuiWindGenerator.java index 94289a00c..07d21b127 100644 --- a/src/main/java/mekanism/generators/client/gui/GuiWindGenerator.java +++ b/src/main/java/mekanism/generators/client/gui/GuiWindGenerator.java @@ -46,7 +46,7 @@ public class GuiWindGenerator extends GuiMekanism public List getInfo() { return ListUtils.asList( - LangUtils.localize("gui.producing") + ": " + MekanismUtils.getEnergyDisplay(tileEntity.isActive ? generators.windGenerationMin*tileEntity.getMultiplier() : 0) + "/t", + LangUtils.localize("gui.producing") + ": " + MekanismUtils.getEnergyDisplay(tileEntity.isActive ? generators.windGenerationMin*tileEntity.currentMultiplier : 0) + "/t", LangUtils.localize("gui.maxOutput") + ": " + MekanismUtils.getEnergyDisplay(tileEntity.getMaxOutput()) + "/t"); } }, this, MekanismUtils.getResource(ResourceType.GUI, "GuiWindTurbine.png"))); @@ -62,12 +62,12 @@ public class GuiWindGenerator extends GuiMekanism fontRendererObj.drawString(tileEntity.getInventoryName(), 45, 6, 0x404040); fontRendererObj.drawString(LangUtils.localize("container.inventory"), 8, (ySize - 96) + 2, 0x404040); fontRendererObj.drawString(MekanismUtils.getEnergyDisplay(tileEntity.getEnergy()), 51, 26, 0x00CD00); - fontRendererObj.drawString(LangUtils.localize("gui.power") + ": " + powerFormat.format(MekanismUtils.convertToDisplay(generators.windGenerationMin*tileEntity.getMultiplier())), 51, 35, 0x00CD00); + fontRendererObj.drawString(LangUtils.localize("gui.power") + ": " + powerFormat.format(MekanismUtils.convertToDisplay(generators.windGenerationMin*tileEntity.currentMultiplier)), 51, 35, 0x00CD00); fontRendererObj.drawString(LangUtils.localize("gui.out") + ": " + MekanismUtils.getEnergyDisplay(tileEntity.getMaxOutput()) + "/t", 51, 44, 0x00CD00); int size = 44; - if(!tileEntity.getWorldObj().canBlockSeeTheSky(tileEntity.xCoord, tileEntity.yCoord+4, tileEntity.zCoord)) + if(!tileEntity.getActive()) { size += 9; fontRendererObj.drawString(EnumColor.DARK_RED + LangUtils.localize("gui.skyBlocked"), 51, size, 0x00CD00); diff --git a/src/main/java/mekanism/generators/client/render/RenderWindGenerator.java b/src/main/java/mekanism/generators/client/render/RenderWindGenerator.java index 35744a2a2..610ef98ef 100644 --- a/src/main/java/mekanism/generators/client/render/RenderWindGenerator.java +++ b/src/main/java/mekanism/generators/client/render/RenderWindGenerator.java @@ -36,8 +36,7 @@ public class RenderWindGenerator extends TileEntitySpecialRenderer GL11.glRotatef(180, 0F, 0F, 1F); - if(!Mekanism.proxy.isPaused() && - tileEntity.getWorldObj().canBlockSeeTheSky(tileEntity.xCoord, tileEntity.yCoord+4, tileEntity.zCoord)) + if(!Mekanism.proxy.isPaused() && tileEntity.getActive()) { tileEntity.angle = (tileEntity.angle+((tileEntity.yCoord+4F)/256F)*8) % 360; } diff --git a/src/main/java/mekanism/generators/common/tile/TileEntityWindGenerator.java b/src/main/java/mekanism/generators/common/tile/TileEntityWindGenerator.java index d7c355962..56dbae40e 100644 --- a/src/main/java/mekanism/generators/common/tile/TileEntityWindGenerator.java +++ b/src/main/java/mekanism/generators/common/tile/TileEntityWindGenerator.java @@ -1,5 +1,9 @@ package mekanism.generators.common.tile; +import io.netty.buffer.ByteBuf; + +import java.util.ArrayList; + import mekanism.api.Coord4D; import mekanism.api.MekanismConfig.generators; import mekanism.common.base.IBoundingBlock; @@ -14,6 +18,8 @@ public class TileEntityWindGenerator extends TileEntityGenerator implements IBou { /** The angle the blades of this Wind Turbine are currently at. */ public double angle; + + public float currentMultiplier; public TileEntityWindGenerator() { @@ -30,16 +36,38 @@ public class TileEntityWindGenerator extends TileEntityGenerator implements IBou { ChargeUtils.charge(0, this); - if(canOperate()) + if(ticker % 20 == 0) { - setActive(true); - setEnergy(electricityStored + (generators.windGenerationMin*getMultiplier())); + setActive((currentMultiplier = getMultiplier()) > 0); } - else { - setActive(false); + System.out.println(currentMultiplier + " " + worldObj.canBlockSeeTheSky(xCoord, yCoord+4, zCoord)); + if(getActive()) + { + setEnergy(electricityStored + (generators.windGenerationMin*currentMultiplier)); } } } + + @Override + public void handlePacketData(ByteBuf dataStream) + { + super.handlePacketData(dataStream); + + if(worldObj.isRemote) + { + currentMultiplier = dataStream.readFloat(); + } + } + + @Override + public ArrayList getNetworkedData(ArrayList data) + { + super.getNetworkedData(data); + + data.add(currentMultiplier); + + return data; + } /** Determines the current output multiplier, taking sky visibility and height into account. **/ public float getMultiplier()