Loads of untested work on turbine interface
This commit is contained in:
parent
afe8969c37
commit
2984bf45a8
34 changed files with 511 additions and 82 deletions
|
@ -2,10 +2,10 @@ package mekanism.client.gui;
|
|||
|
||||
import mekanism.api.energy.IStrictEnergyStorage;
|
||||
import mekanism.client.gui.element.GuiEnergyGauge;
|
||||
import mekanism.client.gui.element.GuiMatrixTab;
|
||||
import mekanism.client.gui.element.GuiRateBar;
|
||||
import mekanism.client.gui.element.GuiEnergyGauge.IEnergyInfoHandler;
|
||||
import mekanism.client.gui.element.GuiMatrixTab;
|
||||
import mekanism.client.gui.element.GuiMatrixTab.MatrixTab;
|
||||
import mekanism.client.gui.element.GuiRateBar;
|
||||
import mekanism.client.gui.element.GuiRateBar.IRateInfoHandler;
|
||||
import mekanism.common.inventory.container.ContainerNull;
|
||||
import mekanism.common.tile.TileEntityInductionCasing;
|
||||
|
@ -28,7 +28,7 @@ public class GuiMatrixStats extends GuiMekanism
|
|||
{
|
||||
super(tentity, new ContainerNull(inventory.player, tentity));
|
||||
tileEntity = tentity;
|
||||
guiElements.add(new GuiMatrixTab(this, tileEntity, MatrixTab.MAIN, 6, MekanismUtils.getResource(ResourceType.GUI, "GuiMatrixStats.png")));
|
||||
guiElements.add(new GuiMatrixTab(this, tileEntity, MatrixTab.MAIN, 6, MekanismUtils.getResource(ResourceType.GUI, "GuiNull.png")));
|
||||
guiElements.add(new GuiEnergyGauge(new IEnergyInfoHandler()
|
||||
{
|
||||
@Override
|
||||
|
@ -36,7 +36,7 @@ public class GuiMatrixStats extends GuiMekanism
|
|||
{
|
||||
return tileEntity;
|
||||
}
|
||||
}, GuiEnergyGauge.Type.STANDARD, this, MekanismUtils.getResource(ResourceType.GUI, "GuiMatrixStats.png"), 6, 13));
|
||||
}, GuiEnergyGauge.Type.STANDARD, this, MekanismUtils.getResource(ResourceType.GUI, "GuiNull.png"), 6, 13));
|
||||
guiElements.add(new GuiRateBar(this, new IRateInfoHandler()
|
||||
{
|
||||
@Override
|
||||
|
@ -50,7 +50,7 @@ public class GuiMatrixStats extends GuiMekanism
|
|||
{
|
||||
return tileEntity.structure.lastInput/tileEntity.structure.transferCap;
|
||||
}
|
||||
}, MekanismUtils.getResource(ResourceType.GUI, "GuiMatrixStats.png"), 30, 13));
|
||||
}, MekanismUtils.getResource(ResourceType.GUI, "GuiNull.png"), 30, 13));
|
||||
guiElements.add(new GuiRateBar(this, new IRateInfoHandler()
|
||||
{
|
||||
@Override
|
||||
|
@ -64,7 +64,7 @@ public class GuiMatrixStats extends GuiMekanism
|
|||
{
|
||||
return tileEntity.structure.lastOutput/tileEntity.structure.transferCap;
|
||||
}
|
||||
}, MekanismUtils.getResource(ResourceType.GUI, "GuiMatrixStats.png"), 38, 13));
|
||||
}, MekanismUtils.getResource(ResourceType.GUI, "GuiNull.png"), 38, 13));
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -93,7 +93,7 @@ public class GuiMatrixStats extends GuiMekanism
|
|||
@Override
|
||||
protected void drawGuiContainerBackgroundLayer(float partialTick, int mouseX, int mouseY)
|
||||
{
|
||||
mc.renderEngine.bindTexture(MekanismUtils.getResource(ResourceType.GUI, "GuiMatrixStats.png"));
|
||||
mc.renderEngine.bindTexture(MekanismUtils.getResource(ResourceType.GUI, "GuiNull.png"));
|
||||
GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F);
|
||||
int guiWidth = (width - xSize) / 2;
|
||||
int guiHeight = (height - ySize) / 2;
|
||||
|
|
|
@ -277,13 +277,13 @@ public class GuiOredictionificatorFilter extends GuiMekanism
|
|||
Mekanism.packetHandler.sendToServer(new EditFilterMessage(Coord4D.get(tileEntity), false, origFilter, filter));
|
||||
}
|
||||
|
||||
Mekanism.packetHandler.sendToServer(new SimpleGuiMessage(Coord4D.get(tileEntity), 52));
|
||||
Mekanism.packetHandler.sendToServer(new SimpleGuiMessage(Coord4D.get(tileEntity), 0, 52));
|
||||
}
|
||||
}
|
||||
else if(guibutton.id == 1)
|
||||
{
|
||||
Mekanism.packetHandler.sendToServer(new EditFilterMessage(Coord4D.get(tileEntity), true, origFilter, null));
|
||||
Mekanism.packetHandler.sendToServer(new SimpleGuiMessage(Coord4D.get(tileEntity), 52));
|
||||
Mekanism.packetHandler.sendToServer(new SimpleGuiMessage(Coord4D.get(tileEntity), 0, 52));
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -310,7 +310,7 @@ public class GuiOredictionificatorFilter extends GuiMekanism
|
|||
if(xAxis >= 5 && xAxis <= 16 && yAxis >= 5 && yAxis <= 16)
|
||||
{
|
||||
SoundHandler.playSound("gui.button.press");
|
||||
Mekanism.packetHandler.sendToServer(new SimpleGuiMessage(Coord4D.get(tileEntity), 52));
|
||||
Mekanism.packetHandler.sendToServer(new SimpleGuiMessage(Coord4D.get(tileEntity), 0, 52));
|
||||
}
|
||||
|
||||
if(xAxis >= 130 && xAxis <= 142 && yAxis >= 48 && yAxis <= 60)
|
||||
|
|
|
@ -222,7 +222,7 @@ public class GuiSideConfiguration extends GuiMekanism
|
|||
{
|
||||
int guiId = MachineType.get(tile.getBlockType(), tile.getBlockMetadata()).guiId;
|
||||
SoundHandler.playSound("gui.button.press");
|
||||
Mekanism.packetHandler.sendToServer(new SimpleGuiMessage(Coord4D.get(tile), guiId));
|
||||
Mekanism.packetHandler.sendToServer(new SimpleGuiMessage(Coord4D.get(tile), 0, guiId));
|
||||
}
|
||||
|
||||
if(xAxis >= 156 && xAxis <= 170 && yAxis >= 6 && yAxis <= 20)
|
||||
|
|
|
@ -187,7 +187,7 @@ public class GuiTransporterConfig extends GuiMekanism
|
|||
{
|
||||
int guiId = MachineType.get(tile.getBlockType(), tile.getBlockMetadata()).guiId;
|
||||
SoundHandler.playSound("gui.button.press");
|
||||
Mekanism.packetHandler.sendToServer(new SimpleGuiMessage(Coord4D.get(tile), guiId));
|
||||
Mekanism.packetHandler.sendToServer(new SimpleGuiMessage(Coord4D.get(tile), 0, guiId));
|
||||
}
|
||||
|
||||
if(xAxis >= 156 && xAxis <= 170 && yAxis >= 6 && yAxis <= 20)
|
||||
|
|
|
@ -302,7 +302,7 @@ public class GuiUpgradeManagement extends GuiMekanism
|
|||
{
|
||||
int guiId = MachineType.get(tile.getBlockType(), tile.getBlockMetadata()).guiId;
|
||||
SoundHandler.playSound("gui.button.press");
|
||||
Mekanism.packetHandler.sendToServer(new SimpleGuiMessage(Coord4D.get(tile), guiId));
|
||||
Mekanism.packetHandler.sendToServer(new SimpleGuiMessage(Coord4D.get(tile), 0, guiId));
|
||||
}
|
||||
|
||||
if(selectedType != null && xAxis >= 136 && xAxis <= 148 && yAxis >= 57 && yAxis <= 69)
|
||||
|
|
|
@ -106,7 +106,7 @@ public class GuiMatrixTab extends GuiElement
|
|||
|
||||
public void openGui(TileEntity tile)
|
||||
{
|
||||
Mekanism.packetHandler.sendToServer(new SimpleGuiMessage(Coord4D.get(tile), guiId));
|
||||
Mekanism.packetHandler.sendToServer(new SimpleGuiMessage(Coord4D.get(tile), 0, guiId));
|
||||
}
|
||||
|
||||
public String getDesc()
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
package mekanism.client.gui.element;
|
||||
|
||||
import mekanism.api.energy.IStrictEnergyStorage;
|
||||
import mekanism.client.gui.IGuiWrapper;
|
||||
import mekanism.common.tile.TileEntityElectricBlock;
|
||||
import mekanism.common.util.MekanismUtils;
|
||||
import mekanism.common.util.MekanismUtils.ResourceType;
|
||||
import net.minecraft.util.ResourceLocation;
|
||||
|
@ -19,10 +19,10 @@ public class GuiPowerBar extends GuiElement
|
|||
private int height = 56;
|
||||
private int innerOffsetY = 2;
|
||||
|
||||
private TileEntityElectricBlock tileEntity;
|
||||
private IStrictEnergyStorage tileEntity;
|
||||
private IPowerInfoHandler handler;
|
||||
|
||||
public GuiPowerBar(IGuiWrapper gui, TileEntityElectricBlock tile, ResourceLocation def, int x, int y)
|
||||
public GuiPowerBar(IGuiWrapper gui, IStrictEnergyStorage tile, ResourceLocation def, int x, int y)
|
||||
{
|
||||
super(MekanismUtils.getResource(ResourceType.GUI_ELEMENT, "GuiPowerBar.png"), gui, def);
|
||||
|
||||
|
|
|
@ -73,7 +73,7 @@ public class GuiSideConfigurationTab extends GuiElement
|
|||
{
|
||||
if(xAxis >= -21 && xAxis <= -3 && yAxis >= 10 && yAxis <= 28)
|
||||
{
|
||||
Mekanism.packetHandler.sendToServer(new SimpleGuiMessage(Coord4D.get(tileEntity), 9));
|
||||
Mekanism.packetHandler.sendToServer(new SimpleGuiMessage(Coord4D.get(tileEntity), 0, 9));
|
||||
SoundHandler.playSound("gui.button.press");
|
||||
}
|
||||
}
|
||||
|
|
|
@ -75,7 +75,7 @@ public class GuiTransporterConfigTab extends GuiElement
|
|||
{
|
||||
if(xAxis >= -21 && xAxis <= -3 && yAxis >= yPos+4 && yAxis <= yPos+22)
|
||||
{
|
||||
Mekanism.packetHandler.sendToServer(new SimpleGuiMessage(Coord4D.get(tileEntity), 51));
|
||||
Mekanism.packetHandler.sendToServer(new SimpleGuiMessage(Coord4D.get(tileEntity), 0, 51));
|
||||
SoundHandler.playSound("gui.button.press");
|
||||
}
|
||||
}
|
||||
|
|
|
@ -70,7 +70,7 @@ public class GuiUpgradeTab extends GuiElement
|
|||
{
|
||||
if(xAxis >= 179 && xAxis <= 197 && yAxis >= 10 && yAxis <= 28)
|
||||
{
|
||||
Mekanism.packetHandler.sendToServer(new SimpleGuiMessage(Coord4D.get(tileEntity), 43));
|
||||
Mekanism.packetHandler.sendToServer(new SimpleGuiMessage(Coord4D.get(tileEntity), 0, 43));
|
||||
SoundHandler.playSound("gui.button.press");
|
||||
}
|
||||
}
|
||||
|
|
|
@ -12,6 +12,7 @@ import mekanism.api.Pos3D;
|
|||
import mekanism.api.util.UnitDisplayUtils.EnergyType;
|
||||
import mekanism.api.util.UnitDisplayUtils.TempType;
|
||||
import mekanism.client.SparkleAnimation.INodeChecker;
|
||||
import mekanism.common.base.IGuiProvider;
|
||||
import mekanism.common.base.IUpgradeTile;
|
||||
import mekanism.common.block.BlockMachine.MachineType;
|
||||
import mekanism.common.entity.EntityRobit;
|
||||
|
@ -130,7 +131,7 @@ import cpw.mods.fml.relauncher.FMLInjectionData;
|
|||
* @author AidanBrady
|
||||
*
|
||||
*/
|
||||
public class CommonProxy
|
||||
public class CommonProxy implements IGuiProvider
|
||||
{
|
||||
public static int MACHINE_RENDER_ID = RenderingRegistry.getNextAvailableRenderId();
|
||||
public static int BASIC_RENDER_ID = RenderingRegistry.getNextAvailableRenderId();
|
||||
|
@ -392,31 +393,13 @@ public class CommonProxy
|
|||
*/
|
||||
public void doMultiblockSparkle(TileEntityMultiblock<?> tileEntity) {}
|
||||
|
||||
/**
|
||||
* Get the actual interface for a GUI. Client-only.
|
||||
* @param ID - gui ID
|
||||
* @param player - player that opened the GUI
|
||||
* @param world - world the GUI was opened in
|
||||
* @param x - gui's x position
|
||||
* @param y - gui's y position
|
||||
* @param z - gui's z position
|
||||
* @return the GuiScreen of the GUI
|
||||
*/
|
||||
@Override
|
||||
public Object getClientGui(int ID, EntityPlayer player, World world, int x, int y, int z)
|
||||
{
|
||||
return null;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the container for a GUI. Common.
|
||||
* @param ID - gui ID
|
||||
* @param player - player that opened the GUI
|
||||
* @param world - world the GUI was opened in
|
||||
* @param x - gui's x position
|
||||
* @param y - gui's y position
|
||||
* @param z - gui's z position
|
||||
* @return the Container of the GUI
|
||||
*/
|
||||
@Override
|
||||
public Container getServerGui(int ID, EntityPlayer player, World world, int x, int y, int z)
|
||||
{
|
||||
TileEntity tileEntity = world.getTileEntity(x, y, z);
|
||||
|
|
|
@ -59,6 +59,7 @@ import mekanism.common.integration.OreDictManager;
|
|||
import mekanism.common.multiblock.MultiblockManager;
|
||||
import mekanism.common.multipart.MultipartMekanism;
|
||||
import mekanism.common.network.PacketDataRequest.DataRequestMessage;
|
||||
import mekanism.common.network.PacketSimpleGui;
|
||||
import mekanism.common.network.PacketTransmitterUpdate.PacketType;
|
||||
import mekanism.common.network.PacketTransmitterUpdate.TransmitterUpdateMessage;
|
||||
import mekanism.common.recipe.BinRecipe;
|
||||
|
@ -1203,6 +1204,9 @@ public class Mekanism
|
|||
//Register to receive subscribed events
|
||||
FMLCommonHandler.instance().bus().register(this);
|
||||
MinecraftForge.EVENT_BUS.register(this);
|
||||
|
||||
//Register this module's GUI handler in the simple packet protocol
|
||||
PacketSimpleGui.handlers.add(0, proxy);
|
||||
|
||||
//Set up VoiceServerManager
|
||||
if(general.voiceServerEnabled)
|
||||
|
|
32
src/main/java/mekanism/common/base/IGuiProvider.java
Normal file
32
src/main/java/mekanism/common/base/IGuiProvider.java
Normal file
|
@ -0,0 +1,32 @@
|
|||
package mekanism.common.base;
|
||||
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.inventory.Container;
|
||||
import net.minecraft.world.World;
|
||||
|
||||
public interface IGuiProvider
|
||||
{
|
||||
/**
|
||||
* Get the container for a GUI. Common.
|
||||
* @param ID - gui ID
|
||||
* @param player - player that opened the GUI
|
||||
* @param world - world the GUI was opened in
|
||||
* @param x - gui's x position
|
||||
* @param y - gui's y position
|
||||
* @param z - gui's z position
|
||||
* @return the Container of the GUI
|
||||
*/
|
||||
public Container getServerGui(int ID, EntityPlayer player, World world, int x, int y, int z);
|
||||
|
||||
/**
|
||||
* Get the actual interface for a GUI. Client-only.
|
||||
* @param ID - gui ID
|
||||
* @param player - player that opened the GUI
|
||||
* @param world - world the GUI was opened in
|
||||
* @param x - gui's x position
|
||||
* @param y - gui's y position
|
||||
* @param z - gui's z position
|
||||
* @return the GuiScreen of the GUI
|
||||
*/
|
||||
public Object getClientGui(int ID, EntityPlayer player, World world, int x, int y, int z);
|
||||
}
|
|
@ -1,11 +1,16 @@
|
|||
package mekanism.common.network;
|
||||
|
||||
import io.netty.buffer.ByteBuf;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
import mekanism.api.Coord4D;
|
||||
import mekanism.common.Mekanism;
|
||||
import mekanism.common.PacketHandler;
|
||||
import mekanism.common.base.IGuiProvider;
|
||||
import mekanism.common.network.PacketSimpleGui.SimpleGuiMessage;
|
||||
import mekanism.common.tile.TileEntityBasicBlock;
|
||||
|
||||
import net.minecraft.client.gui.GuiScreen;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.entity.player.EntityPlayerMP;
|
||||
|
@ -17,10 +22,10 @@ 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 PacketSimpleGui implements IMessageHandler<SimpleGuiMessage, IMessage>
|
||||
{
|
||||
public static List<IGuiProvider> handlers = new ArrayList<IGuiProvider>();
|
||||
|
||||
@Override
|
||||
public IMessage onMessage(SimpleGuiMessage message, MessageContext context)
|
||||
{
|
||||
|
@ -37,11 +42,11 @@ public class PacketSimpleGui implements IMessageHandler<SimpleGuiMessage, IMessa
|
|||
return null;
|
||||
}
|
||||
|
||||
SimpleGuiMessage.openServerGui(message.guiId, (EntityPlayerMP)player, player.worldObj, message.coord4D);
|
||||
SimpleGuiMessage.openServerGui(message.guiHandler, message.guiId, (EntityPlayerMP)player, player.worldObj, message.coord4D);
|
||||
}
|
||||
}
|
||||
else {
|
||||
FMLCommonHandler.instance().showGuiScreen(SimpleGuiMessage.getGui(message.guiId, player, player.worldObj, message.coord4D));
|
||||
FMLCommonHandler.instance().showGuiScreen(SimpleGuiMessage.getGui(message.guiHandler, message.guiId, player, player.worldObj, message.coord4D));
|
||||
player.openContainer.windowId = message.windowId;
|
||||
}
|
||||
|
||||
|
@ -51,6 +56,8 @@ public class PacketSimpleGui implements IMessageHandler<SimpleGuiMessage, IMessa
|
|||
public static class SimpleGuiMessage implements IMessage
|
||||
{
|
||||
public Coord4D coord4D;
|
||||
|
||||
public int guiHandler;
|
||||
|
||||
public int guiId;
|
||||
|
||||
|
@ -58,36 +65,37 @@ public class PacketSimpleGui implements IMessageHandler<SimpleGuiMessage, IMessa
|
|||
|
||||
public SimpleGuiMessage() {}
|
||||
|
||||
public SimpleGuiMessage(Coord4D coord, int gui)
|
||||
public SimpleGuiMessage(Coord4D coord, int handler, int gui)
|
||||
{
|
||||
coord4D = coord;
|
||||
guiHandler = handler;
|
||||
guiId = gui;
|
||||
}
|
||||
|
||||
public SimpleGuiMessage(Coord4D coord, int gui, int id)
|
||||
public SimpleGuiMessage(Coord4D coord, int handler, int gui, int id)
|
||||
{
|
||||
this(coord, gui);
|
||||
this(coord, handler, gui);
|
||||
windowId = id;
|
||||
}
|
||||
|
||||
public static void openServerGui(int id, EntityPlayerMP playerMP, World world, Coord4D obj)
|
||||
public static void openServerGui(int handler, int id, EntityPlayerMP playerMP, World world, Coord4D obj)
|
||||
{
|
||||
playerMP.closeContainer();
|
||||
playerMP.getNextWindowId();
|
||||
|
||||
int window = playerMP.currentWindowId;
|
||||
|
||||
Mekanism.packetHandler.sendTo(new SimpleGuiMessage(obj, id, window), playerMP);
|
||||
Mekanism.packetHandler.sendTo(new SimpleGuiMessage(obj, handler, id, window), playerMP);
|
||||
|
||||
playerMP.openContainer = Mekanism.proxy.getServerGui(id, playerMP, world, obj.xCoord, obj.yCoord, obj.zCoord);
|
||||
playerMP.openContainer = handlers.get(handler).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)
|
||||
public static GuiScreen getGui(int handler, int id, EntityPlayer player, World world, Coord4D obj)
|
||||
{
|
||||
return (GuiScreen)Mekanism.proxy.getClientGui(id, player, world, obj.xCoord, obj.yCoord, obj.zCoord);
|
||||
return (GuiScreen)handlers.get(handler).getClientGui(id, player, world, obj.xCoord, obj.yCoord, obj.zCoord);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
@ -11,6 +11,7 @@ import mekanism.generators.client.gui.GuiReactorHeat;
|
|||
import mekanism.generators.client.gui.GuiReactorLogicAdapter;
|
||||
import mekanism.generators.client.gui.GuiReactorStats;
|
||||
import mekanism.generators.client.gui.GuiSolarGenerator;
|
||||
import mekanism.generators.client.gui.GuiTurbineStats;
|
||||
import mekanism.generators.client.gui.GuiWindGenerator;
|
||||
import mekanism.generators.client.render.RenderAdvancedSolarGenerator;
|
||||
import mekanism.generators.client.render.RenderBioGenerator;
|
||||
|
@ -105,6 +106,8 @@ public class GeneratorsClientProxy extends GeneratorsCommonProxy
|
|||
return new GuiWindGenerator(player.inventory, (TileEntityWindGenerator)tileEntity);
|
||||
case 6:
|
||||
return new GuiIndustrialTurbine(player.inventory, (TileEntityTurbineCasing)tileEntity);
|
||||
case 7:
|
||||
return new GuiTurbineStats(player.inventory, (TileEntityTurbineCasing)tileEntity);
|
||||
case 10:
|
||||
return new GuiReactorController(player.inventory, (TileEntityReactorController)tileEntity);
|
||||
case 11:
|
||||
|
|
|
@ -1,9 +1,22 @@
|
|||
package mekanism.generators.client.gui;
|
||||
|
||||
import mekanism.client.gui.GuiMekanism;
|
||||
import mekanism.client.gui.element.GuiPowerBar;
|
||||
import mekanism.client.gui.element.GuiRateBar;
|
||||
import mekanism.client.gui.element.GuiRateBar.IRateInfoHandler;
|
||||
import mekanism.client.render.MekanismRenderer;
|
||||
import mekanism.common.inventory.container.ContainerFilter;
|
||||
import mekanism.common.util.LangUtils;
|
||||
import mekanism.common.util.MekanismUtils;
|
||||
import mekanism.common.util.MekanismUtils.ResourceType;
|
||||
import mekanism.generators.client.gui.element.GuiTurbineTab;
|
||||
import mekanism.generators.client.gui.element.GuiTurbineTab.TurbineTab;
|
||||
import mekanism.generators.common.tile.turbine.TileEntityTurbineCasing;
|
||||
import net.minecraft.entity.player.InventoryPlayer;
|
||||
import net.minecraftforge.fluids.FluidStack;
|
||||
|
||||
import org.lwjgl.opengl.GL11;
|
||||
|
||||
import cpw.mods.fml.relauncher.Side;
|
||||
import cpw.mods.fml.relauncher.SideOnly;
|
||||
|
||||
|
@ -16,5 +29,106 @@ public class GuiIndustrialTurbine extends GuiMekanism
|
|||
{
|
||||
super(tentity, new ContainerFilter(inventory, tentity));
|
||||
tileEntity = tentity;
|
||||
guiElements.add(new GuiTurbineTab(this, tileEntity, TurbineTab.STAT, 6, MekanismUtils.getResource(ResourceType.GUI, "GuiIndustrialTurbine.png")));
|
||||
guiElements.add(new GuiPowerBar(this, tileEntity, MekanismUtils.getResource(ResourceType.GUI, "GuiIndustrialTurbine.png"), 164, 16));
|
||||
guiElements.add(new GuiRateBar(this, new IRateInfoHandler()
|
||||
{
|
||||
@Override
|
||||
public String getTooltip()
|
||||
{
|
||||
return LangUtils.localize("gui.steamInput") + ": " + tileEntity.structure.lastSteamInput + "mB/t";
|
||||
}
|
||||
|
||||
@Override
|
||||
public double getLevel()
|
||||
{
|
||||
double rate = tileEntity.structure.lowerVolume*(tileEntity.structure.clientDispersers*TileEntityTurbineCasing.DISPERSER_GAS_FLOW);
|
||||
rate = Math.min(rate, tileEntity.structure.vents*TileEntityTurbineCasing.VENT_GAS_FLOW);
|
||||
|
||||
return (double)tileEntity.structure.lastSteamInput/rate;
|
||||
}
|
||||
}, MekanismUtils.getResource(ResourceType.GUI, "GuiNull.png"), 40, 13));
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void drawGuiContainerForegroundLayer(int mouseX, int mouseY)
|
||||
{
|
||||
int xAxis = (mouseX - (width - xSize) / 2);
|
||||
int yAxis = (mouseY - (height - ySize) / 2);
|
||||
|
||||
fontRendererObj.drawString(tileEntity.getInventoryName(), (xSize/2)-(fontRendererObj.getStringWidth(tileEntity.getInventoryName())/2), 6, 0x404040);
|
||||
|
||||
double energyMultiplier = TileEntityTurbineCasing.ENERGY_PER_STEAM*Math.min(tileEntity.structure.blades, tileEntity.structure.coils*TileEntityTurbineCasing.BLADE_TO_COIL_RATIO);
|
||||
|
||||
double rate = tileEntity.structure.lowerVolume*(tileEntity.structure.clientDispersers*TileEntityTurbineCasing.DISPERSER_GAS_FLOW);
|
||||
rate = Math.min(rate, tileEntity.structure.vents*TileEntityTurbineCasing.VENT_GAS_FLOW);
|
||||
|
||||
fontRendererObj.drawString(LangUtils.localize("gui.production") + ": " + MekanismUtils.getEnergyDisplay(tileEntity.structure.clientFlow*energyMultiplier), 53, 26, 0x00CD00);
|
||||
fontRendererObj.drawString(LangUtils.localize("gui.flowRate") + ": " + tileEntity.structure.clientFlow + " mB/t", 53, 35, 0x00CD00);
|
||||
fontRendererObj.drawString(LangUtils.localize("gui.capacity") + ": " + tileEntity.structure.getFluidCapacity() + " mB", 53, 44, 0x00CD00);
|
||||
fontRendererObj.drawString(LangUtils.localize("gui.maxFlow") + ": " + rate + " mB/t", 53, 53, 0x00CD00);
|
||||
|
||||
if(xAxis >= 7 && xAxis <= 39 && yAxis >= 14 && yAxis <= 72)
|
||||
{
|
||||
drawCreativeTabHoveringText(tileEntity.structure.fluidStored != null ? LangUtils.localizeFluidStack(tileEntity.structure.fluidStored) + ": " + tileEntity.structure.fluidStored.amount + "mB" : LangUtils.localize("gui.empty"), xAxis, yAxis);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void drawGuiContainerBackgroundLayer(float partialTick, int mouseX, int mouseY)
|
||||
{
|
||||
mc.renderEngine.bindTexture(MekanismUtils.getResource(ResourceType.GUI, "GuiIndustrialTurbine.png"));
|
||||
GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F);
|
||||
int guiWidth = (width - xSize) / 2;
|
||||
int guiHeight = (height - ySize) / 2;
|
||||
drawTexturedModalRect(guiWidth, guiHeight, 0, 0, xSize, ySize);
|
||||
|
||||
if(tileEntity.getScaledFluidLevel(58) > 0)
|
||||
{
|
||||
displayGauge(7, 14, tileEntity.getScaledFluidLevel(58), tileEntity.structure.fluidStored, 0);
|
||||
displayGauge(23, 14, tileEntity.getScaledFluidLevel(58), tileEntity.structure.fluidStored, 1);
|
||||
}
|
||||
|
||||
super.drawGuiContainerBackgroundLayer(partialTick, mouseX, mouseY);
|
||||
}
|
||||
|
||||
public void displayGauge(int xPos, int yPos, int scale, FluidStack fluid, int side /*0-left, 1-right*/)
|
||||
{
|
||||
if(fluid == null)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
int guiWidth = (width - xSize) / 2;
|
||||
int guiHeight = (height - ySize) / 2;
|
||||
|
||||
int start = 0;
|
||||
|
||||
while(true)
|
||||
{
|
||||
int renderRemaining = 0;
|
||||
|
||||
if(scale > 16)
|
||||
{
|
||||
renderRemaining = 16;
|
||||
scale -= 16;
|
||||
}
|
||||
else {
|
||||
renderRemaining = scale;
|
||||
scale = 0;
|
||||
}
|
||||
|
||||
mc.renderEngine.bindTexture(MekanismRenderer.getBlocksTexture());
|
||||
drawTexturedModelRectFromIcon(guiWidth + xPos, guiHeight + yPos + 58 - renderRemaining - start, fluid.getFluid().getIcon(), 16, 16 - (16 - renderRemaining));
|
||||
start+=16;
|
||||
|
||||
if(renderRemaining == 0 || scale == 0)
|
||||
{
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
mc.renderEngine.bindTexture(MekanismUtils.getResource(ResourceType.GUI, "GuiIndustrialTurbine.png"));
|
||||
drawTexturedModalRect(guiWidth + xPos, guiHeight + yPos, 176, side == 0 ? 0 : 54, 16, 54);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -12,6 +12,9 @@ import mekanism.client.gui.element.GuiSlot.SlotType;
|
|||
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.client.gui.element.GuiStatTab;
|
||||
import mekanism.generators.common.inventory.container.ContainerReactorController;
|
||||
import mekanism.generators.common.tile.reactor.TileEntityReactorController;
|
||||
import net.minecraft.entity.player.InventoryPlayer;
|
||||
|
|
|
@ -22,6 +22,8 @@ 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;
|
||||
|
|
|
@ -25,6 +25,8 @@ import mekanism.common.inventory.container.ContainerNull;
|
|||
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;
|
||||
|
|
|
@ -16,6 +16,8 @@ import mekanism.common.inventory.container.ContainerNull;
|
|||
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;
|
||||
|
|
|
@ -0,0 +1,80 @@
|
|||
package mekanism.generators.client.gui;
|
||||
|
||||
import mekanism.api.EnumColor;
|
||||
import mekanism.client.gui.GuiMekanism;
|
||||
import mekanism.common.inventory.container.ContainerNull;
|
||||
import mekanism.common.util.LangUtils;
|
||||
import mekanism.common.util.MekanismUtils;
|
||||
import mekanism.common.util.MekanismUtils.ResourceType;
|
||||
import mekanism.generators.client.gui.element.GuiTurbineTab;
|
||||
import mekanism.generators.client.gui.element.GuiTurbineTab.TurbineTab;
|
||||
import mekanism.generators.common.tile.turbine.TileEntityTurbineCasing;
|
||||
import net.minecraft.entity.player.InventoryPlayer;
|
||||
|
||||
import org.lwjgl.opengl.GL11;
|
||||
|
||||
import cpw.mods.fml.relauncher.Side;
|
||||
import cpw.mods.fml.relauncher.SideOnly;
|
||||
|
||||
@SideOnly(Side.CLIENT)
|
||||
public class GuiTurbineStats extends GuiMekanism
|
||||
{
|
||||
public TileEntityTurbineCasing tileEntity;
|
||||
|
||||
public GuiTurbineStats(InventoryPlayer inventory, TileEntityTurbineCasing tentity)
|
||||
{
|
||||
super(tentity, new ContainerNull(inventory.player, tentity));
|
||||
tileEntity = tentity;
|
||||
guiElements.add(new GuiTurbineTab(this, tileEntity, TurbineTab.MAIN, 6, MekanismUtils.getResource(ResourceType.GUI, "GuiNull.png")));
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void drawGuiContainerForegroundLayer(int mouseX, int mouseY)
|
||||
{
|
||||
int xAxis = (mouseX - (width - xSize) / 2);
|
||||
int yAxis = (mouseY - (height - ySize) / 2);
|
||||
|
||||
String stats = LangUtils.localize("gui.matrixStats");
|
||||
String limiting = EnumColor.DARK_RED + " (" + LangUtils.localize("gui.limiting") + ")";
|
||||
|
||||
fontRendererObj.drawString(stats, (xSize/2)-(fontRendererObj.getStringWidth(stats)/2), 6, 0x404040);
|
||||
|
||||
fontRendererObj.drawString(LangUtils.localize("gui.tankVolume") + ": " + tileEntity.structure.lowerVolume, 8, 26, 0x404040);
|
||||
|
||||
boolean dispersersLimiting = tileEntity.structure.clientDispersers*TileEntityTurbineCasing.DISPERSER_GAS_FLOW <
|
||||
tileEntity.structure.vents*TileEntityTurbineCasing.VENT_GAS_FLOW;
|
||||
boolean ventsLimiting = tileEntity.structure.clientDispersers*TileEntityTurbineCasing.DISPERSER_GAS_FLOW >
|
||||
tileEntity.structure.vents*TileEntityTurbineCasing.VENT_GAS_FLOW;
|
||||
|
||||
fontRendererObj.drawString(LangUtils.localize("gui.steamFlow"), 8, 40, 0x797979);
|
||||
fontRendererObj.drawString(LangUtils.localize("gui.dispersers") + ": " + tileEntity.structure.clientDispersers + (dispersersLimiting ? limiting : ""), 14, 49, 0x404040);
|
||||
fontRendererObj.drawString(LangUtils.localize("gui.vents") + ": " + tileEntity.structure.vents + (ventsLimiting ? limiting : ""), 8, 58, 0x404040);
|
||||
|
||||
boolean bladesLimiting = tileEntity.structure.coils*4 > tileEntity.structure.blades;
|
||||
boolean coilsLimiting = tileEntity.structure.coils*4 < tileEntity.structure.blades;
|
||||
|
||||
fontRendererObj.drawString(LangUtils.localize("gui.generation"), 8, 72, 0x797979);
|
||||
fontRendererObj.drawString(LangUtils.localize("gui.blades") + ": " + tileEntity.structure.blades + (bladesLimiting ? limiting : ""), 14, 81, 0x404040);
|
||||
fontRendererObj.drawString(LangUtils.localize("gui.coils") + ": " + tileEntity.structure.coils + (bladesLimiting ? limiting : ""), 8, 90, 0x404040);
|
||||
|
||||
double energyMultiplier = TileEntityTurbineCasing.ENERGY_PER_STEAM*Math.min(tileEntity.structure.blades, tileEntity.structure.coils*TileEntityTurbineCasing.BLADE_TO_COIL_RATIO);
|
||||
double rate = tileEntity.structure.lowerVolume*(tileEntity.structure.clientDispersers*TileEntityTurbineCasing.DISPERSER_GAS_FLOW);
|
||||
rate = Math.min(rate, tileEntity.structure.vents*TileEntityTurbineCasing.VENT_GAS_FLOW);
|
||||
|
||||
fontRendererObj.drawString(LangUtils.localize("gui.maxProduction") + ": " + MekanismUtils.getEnergyDisplay(rate*energyMultiplier), 8, 104, 0x404040);
|
||||
|
||||
super.drawGuiContainerForegroundLayer(mouseX, mouseY);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void drawGuiContainerBackgroundLayer(float partialTick, int mouseX, int mouseY)
|
||||
{
|
||||
mc.renderEngine.bindTexture(MekanismUtils.getResource(ResourceType.GUI, "GuiNull.png"));
|
||||
GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F);
|
||||
int guiWidth = (width - xSize) / 2;
|
||||
int guiHeight = (height - ySize) / 2;
|
||||
drawTexturedModalRect(guiWidth, guiHeight, 0, 0, xSize, ySize);
|
||||
|
||||
super.drawGuiContainerBackgroundLayer(partialTick, mouseX, mouseY);
|
||||
}
|
||||
}
|
|
@ -1,4 +1,4 @@
|
|||
package mekanism.generators.client.gui;
|
||||
package mekanism.generators.client.gui.element;
|
||||
|
||||
import mekanism.api.Coord4D;
|
||||
import mekanism.client.gui.IGuiWrapper;
|
|
@ -1,4 +1,4 @@
|
|||
package mekanism.generators.client.gui;
|
||||
package mekanism.generators.client.gui.element;
|
||||
|
||||
import mekanism.api.Coord4D;
|
||||
import mekanism.client.gui.IGuiWrapper;
|
|
@ -1,4 +1,4 @@
|
|||
package mekanism.generators.client.gui;
|
||||
package mekanism.generators.client.gui.element;
|
||||
|
||||
import mekanism.api.Coord4D;
|
||||
import mekanism.client.gui.IGuiWrapper;
|
|
@ -0,0 +1,118 @@
|
|||
package mekanism.generators.client.gui.element;
|
||||
|
||||
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 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;
|
||||
|
||||
@SideOnly(Side.CLIENT)
|
||||
public class GuiTurbineTab extends GuiElement
|
||||
{
|
||||
private TileEntity tileEntity;
|
||||
private TurbineTab tabType;
|
||||
private int yPos;
|
||||
|
||||
public GuiTurbineTab(IGuiWrapper gui, TileEntity tile, TurbineTab type, int y, ResourceLocation def)
|
||||
{
|
||||
super(type.getResource(), gui, def);
|
||||
|
||||
tileEntity = tile;
|
||||
tabType = type;
|
||||
yPos = y;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Rectangle4i getBounds(int guiWidth, int guiHeight)
|
||||
{
|
||||
return new Rectangle4i(guiWidth - 26, guiHeight + yPos, 26, 26);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void renderBackground(int xAxis, int yAxis, int guiWidth, int guiHeight)
|
||||
{
|
||||
mc.renderEngine.bindTexture(RESOURCE);
|
||||
|
||||
guiObj.drawTexturedRect(guiWidth - 26, guiHeight + yPos, 0, 0, 26, 26);
|
||||
|
||||
if(xAxis >= -21 && xAxis <= -3 && yAxis >= yPos+4 && yAxis <= yPos+22)
|
||||
{
|
||||
guiObj.drawTexturedRect(guiWidth - 21, guiHeight + yPos+4, 26, 0, 18, 18);
|
||||
}
|
||||
else {
|
||||
guiObj.drawTexturedRect(guiWidth - 21, guiHeight + yPos+4, 26, 18, 18, 18);
|
||||
}
|
||||
|
||||
mc.renderEngine.bindTexture(defaultLocation);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void renderForeground(int xAxis, int yAxis)
|
||||
{
|
||||
mc.renderEngine.bindTexture(RESOURCE);
|
||||
|
||||
if(xAxis >= -21 && xAxis <= -3 && yAxis >= yPos+4 && yAxis <= yPos+22)
|
||||
{
|
||||
displayTooltip(tabType.getDesc(), xAxis, yAxis);
|
||||
}
|
||||
|
||||
mc.renderEngine.bindTexture(defaultLocation);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void preMouseClicked(int xAxis, int yAxis, int button) {}
|
||||
|
||||
@Override
|
||||
public void mouseClicked(int xAxis, int yAxis, int button)
|
||||
{
|
||||
if(button == 0)
|
||||
{
|
||||
if(xAxis >= -21 && xAxis <= -3 && yAxis >= yPos+4 && yAxis <= yPos+22)
|
||||
{
|
||||
tabType.openGui(tileEntity);
|
||||
SoundHandler.playSound("gui.button.press");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public static enum TurbineTab
|
||||
{
|
||||
MAIN("GuiGasesTab.png", 6, "gui.main"),
|
||||
STAT("GuiStatsTab.png", 7, "gui.stats");
|
||||
|
||||
private String path;
|
||||
private int guiId;
|
||||
private String desc;
|
||||
|
||||
private TurbineTab(String s, int id, String s1)
|
||||
{
|
||||
path = s;
|
||||
guiId = id;
|
||||
desc = s1;
|
||||
}
|
||||
|
||||
public ResourceLocation getResource()
|
||||
{
|
||||
return MekanismUtils.getResource(ResourceType.GUI_ELEMENT, path);
|
||||
}
|
||||
|
||||
public void openGui(TileEntity tile)
|
||||
{
|
||||
Mekanism.packetHandler.sendToServer(new SimpleGuiMessage(Coord4D.get(tile), 1, guiId));
|
||||
}
|
||||
|
||||
public String getDesc()
|
||||
{
|
||||
return LangUtils.localize(desc);
|
||||
}
|
||||
}
|
||||
}
|
|
@ -2,7 +2,7 @@ package mekanism.generators.common;
|
|||
|
||||
import mekanism.api.MekanismConfig.generators;
|
||||
import mekanism.common.Mekanism;
|
||||
import mekanism.common.inventory.container.ContainerFilter;
|
||||
import mekanism.common.base.IGuiProvider;
|
||||
import mekanism.common.inventory.container.ContainerNull;
|
||||
import mekanism.common.tile.TileEntityContainerBlock;
|
||||
import mekanism.generators.common.inventory.container.ContainerBioGenerator;
|
||||
|
@ -44,7 +44,7 @@ import cpw.mods.fml.common.registry.GameRegistry;
|
|||
* @author AidanBrady
|
||||
*
|
||||
*/
|
||||
public class GeneratorsCommonProxy
|
||||
public class GeneratorsCommonProxy implements IGuiProvider
|
||||
{
|
||||
public static int GENERATOR_RENDER_ID = RenderingRegistry.getNextAvailableRenderId();
|
||||
|
||||
|
@ -132,31 +132,13 @@ public class GeneratorsCommonProxy
|
|||
generators.windGenerationMaxY = Math.max(minY + 1, maxY);
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the actual interface for a GUI. Client-only.
|
||||
* @param ID - gui ID
|
||||
* @param player - player that opened the GUI
|
||||
* @param world - world the GUI was opened in
|
||||
* @param x - gui's x position
|
||||
* @param y - gui's y position
|
||||
* @param z - gui's z position
|
||||
* @return the GuiScreen of the GUI
|
||||
*/
|
||||
@Override
|
||||
public Object getClientGui(int ID, EntityPlayer player, World world, int x, int y, int z)
|
||||
{
|
||||
return null;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the container for a GUI. Common.
|
||||
* @param ID - gui ID
|
||||
* @param player - player that opened the GUI
|
||||
* @param world - world the GUI was opened in
|
||||
* @param x - gui's x position
|
||||
* @param y - gui's y position
|
||||
* @param z - gui's z position
|
||||
* @return the Container of the GUI
|
||||
*/
|
||||
@Override
|
||||
public Container getServerGui(int ID, EntityPlayer player, World world, int x, int y, int z)
|
||||
{
|
||||
TileEntity tileEntity = world.getTileEntity(x, y, z);
|
||||
|
@ -174,7 +156,8 @@ public class GeneratorsCommonProxy
|
|||
case 5:
|
||||
return new ContainerWindGenerator(player.inventory, (TileEntityWindGenerator)tileEntity);
|
||||
case 6:
|
||||
return new ContainerFilter(player.inventory, (TileEntityTurbineCasing)tileEntity);
|
||||
case 7:
|
||||
return new ContainerNull(player, (TileEntityTurbineCasing)tileEntity);
|
||||
case 10:
|
||||
return new ContainerReactorController(player.inventory, (TileEntityReactorController)tileEntity);
|
||||
case 11:
|
||||
|
|
|
@ -17,6 +17,7 @@ import mekanism.common.Tier.BaseTier;
|
|||
import mekanism.common.Version;
|
||||
import mekanism.common.base.IModule;
|
||||
import mekanism.common.multiblock.MultiblockManager;
|
||||
import mekanism.common.network.PacketSimpleGui;
|
||||
import mekanism.common.recipe.RecipeHandler;
|
||||
import mekanism.common.recipe.ShapedMekanismRecipe;
|
||||
import mekanism.common.util.MekanismUtils;
|
||||
|
@ -73,6 +74,9 @@ public class MekanismGenerators implements IModule
|
|||
|
||||
packetHandler.initialize();
|
||||
|
||||
//Register this module's GUI handler in the simple packet protocol
|
||||
PacketSimpleGui.handlers.add(1, proxy);
|
||||
|
||||
//Set up the GUI handler
|
||||
NetworkRegistry.INSTANCE.registerGuiHandler(this, new GeneratorsGuiHandler());
|
||||
FMLCommonHandler.instance().bus().register(this);
|
||||
|
|
|
@ -1,5 +1,6 @@
|
|||
package mekanism.generators.common.content.turbine;
|
||||
|
||||
import mekanism.api.Coord4D;
|
||||
import mekanism.common.multiblock.SynchronizedData;
|
||||
import net.minecraftforge.fluids.FluidStack;
|
||||
|
||||
|
@ -17,6 +18,18 @@ public class SynchronizedTurbineData extends SynchronizedData<SynchronizedTurbin
|
|||
|
||||
public int lowerVolume;
|
||||
|
||||
public Coord4D complex;
|
||||
|
||||
public int lastSteamInput;
|
||||
|
||||
public int clientDispersers;
|
||||
public int clientFlow;
|
||||
|
||||
public int getDispersers()
|
||||
{
|
||||
return (volLength-2)*(volWidth-2) - 1;
|
||||
}
|
||||
|
||||
public int getFluidCapacity()
|
||||
{
|
||||
return lowerVolume*TurbineUpdateProtocol.FLUID_PER_TANK;
|
||||
|
|
|
@ -209,6 +209,7 @@ public class TurbineUpdateProtocol extends UpdateProtocol<SynchronizedTurbineDat
|
|||
structure.lowerVolume = structure.volLength*structure.volWidth*turbineHeight;
|
||||
|
||||
((TileEntityRotationalComplex)complex.getTileEntity(pointer.getWorldObj())).setMultiblock(structure.inventoryID);
|
||||
structure.complex = complex;
|
||||
|
||||
return true;
|
||||
}
|
||||
|
|
|
@ -19,11 +19,17 @@ import mekanism.generators.common.content.turbine.SynchronizedTurbineData;
|
|||
import mekanism.generators.common.content.turbine.TurbineCache;
|
||||
import mekanism.generators.common.content.turbine.TurbineUpdateProtocol;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.tileentity.TileEntity;
|
||||
import net.minecraftforge.fluids.FluidRegistry;
|
||||
import net.minecraftforge.fluids.FluidStack;
|
||||
|
||||
public class TileEntityTurbineCasing extends TileEntityMultiblock<SynchronizedTurbineData> implements IStrictEnergyStorage
|
||||
{
|
||||
public static final double DISPERSER_GAS_FLOW = 640;
|
||||
public static final double VENT_GAS_FLOW = 16000;
|
||||
public static final double ENERGY_PER_STEAM = 10;
|
||||
public static final double BLADE_TO_COIL_RATIO = 4;
|
||||
|
||||
public float prevScale;
|
||||
|
||||
public TileEntityTurbineCasing()
|
||||
|
@ -58,6 +64,8 @@ public class TileEntityTurbineCasing extends TileEntityMultiblock<SynchronizedTu
|
|||
{
|
||||
if(structure != null)
|
||||
{
|
||||
structure.lastSteamInput = 0;
|
||||
|
||||
if(structure.fluidStored != null && structure.fluidStored.amount <= 0)
|
||||
{
|
||||
structure.fluidStored = null;
|
||||
|
@ -66,6 +74,41 @@ public class TileEntityTurbineCasing extends TileEntityMultiblock<SynchronizedTu
|
|||
|
||||
if(isRendering)
|
||||
{
|
||||
int stored = structure.fluidStored != null ? structure.fluidStored.amount : 0;
|
||||
double proportion = (double)stored/(double)structure.getFluidCapacity();
|
||||
double flowRate = 0;
|
||||
|
||||
if(stored > 0 && structure.electricityStored < structure.getEnergyCapacity())
|
||||
{
|
||||
double energyMultiplier = ENERGY_PER_STEAM*Math.min(structure.blades, structure.coils*BLADE_TO_COIL_RATIO);
|
||||
double rate = structure.lowerVolume*(structure.getDispersers()*DISPERSER_GAS_FLOW)*proportion;
|
||||
double origRate = rate;
|
||||
|
||||
rate = Math.min(Math.min(stored, rate), structure.vents*VENT_GAS_FLOW);
|
||||
rate = Math.min(rate, (getMaxEnergy()-getEnergy())/energyMultiplier);
|
||||
|
||||
flowRate = proportion*(rate/origRate);
|
||||
setEnergy(getEnergy()+((int)rate)*energyMultiplier);
|
||||
|
||||
structure.fluidStored.amount -= rate;
|
||||
structure.clientFlow = (int)rate;
|
||||
|
||||
if(structure.fluidStored.amount == 0)
|
||||
{
|
||||
structure.fluidStored = null;
|
||||
}
|
||||
}
|
||||
else {
|
||||
structure.clientFlow = 0;
|
||||
}
|
||||
|
||||
TileEntity tile = structure.complex.getTileEntity(worldObj);
|
||||
|
||||
if(tile instanceof TileEntityRotationalComplex)
|
||||
{
|
||||
((TileEntityRotationalComplex)tile).setRotation((float)flowRate);
|
||||
}
|
||||
|
||||
if(structure.needsRenderUpdate())
|
||||
{
|
||||
sendPacketToRenderer();
|
||||
|
@ -83,7 +126,7 @@ public class TileEntityTurbineCasing extends TileEntityMultiblock<SynchronizedTu
|
|||
if(!player.isSneaking() && structure != null)
|
||||
{
|
||||
Mekanism.packetHandler.sendToReceivers(new TileEntityMessage(Coord4D.get(this), getNetworkedData(new ArrayList())), new Range4D(Coord4D.get(this)));
|
||||
player.openGui(Mekanism.instance, 6, worldObj, xCoord, yCoord, zCoord);
|
||||
player.openGui(MekanismGenerators.instance, 6, worldObj, xCoord, yCoord, zCoord);
|
||||
|
||||
return true;
|
||||
}
|
||||
|
@ -131,7 +174,14 @@ public class TileEntityTurbineCasing extends TileEntityMultiblock<SynchronizedTu
|
|||
if(structure != null)
|
||||
{
|
||||
data.add(structure.volume);
|
||||
data.add(structure.lowerVolume);
|
||||
data.add(structure.vents);
|
||||
data.add(structure.blades);
|
||||
data.add(structure.coils);
|
||||
data.add(structure.getDispersers());
|
||||
data.add(structure.electricityStored);
|
||||
data.add(structure.clientFlow);
|
||||
data.add(structure.lastSteamInput);
|
||||
|
||||
if(structure.fluidStored != null)
|
||||
{
|
||||
|
@ -155,7 +205,14 @@ public class TileEntityTurbineCasing extends TileEntityMultiblock<SynchronizedTu
|
|||
if(clientHasStructure)
|
||||
{
|
||||
structure.volume = dataStream.readInt();
|
||||
structure.lowerVolume = dataStream.readInt();
|
||||
structure.vents = dataStream.readInt();
|
||||
structure.blades = dataStream.readInt();
|
||||
structure.coils = dataStream.readInt();
|
||||
structure.clientDispersers = dataStream.readInt();
|
||||
structure.electricityStored = dataStream.readDouble();
|
||||
structure.clientFlow = dataStream.readInt();
|
||||
structure.lastSteamInput = dataStream.readInt();
|
||||
|
||||
if(dataStream.readInt() == 1)
|
||||
{
|
||||
|
|
|
@ -359,7 +359,14 @@ public class TileEntityTurbineValve extends TileEntityTurbineCasing implements I
|
|||
@Override
|
||||
public int fill(ForgeDirection from, FluidStack resource, boolean doFill)
|
||||
{
|
||||
return fluidTank.fill(resource, doFill);
|
||||
int filled = fluidTank.fill(resource, doFill);
|
||||
|
||||
if(structure != null && doFill)
|
||||
{
|
||||
structure.lastSteamInput += filled;
|
||||
}
|
||||
|
||||
return filled;
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
BIN
src/main/resources/assets/mekanism/gui/GuiIndustrialTurbine.png
Normal file
BIN
src/main/resources/assets/mekanism/gui/GuiIndustrialTurbine.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 3.6 KiB |
Before Width: | Height: | Size: 2.8 KiB After Width: | Height: | Size: 2.8 KiB |
|
@ -440,6 +440,7 @@ gui.formed=Formed
|
|||
gui.incomplete=Incomplete
|
||||
gui.inductionMatrix=Induction Matrix
|
||||
gui.matrixStats=Matrix Statistics
|
||||
gui.turbineStats=Turbine Statistics
|
||||
gui.main=Main
|
||||
gui.outputting=Outputting
|
||||
gui.receiving=Receiving
|
||||
|
@ -483,6 +484,18 @@ gui.redstoneOutputMode=Redstone mode
|
|||
gui.entityDetection=Entity Detection
|
||||
gui.moveUp=Move Up
|
||||
gui.moveDown=Move Down
|
||||
gui.flowRate=Flow rate
|
||||
gui.maxFlow=Max flow
|
||||
gui.tankVolume=Tank volume
|
||||
gui.steamFlow=Steam Flow
|
||||
gui.production=Production
|
||||
gui.blades=Blades
|
||||
gui.coils=Coils
|
||||
gui.dispersers=Dispersers
|
||||
gui.vents=Vents
|
||||
gui.maxProduction=Max Production
|
||||
gui.limiting=Limiting
|
||||
gui.steamInput=Steam Input
|
||||
|
||||
gui.reactor.injectionRate=Injection Rate
|
||||
|
||||
|
|
Loading…
Reference in a new issue