Wind Generators are now much more efficient
This commit is contained in:
parent
0ae477fd01
commit
a59ba334ba
3 changed files with 37 additions and 10 deletions
|
@ -46,7 +46,7 @@ public class GuiWindGenerator extends GuiMekanism
|
|||
public List<String> 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);
|
||||
|
|
|
@ -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;
|
||||
}
|
||||
|
|
|
@ -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;
|
||||
|
@ -15,6 +19,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()
|
||||
{
|
||||
super("wind", "WindGenerator", 200000, (generators.windGenerationMax)*2);
|
||||
|
@ -30,17 +36,39 @@ 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()
|
||||
{
|
||||
|
|
Loading…
Reference in a new issue