Final changes in upgrade GUI modularization, will work on factory recipe type GUI modularization next
This commit is contained in:
parent
08fda4cdd5
commit
13a47bbc96
15 changed files with 227 additions and 330 deletions
|
@ -2,7 +2,6 @@ package mekanism.client;
|
|||
|
||||
import mekanism.common.ContainerAdvancedElectricMachine;
|
||||
import mekanism.common.TileEntityAdvancedElectricMachine;
|
||||
import net.minecraft.client.gui.inventory.GuiContainer;
|
||||
import net.minecraft.entity.player.InventoryPlayer;
|
||||
|
||||
import org.lwjgl.opengl.GL11;
|
||||
|
@ -13,25 +12,24 @@ import cpw.mods.fml.relauncher.Side;
|
|||
import cpw.mods.fml.relauncher.SideOnly;
|
||||
|
||||
@SideOnly(Side.CLIENT)
|
||||
public class GuiAdvancedElectricMachine extends GuiContainer
|
||||
public class GuiAdvancedElectricMachine extends GuiMekanism
|
||||
{
|
||||
public TileEntityAdvancedElectricMachine tileEntity;
|
||||
|
||||
public GuiRedstoneControl redstoneControl;
|
||||
public GuiUpgradeManagement upgradeManagement;
|
||||
|
||||
public GuiAdvancedElectricMachine(InventoryPlayer inventory, TileEntityAdvancedElectricMachine tentity)
|
||||
{
|
||||
super(new ContainerAdvancedElectricMachine(inventory, tentity));
|
||||
tileEntity = tentity;
|
||||
|
||||
redstoneControl = new GuiRedstoneControl(this, tileEntity, tileEntity.guiLocation);
|
||||
upgradeManagement = new GuiUpgradeManagement(this, tileEntity, tileEntity.guiLocation);
|
||||
guiElements.add(new GuiRedstoneControl(this, tileEntity, tileEntity.guiLocation));
|
||||
guiElements.add(new GuiUpgradeManagement(this, tileEntity, tileEntity.guiLocation));
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void drawGuiContainerForegroundLayer(int mouseX, int mouseY)
|
||||
{
|
||||
super.drawGuiContainerForegroundLayer(mouseX, mouseY);
|
||||
|
||||
int xAxis = (mouseX - (width - xSize) / 2);
|
||||
int yAxis = (mouseY - (height - ySize) / 2);
|
||||
|
||||
|
@ -42,22 +40,21 @@ public class GuiAdvancedElectricMachine extends GuiContainer
|
|||
{
|
||||
drawCreativeTabHoveringText(ElectricityDisplay.getDisplayShort(tileEntity.getEnergyStored(), ElectricUnit.JOULES), xAxis, yAxis);
|
||||
}
|
||||
|
||||
redstoneControl.renderForeground(xAxis, yAxis);
|
||||
upgradeManagement.renderForeground(xAxis, yAxis);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void drawGuiContainerBackgroundLayer(float par1, int mouseX, int mouseY)
|
||||
protected void drawGuiContainerBackgroundLayer(float partialTick, int mouseX, int mouseY)
|
||||
{
|
||||
super.drawGuiContainerBackgroundLayer(partialTick, mouseX, mouseY);
|
||||
|
||||
mc.renderEngine.func_110577_a(tileEntity.guiLocation);
|
||||
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);
|
||||
|
||||
int xAxis = (mouseX - (width - xSize) / 2);
|
||||
int yAxis = (mouseY - (height - ySize) / 2);
|
||||
int xAxis = mouseX - guiWidth;
|
||||
int yAxis = mouseY - guiHeight;
|
||||
|
||||
int displayInt;
|
||||
|
||||
|
@ -69,25 +66,5 @@ public class GuiAdvancedElectricMachine extends GuiContainer
|
|||
|
||||
displayInt = tileEntity.getScaledProgress(24);
|
||||
drawTexturedModalRect(guiWidth + 79, guiHeight + 39, 176, 0, displayInt + 1, 7);
|
||||
|
||||
redstoneControl.renderBackground(xAxis, yAxis, guiWidth, guiHeight);
|
||||
upgradeManagement.renderBackground(xAxis, yAxis, guiWidth, guiHeight);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void mouseClicked(int mouseX, int mouseY, int button)
|
||||
{
|
||||
xSize += 26;
|
||||
super.mouseClicked(mouseX, mouseY, button);
|
||||
xSize -= 26;
|
||||
|
||||
if(button == 0)
|
||||
{
|
||||
int xAxis = (mouseX - (width - xSize) / 2);
|
||||
int yAxis = (mouseY - (height - ySize) / 2);
|
||||
|
||||
redstoneControl.mouseClicked(xAxis, yAxis);
|
||||
upgradeManagement.mouseClicked(xAxis, yAxis);
|
||||
}
|
||||
}
|
||||
}
|
|
@ -1,12 +1,7 @@
|
|||
package mekanism.client;
|
||||
|
||||
import mekanism.api.Object3D;
|
||||
import mekanism.common.ContainerElectricMachine;
|
||||
import mekanism.common.PacketHandler;
|
||||
import mekanism.common.TileEntityElectricMachine;
|
||||
import mekanism.common.PacketHandler.Transmission;
|
||||
import mekanism.common.network.PacketRemoveUpgrade;
|
||||
import net.minecraft.client.gui.inventory.GuiContainer;
|
||||
import net.minecraft.entity.player.InventoryPlayer;
|
||||
|
||||
import org.lwjgl.opengl.GL11;
|
||||
|
@ -17,25 +12,24 @@ import cpw.mods.fml.relauncher.Side;
|
|||
import cpw.mods.fml.relauncher.SideOnly;
|
||||
|
||||
@SideOnly(Side.CLIENT)
|
||||
public class GuiElectricMachine extends GuiContainer
|
||||
public class GuiElectricMachine extends GuiMekanism
|
||||
{
|
||||
public TileEntityElectricMachine tileEntity;
|
||||
|
||||
public GuiRedstoneControl redstoneControl;
|
||||
public GuiUpgradeManagement upgradeManagement;
|
||||
|
||||
public GuiElectricMachine(InventoryPlayer inventory, TileEntityElectricMachine tentity)
|
||||
{
|
||||
super(new ContainerElectricMachine(inventory, tentity));
|
||||
tileEntity = tentity;
|
||||
|
||||
redstoneControl = new GuiRedstoneControl(this, tileEntity, tileEntity.guiLocation);
|
||||
upgradeManagement = new GuiUpgradeManagement(this, tileEntity, tileEntity.guiLocation);
|
||||
guiElements.add(new GuiRedstoneControl(this, tileEntity, tileEntity.guiLocation));
|
||||
guiElements.add(new GuiUpgradeManagement(this, tileEntity, tileEntity.guiLocation));
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void drawGuiContainerForegroundLayer(int mouseX, int mouseY)
|
||||
{
|
||||
super.drawGuiContainerForegroundLayer(mouseX, mouseY);
|
||||
|
||||
int xAxis = (mouseX - (width - xSize) / 2);
|
||||
int yAxis = (mouseY - (height - ySize) / 2);
|
||||
|
||||
|
@ -46,22 +40,21 @@ public class GuiElectricMachine extends GuiContainer
|
|||
{
|
||||
drawCreativeTabHoveringText(ElectricityDisplay.getDisplayShort(tileEntity.getEnergyStored(), ElectricUnit.JOULES), xAxis, yAxis);
|
||||
}
|
||||
|
||||
redstoneControl.renderForeground(xAxis, yAxis);
|
||||
upgradeManagement.renderForeground(xAxis, yAxis);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void drawGuiContainerBackgroundLayer(float par1, int mouseX, int mouseY)
|
||||
protected void drawGuiContainerBackgroundLayer(float partialTick, int mouseX, int mouseY)
|
||||
{
|
||||
super.drawGuiContainerBackgroundLayer(partialTick, mouseX, mouseY);
|
||||
|
||||
mc.renderEngine.func_110577_a(tileEntity.guiLocation);
|
||||
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);
|
||||
|
||||
int xAxis = (mouseX - (width - xSize) / 2);
|
||||
int yAxis = (mouseY - (height - ySize) / 2);
|
||||
int xAxis = mouseX - guiWidth;
|
||||
int yAxis = mouseY - guiHeight;
|
||||
|
||||
int displayInt;
|
||||
|
||||
|
@ -70,25 +63,5 @@ public class GuiElectricMachine extends GuiContainer
|
|||
|
||||
displayInt = tileEntity.getScaledProgress(24);
|
||||
drawTexturedModalRect(guiWidth + 79, guiHeight + 39, 176, 0, displayInt + 1, 7);
|
||||
|
||||
redstoneControl.renderBackground(xAxis, yAxis, guiWidth, guiHeight);
|
||||
upgradeManagement.renderBackground(xAxis, yAxis, guiWidth, guiHeight);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void mouseClicked(int mouseX, int mouseY, int button)
|
||||
{
|
||||
xSize += 26;
|
||||
super.mouseClicked(mouseX, mouseY, button);
|
||||
xSize -= 26;
|
||||
|
||||
if(button == 0)
|
||||
{
|
||||
int xAxis = (mouseX - (width - xSize) / 2);
|
||||
int yAxis = (mouseY - (height - ySize) / 2);
|
||||
|
||||
redstoneControl.mouseClicked(xAxis, yAxis);
|
||||
upgradeManagement.mouseClicked(xAxis, yAxis);
|
||||
}
|
||||
}
|
||||
}
|
|
@ -72,5 +72,7 @@ public abstract class GuiElement
|
|||
|
||||
public abstract void renderForeground(int xAxis, int yAxis);
|
||||
|
||||
public abstract void mouseClicked(int xAxis, int yAxis);
|
||||
public abstract void preMouseClicked(int xAxis, int yAxis, int button);
|
||||
|
||||
public abstract void mouseClicked(int xAxis, int yAxis, int button);
|
||||
}
|
||||
|
|
|
@ -16,22 +16,22 @@ import cpw.mods.fml.relauncher.Side;
|
|||
import cpw.mods.fml.relauncher.SideOnly;
|
||||
|
||||
@SideOnly(Side.CLIENT)
|
||||
public class GuiEnergyCube extends GuiContainer
|
||||
public class GuiEnergyCube extends GuiMekanism
|
||||
{
|
||||
public TileEntityEnergyCube tileEntity;
|
||||
|
||||
public GuiRedstoneControl redstoneControl;
|
||||
|
||||
public GuiEnergyCube(InventoryPlayer inventory, TileEntityEnergyCube tentity)
|
||||
{
|
||||
super(new ContainerEnergyCube(inventory, tentity));
|
||||
tileEntity = tentity;
|
||||
redstoneControl = new GuiRedstoneControl(this, tileEntity, MekanismUtils.getResource(ResourceType.GUI, "GuiEnergyCube.png"));
|
||||
guiElements.add(new GuiRedstoneControl(this, tileEntity, MekanismUtils.getResource(ResourceType.GUI, "GuiEnergyCube.png")));
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void drawGuiContainerForegroundLayer(int mouseX, int mouseY)
|
||||
{
|
||||
super.drawGuiContainerForegroundLayer(mouseX, mouseY);
|
||||
|
||||
int xAxis = (mouseX - (width - xSize) / 2);
|
||||
int yAxis = (mouseY - (height - ySize) / 2);
|
||||
|
||||
|
@ -42,39 +42,23 @@ public class GuiEnergyCube extends GuiContainer
|
|||
fontRenderer.drawString(capacityInfo, 45, 40, 0x00CD00);
|
||||
fontRenderer.drawString(outputInfo, 45, 49, 0x00CD00);
|
||||
fontRenderer.drawString(StatCollector.translateToLocal("container.inventory"), 8, ySize - 96 + 2, 0x404040);
|
||||
|
||||
redstoneControl.renderForeground(xAxis, yAxis);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void drawGuiContainerBackgroundLayer(float par1, int mouseX, int mouseY)
|
||||
protected void drawGuiContainerBackgroundLayer(float partialTick, int mouseX, int mouseY)
|
||||
{
|
||||
super.drawGuiContainerBackgroundLayer(partialTick, mouseX, mouseY);
|
||||
|
||||
mc.renderEngine.func_110577_a(MekanismUtils.getResource(ResourceType.GUI, "GuiEnergyCube.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);
|
||||
|
||||
int xAxis = (mouseX - (width - xSize) / 2);
|
||||
int yAxis = (mouseY - (height - ySize) / 2);
|
||||
int xAxis = mouseX - guiWidth;
|
||||
int yAxis = mouseY - guiHeight;
|
||||
|
||||
int scale = (int)((tileEntity.electricityStored / tileEntity.tier.MAX_ELECTRICITY) * 72);
|
||||
drawTexturedModalRect(guiWidth + 65, guiHeight + 17, 176, 0, scale, 10);
|
||||
|
||||
redstoneControl.renderBackground(xAxis, yAxis, guiWidth, guiHeight);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void mouseClicked(int mouseX, int mouseY, int button)
|
||||
{
|
||||
super.mouseClicked(mouseX, mouseY, button);
|
||||
|
||||
if(button == 0)
|
||||
{
|
||||
int xAxis = (mouseX - (width - xSize) / 2);
|
||||
int yAxis = (mouseY - (height - ySize) / 2);
|
||||
|
||||
redstoneControl.mouseClicked(xAxis, yAxis);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,14 +1,9 @@
|
|||
package mekanism.client;
|
||||
|
||||
import mekanism.api.Object3D;
|
||||
import mekanism.common.ContainerFactory;
|
||||
import mekanism.common.IFactory.RecipeType;
|
||||
import mekanism.common.PacketHandler;
|
||||
import mekanism.common.PacketHandler.Transmission;
|
||||
import mekanism.common.Tier.FactoryTier;
|
||||
import mekanism.common.TileEntityFactory;
|
||||
import mekanism.common.network.PacketRemoveUpgrade;
|
||||
import net.minecraft.client.gui.inventory.GuiContainer;
|
||||
import net.minecraft.entity.player.InventoryPlayer;
|
||||
|
||||
import org.lwjgl.opengl.GL11;
|
||||
|
@ -19,12 +14,9 @@ import cpw.mods.fml.relauncher.Side;
|
|||
import cpw.mods.fml.relauncher.SideOnly;
|
||||
|
||||
@SideOnly(Side.CLIENT)
|
||||
public class GuiFactory extends GuiContainer
|
||||
public class GuiFactory extends GuiMekanism
|
||||
{
|
||||
public TileEntityFactory tileEntity;
|
||||
|
||||
public GuiRedstoneControl redstoneControl;
|
||||
public GuiUpgradeManagement upgradeManagement;
|
||||
|
||||
public GuiFactory(InventoryPlayer inventory, TileEntityFactory tentity)
|
||||
{
|
||||
|
@ -32,13 +24,15 @@ public class GuiFactory extends GuiContainer
|
|||
xSize+=26;
|
||||
tileEntity = tentity;
|
||||
|
||||
redstoneControl = new GuiRedstoneControl(this, tileEntity, tileEntity.tier.guiLocation);
|
||||
upgradeManagement = new GuiUpgradeManagement(this, tileEntity, tileEntity.tier.guiLocation);
|
||||
guiElements.add(new GuiRedstoneControl(this, tileEntity, tileEntity.tier.guiLocation));
|
||||
guiElements.add(new GuiUpgradeManagement(this, tileEntity, tileEntity.tier.guiLocation));
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void drawGuiContainerForegroundLayer(int mouseX, int mouseY)
|
||||
{
|
||||
super.drawGuiContainerForegroundLayer(mouseX, mouseY);
|
||||
|
||||
int xAxis = (mouseX - (width - xSize) / 2);
|
||||
int yAxis = (mouseY - (height - ySize) / 2);
|
||||
|
||||
|
@ -50,22 +44,21 @@ public class GuiFactory extends GuiContainer
|
|||
{
|
||||
drawCreativeTabHoveringText(ElectricityDisplay.getDisplayShort((float)tileEntity.electricityStored, ElectricUnit.JOULES), xAxis, yAxis);
|
||||
}
|
||||
|
||||
redstoneControl.renderForeground(xAxis, yAxis);
|
||||
upgradeManagement.renderForeground(xAxis, yAxis);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void drawGuiContainerBackgroundLayer(float par1, int mouseX, int mouseY)
|
||||
protected void drawGuiContainerBackgroundLayer(float partialTick, int mouseX, int mouseY)
|
||||
{
|
||||
super.drawGuiContainerBackgroundLayer(partialTick, mouseX, mouseY);
|
||||
|
||||
mc.renderEngine.func_110577_a(tileEntity.tier.guiLocation);
|
||||
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);
|
||||
|
||||
int xAxis = (mouseX - (width - xSize) / 2);
|
||||
int yAxis = (mouseY - (height - ySize) / 2);
|
||||
int xAxis = mouseX - guiWidth;
|
||||
int yAxis = mouseY - guiHeight;
|
||||
|
||||
int displayInt;
|
||||
|
||||
|
@ -105,23 +98,5 @@ public class GuiFactory extends GuiContainer
|
|||
drawTexturedModalRect(guiWidth + xPos, guiHeight + 33, 176 + 26, 52, 8, displayInt);
|
||||
}
|
||||
}
|
||||
|
||||
redstoneControl.renderBackground(xAxis, yAxis, guiWidth, guiHeight);
|
||||
upgradeManagement.renderBackground(xAxis, yAxis, guiWidth, guiHeight);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void mouseClicked(int mouseX, int mouseY, int button)
|
||||
{
|
||||
super.mouseClicked(mouseX, mouseY, button);
|
||||
|
||||
if(button == 0)
|
||||
{
|
||||
int xAxis = (mouseX - (width - xSize) / 2);
|
||||
int yAxis = (mouseY - (height - ySize) / 2);
|
||||
|
||||
redstoneControl.mouseClicked(xAxis, yAxis);
|
||||
upgradeManagement.mouseClicked(xAxis, yAxis);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -2,9 +2,8 @@ package mekanism.client;
|
|||
|
||||
import mekanism.common.ContainerGasTank;
|
||||
import mekanism.common.MekanismUtils;
|
||||
import mekanism.common.TileEntityGasTank;
|
||||
import mekanism.common.MekanismUtils.ResourceType;
|
||||
import net.minecraft.client.gui.inventory.GuiContainer;
|
||||
import mekanism.common.TileEntityGasTank;
|
||||
import net.minecraft.entity.player.InventoryPlayer;
|
||||
import net.minecraft.util.StatCollector;
|
||||
|
||||
|
@ -14,22 +13,22 @@ import cpw.mods.fml.relauncher.Side;
|
|||
import cpw.mods.fml.relauncher.SideOnly;
|
||||
|
||||
@SideOnly(Side.CLIENT)
|
||||
public class GuiGasTank extends GuiContainer
|
||||
public class GuiGasTank extends GuiMekanism
|
||||
{
|
||||
public TileEntityGasTank tileEntity;
|
||||
|
||||
public GuiRedstoneControl redstoneControl;
|
||||
|
||||
public GuiGasTank(InventoryPlayer inventory, TileEntityGasTank tentity)
|
||||
{
|
||||
super(new ContainerGasTank(inventory, tentity));
|
||||
tileEntity = tentity;
|
||||
redstoneControl = new GuiRedstoneControl(this, tileEntity, MekanismUtils.getResource(ResourceType.GUI, "GuiGasTank.png"));
|
||||
guiElements.add(new GuiRedstoneControl(this, tileEntity, MekanismUtils.getResource(ResourceType.GUI, "GuiGasTank.png")));
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void drawGuiContainerForegroundLayer(int mouseX, int mouseY)
|
||||
{
|
||||
super.drawGuiContainerForegroundLayer(mouseX, mouseY);
|
||||
|
||||
int xAxis = (mouseX - (width - xSize) / 2);
|
||||
int yAxis = (mouseY - (height - ySize) / 2);
|
||||
|
||||
|
@ -39,39 +38,23 @@ public class GuiGasTank extends GuiContainer
|
|||
fontRenderer.drawString(capacityInfo, 45, 40, 0x404040);
|
||||
fontRenderer.drawString("Gas: " + tileEntity.gasType.name, 45, 49, 0x404040);
|
||||
fontRenderer.drawString(StatCollector.translateToLocal("container.inventory"), 8, ySize - 96 + 2, 0x404040);
|
||||
|
||||
redstoneControl.renderForeground(xAxis, yAxis);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void drawGuiContainerBackgroundLayer(float par1, int mouseX, int mouseY)
|
||||
{
|
||||
super.drawGuiContainerBackgroundLayer(par1, mouseX, mouseY);
|
||||
|
||||
mc.renderEngine.func_110577_a(MekanismUtils.getResource(ResourceType.GUI, "GuiGasTank.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);
|
||||
|
||||
int xAxis = (mouseX - (width - xSize) / 2);
|
||||
int yAxis = (mouseY - (height - ySize) / 2);
|
||||
int xAxis = mouseX - guiWidth;
|
||||
int yAxis = mouseY - guiHeight;
|
||||
|
||||
int scale = (int)(((double)tileEntity.gasStored / tileEntity.MAX_GAS) * 72);
|
||||
drawTexturedModalRect(guiWidth + 65, guiHeight + 17, 176, 0, scale, 20);
|
||||
|
||||
redstoneControl.renderBackground(xAxis, yAxis, guiWidth, guiHeight);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void mouseClicked(int mouseX, int mouseY, int button)
|
||||
{
|
||||
super.mouseClicked(mouseX, mouseY, button);
|
||||
|
||||
if(button == 0)
|
||||
{
|
||||
int xAxis = (mouseX - (width - xSize) / 2);
|
||||
int yAxis = (mouseY - (height - ySize) / 2);
|
||||
|
||||
redstoneControl.mouseClicked(xAxis, yAxis);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
66
common/mekanism/client/GuiMekanism.java
Normal file
66
common/mekanism/client/GuiMekanism.java
Normal file
|
@ -0,0 +1,66 @@
|
|||
package mekanism.client;
|
||||
|
||||
import java.util.HashSet;
|
||||
import java.util.Set;
|
||||
|
||||
import net.minecraft.client.gui.inventory.GuiContainer;
|
||||
import net.minecraft.entity.player.InventoryPlayer;
|
||||
import net.minecraft.inventory.Container;
|
||||
|
||||
public abstract class GuiMekanism extends GuiContainer
|
||||
{
|
||||
public Set<GuiElement> guiElements = new HashSet<GuiElement>();
|
||||
|
||||
public GuiMekanism(Container container)
|
||||
{
|
||||
super(container);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void drawGuiContainerForegroundLayer(int mouseX, int mouseY)
|
||||
{
|
||||
super.drawGuiContainerForegroundLayer(mouseX, mouseY);
|
||||
|
||||
int xAxis = (mouseX - (width - xSize) / 2);
|
||||
int yAxis = (mouseY - (height - ySize) / 2);
|
||||
|
||||
for(GuiElement element : guiElements)
|
||||
{
|
||||
element.renderForeground(xAxis, yAxis);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void drawGuiContainerBackgroundLayer(float partialTick, int mouseX, int mouseY)
|
||||
{
|
||||
int guiWidth = (width - xSize) / 2;
|
||||
int guiHeight = (height - ySize) / 2;
|
||||
|
||||
int xAxis = mouseX - guiWidth;
|
||||
int yAxis = mouseY - guiHeight;
|
||||
|
||||
for(GuiElement element : guiElements)
|
||||
{
|
||||
element.renderBackground(xAxis, yAxis, guiWidth, guiHeight);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void mouseClicked(int mouseX, int mouseY, int button)
|
||||
{
|
||||
int xAxis = (mouseX - (width - xSize) / 2);
|
||||
int yAxis = (mouseY - (height - ySize) / 2);
|
||||
|
||||
for(GuiElement element : guiElements)
|
||||
{
|
||||
element.preMouseClicked(xAxis, yAxis, button);
|
||||
}
|
||||
|
||||
super.mouseClicked(mouseX, mouseY, button);
|
||||
|
||||
for(GuiElement element : guiElements)
|
||||
{
|
||||
element.mouseClicked(xAxis, yAxis, button);
|
||||
}
|
||||
}
|
||||
}
|
|
@ -21,25 +21,24 @@ import cpw.mods.fml.relauncher.Side;
|
|||
import cpw.mods.fml.relauncher.SideOnly;
|
||||
|
||||
@SideOnly(Side.CLIENT)
|
||||
public class GuiMetallurgicInfuser extends GuiContainer
|
||||
public class GuiMetallurgicInfuser extends GuiMekanism
|
||||
{
|
||||
public TileEntityMetallurgicInfuser tileEntity;
|
||||
|
||||
public GuiRedstoneControl redstoneControl;
|
||||
public GuiUpgradeManagement upgradeManagement;
|
||||
|
||||
public GuiMetallurgicInfuser(InventoryPlayer inventory, TileEntityMetallurgicInfuser tentity)
|
||||
{
|
||||
super(new ContainerMetallurgicInfuser(inventory, tentity));
|
||||
tileEntity = tentity;
|
||||
|
||||
redstoneControl = new GuiRedstoneControl(this, tileEntity, MekanismUtils.getResource(ResourceType.GUI, "GuiMetallurgicInfuser.png"));
|
||||
upgradeManagement = new GuiUpgradeManagement(this, tileEntity, MekanismUtils.getResource(ResourceType.GUI, "GuiMetallurgicInfuser.png"));
|
||||
guiElements.add(new GuiRedstoneControl(this, tileEntity, MekanismUtils.getResource(ResourceType.GUI, "GuiMetallurgicInfuser.png")));
|
||||
guiElements.add(new GuiUpgradeManagement(this, tileEntity, MekanismUtils.getResource(ResourceType.GUI, "GuiMetallurgicInfuser.png")));
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void drawGuiContainerForegroundLayer(int mouseX, int mouseY)
|
||||
{
|
||||
super.drawGuiContainerForegroundLayer(mouseX, mouseY);
|
||||
|
||||
int xAxis = (mouseX - (width - xSize) / 2);
|
||||
int yAxis = (mouseY - (height - ySize) / 2);
|
||||
|
||||
|
@ -50,22 +49,21 @@ public class GuiMetallurgicInfuser extends GuiContainer
|
|||
{
|
||||
drawCreativeTabHoveringText(ElectricityDisplay.getDisplayShort(tileEntity.getEnergyStored(), ElectricUnit.JOULES), xAxis, yAxis);
|
||||
}
|
||||
|
||||
redstoneControl.renderForeground(xAxis, yAxis);
|
||||
upgradeManagement.renderForeground(xAxis, yAxis);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void drawGuiContainerBackgroundLayer(float par1, int mouseX, int mouseY)
|
||||
protected void drawGuiContainerBackgroundLayer(float partialTick, int mouseX, int mouseY)
|
||||
{
|
||||
super.drawGuiContainerBackgroundLayer(partialTick, mouseX, mouseY);
|
||||
|
||||
mc.renderEngine.func_110577_a(MekanismUtils.getResource(ResourceType.GUI, "GuiMetallurgicInfuser.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);
|
||||
|
||||
int xAxis = (mouseX - (width - xSize) / 2);
|
||||
int yAxis = (mouseY - (height - ySize) / 2);
|
||||
int xAxis = mouseX - guiWidth;
|
||||
int yAxis = mouseY - guiHeight;
|
||||
|
||||
int displayInt;
|
||||
|
||||
|
@ -81,26 +79,18 @@ public class GuiMetallurgicInfuser extends GuiContainer
|
|||
mc.renderEngine.func_110577_a(tileEntity.type.texture);
|
||||
drawTexturedModalRect(guiWidth + 7, guiHeight + 17 + 52 - displayInt, tileEntity.type.texX, tileEntity.type.texY + 52 - displayInt, 4, displayInt);
|
||||
}
|
||||
|
||||
redstoneControl.renderBackground(xAxis, yAxis, guiWidth, guiHeight);
|
||||
upgradeManagement.renderBackground(xAxis, yAxis, guiWidth, guiHeight);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void mouseClicked(int x, int y, int button)
|
||||
{
|
||||
xSize += 26;
|
||||
super.mouseClicked(x, y, button);
|
||||
xSize -= 26;
|
||||
|
||||
if(button == 0)
|
||||
{
|
||||
int xAxis = (x - (width - xSize) / 2);
|
||||
int yAxis = (y - (height - ySize) / 2);
|
||||
|
||||
redstoneControl.mouseClicked(xAxis, yAxis);
|
||||
upgradeManagement.mouseClicked(xAxis, yAxis);
|
||||
|
||||
if(xAxis > 148 && xAxis < 168 && yAxis > 73 && yAxis < 82)
|
||||
{
|
||||
ArrayList data = new ArrayList();
|
||||
|
|
|
@ -59,16 +59,22 @@ public class GuiRedstoneControl extends GuiElement
|
|||
}
|
||||
|
||||
@Override
|
||||
public void mouseClicked(int xAxis, int yAxis)
|
||||
public void preMouseClicked(int xAxis, int yAxis, int button) {}
|
||||
|
||||
@Override
|
||||
public void mouseClicked(int xAxis, int yAxis, int button)
|
||||
{
|
||||
IRedstoneControl control = (IRedstoneControl)tileEntity;
|
||||
|
||||
if(xAxis >= 179 && xAxis <= 197 && yAxis >= 142 && yAxis <= 160)
|
||||
if(button == 0)
|
||||
{
|
||||
RedstoneControl current = control.getControlType();
|
||||
int ordinalToSet = current.ordinal() < (RedstoneControl.values().length-1) ? current.ordinal()+1 : 0;
|
||||
|
||||
PacketHandler.sendPacket(Transmission.SERVER, new PacketRedstoneControl().setParams(Object3D.get(tileEntity), RedstoneControl.values()[ordinalToSet]));
|
||||
if(xAxis >= 179 && xAxis <= 197 && yAxis >= 142 && yAxis <= 160)
|
||||
{
|
||||
RedstoneControl current = control.getControlType();
|
||||
int ordinalToSet = current.ordinal() < (RedstoneControl.values().length-1) ? current.ordinal()+1 : 0;
|
||||
|
||||
PacketHandler.sendPacket(Transmission.SERVER, new PacketRedstoneControl().setParams(Object3D.get(tileEntity), RedstoneControl.values()[ordinalToSet]));
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -57,18 +57,38 @@ public class GuiUpgradeManagement extends GuiElement
|
|||
}
|
||||
|
||||
@Override
|
||||
public void mouseClicked(int xAxis, int yAxis)
|
||||
public void preMouseClicked(int xAxis, int yAxis, int button)
|
||||
{
|
||||
if(xAxis >= 179 && xAxis <= 198 && yAxis >= 47 && yAxis <= 54)
|
||||
if(button == 0)
|
||||
{
|
||||
mc.sndManager.playSoundFX("random.click", 1.0F, 1.0F);
|
||||
PacketHandler.sendPacket(Transmission.SERVER, new PacketRemoveUpgrade().setParams(Object3D.get(tileEntity), (byte)0));
|
||||
if(xAxis >= 180 && xAxis <= 196 && yAxis >= 11 && yAxis <= 27)
|
||||
{
|
||||
offsetX(26);
|
||||
}
|
||||
}
|
||||
|
||||
if(xAxis >= 179 && xAxis <= 198 && yAxis >= 57 && yAxis <= 64)
|
||||
}
|
||||
|
||||
@Override
|
||||
public void mouseClicked(int xAxis, int yAxis, int button)
|
||||
{
|
||||
if(button == 0)
|
||||
{
|
||||
mc.sndManager.playSoundFX("random.click", 1.0F, 1.0F);
|
||||
PacketHandler.sendPacket(Transmission.SERVER, new PacketRemoveUpgrade().setParams(Object3D.get(tileEntity), (byte)1));
|
||||
if(xAxis >= 179 && xAxis <= 198 && yAxis >= 47 && yAxis <= 54)
|
||||
{
|
||||
mc.sndManager.playSoundFX("random.click", 1.0F, 1.0F);
|
||||
PacketHandler.sendPacket(Transmission.SERVER, new PacketRemoveUpgrade().setParams(Object3D.get(tileEntity), (byte)0));
|
||||
}
|
||||
|
||||
if(xAxis >= 179 && xAxis <= 198 && yAxis >= 57 && yAxis <= 64)
|
||||
{
|
||||
mc.sndManager.playSoundFX("random.click", 1.0F, 1.0F);
|
||||
PacketHandler.sendPacket(Transmission.SERVER, new PacketRemoveUpgrade().setParams(Object3D.get(tileEntity), (byte)1));
|
||||
}
|
||||
|
||||
if(xAxis >= 180 && xAxis <= 196 && yAxis >= 11 && yAxis <= 27)
|
||||
{
|
||||
offsetX(-26);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,12 +1,13 @@
|
|||
package mekanism.generators.client;
|
||||
|
||||
import mekanism.client.GuiMekanism;
|
||||
import mekanism.client.GuiRedstoneControl;
|
||||
import mekanism.common.MekanismUtils;
|
||||
import mekanism.common.MekanismUtils.ResourceType;
|
||||
import mekanism.generators.common.ContainerBioGenerator;
|
||||
import mekanism.generators.common.TileEntityBioGenerator;
|
||||
import net.minecraft.client.gui.inventory.GuiContainer;
|
||||
import net.minecraft.entity.player.InventoryPlayer;
|
||||
|
||||
import org.lwjgl.opengl.GL11;
|
||||
|
||||
import universalelectricity.core.electricity.ElectricityDisplay;
|
||||
|
@ -15,22 +16,22 @@ import cpw.mods.fml.relauncher.Side;
|
|||
import cpw.mods.fml.relauncher.SideOnly;
|
||||
|
||||
@SideOnly(Side.CLIENT)
|
||||
public class GuiBioGenerator extends GuiContainer
|
||||
public class GuiBioGenerator extends GuiMekanism
|
||||
{
|
||||
public TileEntityBioGenerator tileEntity;
|
||||
|
||||
public GuiRedstoneControl redstoneControl;
|
||||
|
||||
public GuiBioGenerator(InventoryPlayer inventory, TileEntityBioGenerator tentity)
|
||||
{
|
||||
super(new ContainerBioGenerator(inventory, tentity));
|
||||
tileEntity = tentity;
|
||||
redstoneControl = new GuiRedstoneControl(this, tileEntity, MekanismUtils.getResource(ResourceType.GUI, "GuiBioGenerator.png"));
|
||||
guiElements.add(new GuiRedstoneControl(this, tileEntity, MekanismUtils.getResource(ResourceType.GUI, "GuiBioGenerator.png")));
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void drawGuiContainerForegroundLayer(int mouseX, int mouseY)
|
||||
{
|
||||
super.drawGuiContainerForegroundLayer(mouseX, mouseY);
|
||||
|
||||
int xAxis = (mouseX - (width - xSize) / 2);
|
||||
int yAxis = (mouseY - (height - ySize) / 2);
|
||||
|
||||
|
@ -44,21 +45,21 @@ public class GuiBioGenerator extends GuiContainer
|
|||
{
|
||||
drawCreativeTabHoveringText(ElectricityDisplay.getDisplayShort(tileEntity.getEnergyStored(), ElectricUnit.JOULES), xAxis, yAxis);
|
||||
}
|
||||
|
||||
redstoneControl.renderForeground(xAxis, yAxis);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void drawGuiContainerBackgroundLayer(float par1, int mouseX, int mouseY)
|
||||
protected void drawGuiContainerBackgroundLayer(float partialTick, int mouseX, int mouseY)
|
||||
{
|
||||
super.drawGuiContainerBackgroundLayer(partialTick, mouseX, mouseY);
|
||||
|
||||
mc.renderEngine.func_110577_a(MekanismUtils.getResource(ResourceType.GUI, "GuiBioGenerator.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);
|
||||
|
||||
int xAxis = (mouseX - (width - xSize) / 2);
|
||||
int yAxis = (mouseY - (height - ySize) / 2);
|
||||
int xAxis = mouseX - guiWidth;
|
||||
int yAxis = mouseY - guiHeight;
|
||||
|
||||
int displayInt;
|
||||
|
||||
|
@ -67,21 +68,5 @@ public class GuiBioGenerator extends GuiContainer
|
|||
|
||||
displayInt = tileEntity.getScaledEnergyLevel(52);
|
||||
drawTexturedModalRect(guiWidth + 165, guiHeight + 17 + 52 - displayInt, 176, 52 - displayInt, 4, displayInt);
|
||||
|
||||
redstoneControl.renderBackground(xAxis, yAxis, guiWidth, guiHeight);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void mouseClicked(int mouseX, int mouseY, int button)
|
||||
{
|
||||
super.mouseClicked(mouseX, mouseY, button);
|
||||
|
||||
if(button == 0)
|
||||
{
|
||||
int xAxis = (mouseX - (width - xSize) / 2);
|
||||
int yAxis = (mouseY - (height - ySize) / 2);
|
||||
|
||||
redstoneControl.mouseClicked(xAxis, yAxis);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,37 +1,37 @@
|
|||
package mekanism.generators.client;
|
||||
|
||||
import mekanism.client.GuiMekanism;
|
||||
import mekanism.client.GuiRedstoneControl;
|
||||
import mekanism.common.MekanismUtils;
|
||||
import mekanism.common.MekanismUtils.ResourceType;
|
||||
import mekanism.generators.common.ContainerHeatGenerator;
|
||||
import mekanism.generators.common.TileEntityHeatGenerator;
|
||||
import net.minecraft.client.gui.inventory.GuiContainer;
|
||||
import net.minecraft.entity.player.InventoryPlayer;
|
||||
import org.lwjgl.opengl.GL11;
|
||||
|
||||
import cpw.mods.fml.relauncher.Side;
|
||||
import cpw.mods.fml.relauncher.SideOnly;
|
||||
import org.lwjgl.opengl.GL11;
|
||||
|
||||
import universalelectricity.core.electricity.ElectricityDisplay;
|
||||
import universalelectricity.core.electricity.ElectricityDisplay.ElectricUnit;
|
||||
import cpw.mods.fml.relauncher.Side;
|
||||
import cpw.mods.fml.relauncher.SideOnly;
|
||||
|
||||
@SideOnly(Side.CLIENT)
|
||||
public class GuiHeatGenerator extends GuiContainer
|
||||
public class GuiHeatGenerator extends GuiMekanism
|
||||
{
|
||||
public TileEntityHeatGenerator tileEntity;
|
||||
|
||||
public GuiRedstoneControl redstoneControl;
|
||||
|
||||
public GuiHeatGenerator(InventoryPlayer inventory, TileEntityHeatGenerator tentity)
|
||||
{
|
||||
super(new ContainerHeatGenerator(inventory, tentity));
|
||||
tileEntity = tentity;
|
||||
redstoneControl = new GuiRedstoneControl(this, tileEntity, MekanismUtils.getResource(ResourceType.GUI, "GuiHeatGenerator.png"));
|
||||
guiElements.add(new GuiRedstoneControl(this, tileEntity, MekanismUtils.getResource(ResourceType.GUI, "GuiHeatGenerator.png")));
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void drawGuiContainerForegroundLayer(int mouseX, int mouseY)
|
||||
{
|
||||
super.drawGuiContainerForegroundLayer(mouseX, mouseY);
|
||||
|
||||
int xAxis = (mouseX - (width - xSize) / 2);
|
||||
int yAxis = (mouseY - (height - ySize) / 2);
|
||||
|
||||
|
@ -45,21 +45,21 @@ public class GuiHeatGenerator extends GuiContainer
|
|||
{
|
||||
drawCreativeTabHoveringText(ElectricityDisplay.getDisplayShort(tileEntity.getEnergyStored(), ElectricUnit.JOULES), xAxis, yAxis);
|
||||
}
|
||||
|
||||
redstoneControl.renderForeground(xAxis, yAxis);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void drawGuiContainerBackgroundLayer(float par1, int mouseX, int mouseY)
|
||||
protected void drawGuiContainerBackgroundLayer(float partialTick, int mouseX, int mouseY)
|
||||
{
|
||||
super.drawGuiContainerBackgroundLayer(partialTick, mouseX, mouseY);
|
||||
|
||||
mc.renderEngine.func_110577_a(MekanismUtils.getResource(ResourceType.GUI, "GuiHeatGenerator.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);
|
||||
|
||||
int xAxis = (mouseX - (width - xSize) / 2);
|
||||
int yAxis = (mouseY - (height - ySize) / 2);
|
||||
int xAxis = mouseX - guiWidth;
|
||||
int yAxis = mouseY - guiHeight;
|
||||
|
||||
int displayInt;
|
||||
|
||||
|
@ -68,21 +68,5 @@ public class GuiHeatGenerator extends GuiContainer
|
|||
|
||||
displayInt = tileEntity.getScaledEnergyLevel(52);
|
||||
drawTexturedModalRect(guiWidth + 165, guiHeight + 17 + 52 - displayInt, 176, 52 - displayInt, 4, displayInt);
|
||||
|
||||
redstoneControl.renderBackground(xAxis, yAxis, guiWidth, guiHeight);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void mouseClicked(int mouseX, int mouseY, int button)
|
||||
{
|
||||
super.mouseClicked(mouseX, mouseY, button);
|
||||
|
||||
if(button == 0)
|
||||
{
|
||||
int xAxis = (mouseX - (width - xSize) / 2);
|
||||
int yAxis = (mouseY - (height - ySize) / 2);
|
||||
|
||||
redstoneControl.mouseClicked(xAxis, yAxis);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,37 +1,37 @@
|
|||
package mekanism.generators.client;
|
||||
|
||||
import mekanism.client.GuiMekanism;
|
||||
import mekanism.client.GuiRedstoneControl;
|
||||
import mekanism.common.MekanismUtils;
|
||||
import mekanism.common.MekanismUtils.ResourceType;
|
||||
import mekanism.generators.common.ContainerHydrogenGenerator;
|
||||
import mekanism.generators.common.TileEntityHydrogenGenerator;
|
||||
import net.minecraft.client.gui.inventory.GuiContainer;
|
||||
import net.minecraft.entity.player.InventoryPlayer;
|
||||
import org.lwjgl.opengl.GL11;
|
||||
|
||||
import cpw.mods.fml.relauncher.Side;
|
||||
import cpw.mods.fml.relauncher.SideOnly;
|
||||
import org.lwjgl.opengl.GL11;
|
||||
|
||||
import universalelectricity.core.electricity.ElectricityDisplay;
|
||||
import universalelectricity.core.electricity.ElectricityDisplay.ElectricUnit;
|
||||
import cpw.mods.fml.relauncher.Side;
|
||||
import cpw.mods.fml.relauncher.SideOnly;
|
||||
|
||||
@SideOnly(Side.CLIENT)
|
||||
public class GuiHydrogenGenerator extends GuiContainer
|
||||
public class GuiHydrogenGenerator extends GuiMekanism
|
||||
{
|
||||
public TileEntityHydrogenGenerator tileEntity;
|
||||
|
||||
public GuiRedstoneControl redstoneControl;
|
||||
|
||||
public GuiHydrogenGenerator(InventoryPlayer inventory, TileEntityHydrogenGenerator tentity)
|
||||
{
|
||||
super(new ContainerHydrogenGenerator(inventory, tentity));
|
||||
tileEntity = tentity;
|
||||
redstoneControl = new GuiRedstoneControl(this, tileEntity, MekanismUtils.getResource(ResourceType.GUI, "GuiHydrogenGenerator.png"));
|
||||
guiElements.add(new GuiRedstoneControl(this, tileEntity, MekanismUtils.getResource(ResourceType.GUI, "GuiHydrogenGenerator.png")));
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void drawGuiContainerForegroundLayer(int mouseX, int mouseY)
|
||||
{
|
||||
super.drawGuiContainerForegroundLayer(mouseX, mouseY);
|
||||
|
||||
int xAxis = (mouseX - (width - xSize) / 2);
|
||||
int yAxis = (mouseY - (height - ySize) / 2);
|
||||
|
||||
|
@ -45,21 +45,21 @@ public class GuiHydrogenGenerator extends GuiContainer
|
|||
{
|
||||
drawCreativeTabHoveringText(ElectricityDisplay.getDisplayShort(tileEntity.getEnergyStored(), ElectricUnit.JOULES), xAxis, yAxis);
|
||||
}
|
||||
|
||||
redstoneControl.renderForeground(xAxis, yAxis);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void drawGuiContainerBackgroundLayer(float par1, int mouseX, int mouseY)
|
||||
protected void drawGuiContainerBackgroundLayer(float partialTick, int mouseX, int mouseY)
|
||||
{
|
||||
super.drawGuiContainerBackgroundLayer(partialTick, mouseX, mouseY);
|
||||
|
||||
mc.renderEngine.func_110577_a(MekanismUtils.getResource(ResourceType.GUI, "GuiHydrogenGenerator.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);
|
||||
|
||||
int xAxis = (mouseX - (width - xSize) / 2);
|
||||
int yAxis = (mouseY - (height - ySize) / 2);
|
||||
int xAxis = mouseX - guiWidth;
|
||||
int yAxis = mouseY - guiHeight;
|
||||
|
||||
int displayInt;
|
||||
|
||||
|
@ -68,21 +68,5 @@ public class GuiHydrogenGenerator extends GuiContainer
|
|||
|
||||
displayInt = tileEntity.getScaledEnergyLevel(52);
|
||||
drawTexturedModalRect(guiWidth + 165, guiHeight + 17 + 52 - displayInt, 176, 52 - displayInt, 4, displayInt);
|
||||
|
||||
redstoneControl.renderBackground(xAxis, yAxis, guiWidth, guiHeight);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void mouseClicked(int mouseX, int mouseY, int button)
|
||||
{
|
||||
super.mouseClicked(mouseX, mouseY, button);
|
||||
|
||||
if(button == 0)
|
||||
{
|
||||
int xAxis = (mouseX - (width - xSize) / 2);
|
||||
int yAxis = (mouseY - (height - ySize) / 2);
|
||||
|
||||
redstoneControl.mouseClicked(xAxis, yAxis);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,37 +1,37 @@
|
|||
package mekanism.generators.client;
|
||||
|
||||
import mekanism.client.GuiMekanism;
|
||||
import mekanism.client.GuiRedstoneControl;
|
||||
import mekanism.common.MekanismUtils;
|
||||
import mekanism.common.MekanismUtils.ResourceType;
|
||||
import mekanism.generators.common.ContainerSolarGenerator;
|
||||
import mekanism.generators.common.TileEntitySolarGenerator;
|
||||
import net.minecraft.client.gui.inventory.GuiContainer;
|
||||
import net.minecraft.entity.player.InventoryPlayer;
|
||||
import org.lwjgl.opengl.GL11;
|
||||
|
||||
import cpw.mods.fml.relauncher.Side;
|
||||
import cpw.mods.fml.relauncher.SideOnly;
|
||||
import org.lwjgl.opengl.GL11;
|
||||
|
||||
import universalelectricity.core.electricity.ElectricityDisplay;
|
||||
import universalelectricity.core.electricity.ElectricityDisplay.ElectricUnit;
|
||||
import cpw.mods.fml.relauncher.Side;
|
||||
import cpw.mods.fml.relauncher.SideOnly;
|
||||
|
||||
@SideOnly(Side.CLIENT)
|
||||
public class GuiSolarGenerator extends GuiContainer
|
||||
public class GuiSolarGenerator extends GuiMekanism
|
||||
{
|
||||
public TileEntitySolarGenerator tileEntity;
|
||||
|
||||
public GuiRedstoneControl redstoneControl;
|
||||
|
||||
public GuiSolarGenerator(InventoryPlayer inventory, TileEntitySolarGenerator tentity)
|
||||
{
|
||||
super(new ContainerSolarGenerator(inventory, tentity));
|
||||
tileEntity = tentity;
|
||||
redstoneControl = new GuiRedstoneControl(this, tileEntity, MekanismUtils.getResource(ResourceType.GUI, "GuiSolarGenerator.png"));
|
||||
guiElements.add(new GuiRedstoneControl(this, tileEntity, MekanismUtils.getResource(ResourceType.GUI, "GuiSolarGenerator.png")));
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void drawGuiContainerForegroundLayer(int mouseX, int mouseY)
|
||||
{
|
||||
super.drawGuiContainerForegroundLayer(mouseX, mouseY);
|
||||
|
||||
int xAxis = (mouseX - (width - xSize) / 2);
|
||||
int yAxis = (mouseY - (height - ySize) / 2);
|
||||
|
||||
|
@ -45,21 +45,21 @@ public class GuiSolarGenerator extends GuiContainer
|
|||
{
|
||||
drawCreativeTabHoveringText(ElectricityDisplay.getDisplayShort(tileEntity.getEnergyStored(), ElectricUnit.JOULES), xAxis, yAxis);
|
||||
}
|
||||
|
||||
redstoneControl.renderForeground(xAxis, yAxis);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void drawGuiContainerBackgroundLayer(float par1, int mouseX, int mouseY)
|
||||
protected void drawGuiContainerBackgroundLayer(float partialTick, int mouseX, int mouseY)
|
||||
{
|
||||
super.drawGuiContainerBackgroundLayer(partialTick, mouseX, mouseY);
|
||||
|
||||
mc.renderEngine.func_110577_a(MekanismUtils.getResource(ResourceType.GUI, "GuiSolarGenerator.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);
|
||||
|
||||
int xAxis = (mouseX - (width - xSize) / 2);
|
||||
int yAxis = (mouseY - (height - ySize) / 2);
|
||||
int xAxis = mouseX - guiWidth;
|
||||
int yAxis = mouseY - guiHeight;
|
||||
|
||||
int displayInt;
|
||||
|
||||
|
@ -67,21 +67,5 @@ public class GuiSolarGenerator extends GuiContainer
|
|||
drawTexturedModalRect(guiWidth + 165, guiHeight + 17 + 52 - displayInt, 176, 52 - displayInt, 4, displayInt);
|
||||
|
||||
drawTexturedModalRect(guiWidth + 20, guiHeight + 37, 176, (tileEntity.seesSun ? 52 : 64), 12, 12);
|
||||
|
||||
redstoneControl.renderBackground(xAxis, yAxis, guiWidth, guiHeight);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void mouseClicked(int mouseX, int mouseY, int button)
|
||||
{
|
||||
super.mouseClicked(mouseX, mouseY, button);
|
||||
|
||||
if(button == 0)
|
||||
{
|
||||
int xAxis = (mouseX - (width - xSize) / 2);
|
||||
int yAxis = (mouseY - (height - ySize) / 2);
|
||||
|
||||
redstoneControl.mouseClicked(xAxis, yAxis);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,13 +1,13 @@
|
|||
package mekanism.generators.client;
|
||||
|
||||
import mekanism.api.EnumColor;
|
||||
import mekanism.client.GuiMekanism;
|
||||
import mekanism.client.GuiRedstoneControl;
|
||||
import mekanism.common.MekanismUtils;
|
||||
import mekanism.common.MekanismUtils.ResourceType;
|
||||
import mekanism.generators.common.ContainerWindTurbine;
|
||||
import mekanism.generators.common.MekanismGenerators;
|
||||
import mekanism.generators.common.TileEntityWindTurbine;
|
||||
import net.minecraft.client.gui.inventory.GuiContainer;
|
||||
import net.minecraft.entity.player.InventoryPlayer;
|
||||
|
||||
import org.lwjgl.opengl.GL11;
|
||||
|
@ -18,22 +18,22 @@ import cpw.mods.fml.relauncher.Side;
|
|||
import cpw.mods.fml.relauncher.SideOnly;
|
||||
|
||||
@SideOnly(Side.CLIENT)
|
||||
public class GuiWindTurbine extends GuiContainer
|
||||
public class GuiWindTurbine extends GuiMekanism
|
||||
{
|
||||
public TileEntityWindTurbine tileEntity;
|
||||
|
||||
public GuiRedstoneControl redstoneControl;
|
||||
|
||||
public GuiWindTurbine(InventoryPlayer inventory, TileEntityWindTurbine tentity)
|
||||
{
|
||||
super(new ContainerWindTurbine(inventory, tentity));
|
||||
tileEntity = tentity;
|
||||
redstoneControl = new GuiRedstoneControl(this, tileEntity, MekanismUtils.getResource(ResourceType.GUI, "GuiWindTurbine.png"));
|
||||
guiElements.add(new GuiRedstoneControl(this, tileEntity, MekanismUtils.getResource(ResourceType.GUI, "GuiWindTurbine.png")));
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void drawGuiContainerForegroundLayer(int mouseX, int mouseY)
|
||||
{
|
||||
super.drawGuiContainerForegroundLayer(mouseX, mouseY);
|
||||
|
||||
int xAxis = (mouseX - (width - xSize) / 2);
|
||||
int yAxis = (mouseY - (height - ySize) / 2);
|
||||
|
||||
|
@ -55,21 +55,21 @@ public class GuiWindTurbine extends GuiContainer
|
|||
{
|
||||
drawCreativeTabHoveringText(ElectricityDisplay.getDisplayShort(tileEntity.getEnergyStored(), ElectricUnit.JOULES), xAxis, yAxis);
|
||||
}
|
||||
|
||||
redstoneControl.renderForeground(xAxis, yAxis);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void drawGuiContainerBackgroundLayer(float par1, int mouseX, int mouseY)
|
||||
protected void drawGuiContainerBackgroundLayer(float partialTick, int mouseX, int mouseY)
|
||||
{
|
||||
super.drawGuiContainerBackgroundLayer(partialTick, mouseX, mouseY);
|
||||
|
||||
mc.renderEngine.func_110577_a(MekanismUtils.getResource(ResourceType.GUI, "GuiWindTurbine.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);
|
||||
|
||||
int xAxis = (mouseX - (width - xSize) / 2);
|
||||
int yAxis = (mouseY - (height - ySize) / 2);
|
||||
int xAxis = mouseX - guiWidth;
|
||||
int yAxis = mouseY - guiHeight;
|
||||
|
||||
int displayInt;
|
||||
|
||||
|
@ -77,21 +77,5 @@ public class GuiWindTurbine extends GuiContainer
|
|||
drawTexturedModalRect(guiWidth + 165, guiHeight + 17 + 52 - displayInt, 176, 52 - displayInt, 4, displayInt);
|
||||
|
||||
drawTexturedModalRect(guiWidth + 20, guiHeight + 37, 176, (tileEntity.getVolumeMultiplier() > 0 ? 52 : 64), 12, 12);
|
||||
|
||||
redstoneControl.renderBackground(xAxis, yAxis, guiWidth, guiHeight);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void mouseClicked(int mouseX, int mouseY, int button)
|
||||
{
|
||||
super.mouseClicked(mouseX, mouseY, button);
|
||||
|
||||
if(button == 0)
|
||||
{
|
||||
int xAxis = (mouseX - (width - xSize) / 2);
|
||||
int yAxis = (mouseY - (height - ySize) / 2);
|
||||
|
||||
redstoneControl.mouseClicked(xAxis, yAxis);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue