Just about finished new Side Configuration GUI
|
@ -7,6 +7,7 @@ import java.util.Set;
|
|||
|
||||
import mekanism.api.transmitters.TransmissionType;
|
||||
import mekanism.client.gui.element.GuiElement;
|
||||
import mekanism.client.gui.element.GuiGauge;
|
||||
import mekanism.common.SideData;
|
||||
import mekanism.common.base.ISideConfiguration;
|
||||
import mekanism.common.item.ItemConfigurator;
|
||||
|
@ -74,6 +75,23 @@ public abstract class GuiMekanism extends GuiContainer implements IGuiWrapper
|
|||
|
||||
if(tileEntity instanceof ISideConfiguration)
|
||||
{
|
||||
for(GuiElement element : guiElements)
|
||||
{
|
||||
if(element instanceof GuiGauge)
|
||||
{
|
||||
int guiWidth = (width - xSize) / 2;
|
||||
int guiHeight = (height - ySize) / 2;
|
||||
|
||||
if(element.getBounds(guiWidth, guiHeight).contains(xAxis, yAxis))
|
||||
{
|
||||
if(((GuiGauge)element).color != null)
|
||||
{
|
||||
drawCreativeTabHoveringText(((GuiGauge)element).color.getName(), xAxis, yAxis);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Slot hovering = null;
|
||||
|
||||
for(int i = 0; i < inventorySlots.inventorySlots.size(); i++)
|
||||
|
|
|
@ -6,6 +6,8 @@ import java.util.Map;
|
|||
import mekanism.api.Coord4D;
|
||||
import mekanism.api.EnumColor;
|
||||
import mekanism.api.transmitters.TransmissionType;
|
||||
import mekanism.client.gui.element.GuiConfigTypeTab;
|
||||
import mekanism.client.gui.element.GuiElement;
|
||||
import mekanism.client.render.MekanismRenderer;
|
||||
import mekanism.client.sound.SoundHandler;
|
||||
import mekanism.common.Mekanism;
|
||||
|
@ -24,7 +26,6 @@ import net.minecraft.tileentity.TileEntity;
|
|||
|
||||
import org.lwjgl.input.Keyboard;
|
||||
import org.lwjgl.opengl.GL11;
|
||||
import org.lwjgl.opengl.GL12;
|
||||
|
||||
import cpw.mods.fml.relauncher.Side;
|
||||
import cpw.mods.fml.relauncher.SideOnly;
|
||||
|
@ -36,14 +37,25 @@ public class GuiSideConfiguration extends GuiMekanism
|
|||
|
||||
public ISideConfiguration configurable;
|
||||
|
||||
public TransmissionType currentType;
|
||||
|
||||
public GuiSideConfiguration(EntityPlayer player, ISideConfiguration tile)
|
||||
{
|
||||
super(new ContainerNull(player, (TileEntityContainerBlock)tile));
|
||||
super((TileEntityContainerBlock)tile, new ContainerNull(player, (TileEntityContainerBlock)tile));
|
||||
|
||||
ySize = 95;
|
||||
|
||||
configurable = tile;
|
||||
|
||||
for(TransmissionType type : configurable.getConfig().transmissions)
|
||||
{
|
||||
guiElements.add(new GuiConfigTypeTab(this, (TileEntity)configurable, type, MekanismUtils.getResource(ResourceType.GUI, "GuiConfiguration.png")));
|
||||
}
|
||||
|
||||
currentType = getTopTransmission();
|
||||
|
||||
updateTabs();
|
||||
|
||||
slotPosMap.put(0, new GuiPos(81, 64));
|
||||
slotPosMap.put(1, new GuiPos(81, 34));
|
||||
slotPosMap.put(2, new GuiPos(81, 49));
|
||||
|
@ -52,6 +64,34 @@ public class GuiSideConfiguration extends GuiMekanism
|
|||
slotPosMap.put(5, new GuiPos(96, 49));
|
||||
}
|
||||
|
||||
public TransmissionType getTopTransmission()
|
||||
{
|
||||
return configurable.getConfig().transmissions.get(0);
|
||||
}
|
||||
|
||||
public void updateTabs()
|
||||
{
|
||||
int rendered = 0;
|
||||
|
||||
for(GuiElement element : guiElements)
|
||||
{
|
||||
if(element instanceof GuiConfigTypeTab)
|
||||
{
|
||||
GuiConfigTypeTab tab = (GuiConfigTypeTab)element;
|
||||
|
||||
tab.visible = currentType != tab.transmission;
|
||||
|
||||
if(tab.visible)
|
||||
{
|
||||
tab.left = rendered >= 0 && rendered <= 2;
|
||||
tab.setY(2+((rendered%3)*(26+2)));
|
||||
}
|
||||
|
||||
rendered++;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void drawGuiContainerBackgroundLayer(float partialTick, int mouseX, int mouseY)
|
||||
{
|
||||
|
@ -91,7 +131,7 @@ public class GuiSideConfiguration extends GuiMekanism
|
|||
int x = slotPosMap.get(i).xPos;
|
||||
int y = slotPosMap.get(i).yPos;
|
||||
|
||||
SideData data = configurable.getConfig().getOutput(TransmissionType.ITEM, i);
|
||||
SideData data = configurable.getConfig().getOutput(currentType, i);
|
||||
|
||||
if(data.color != EnumColor.GREY)
|
||||
{
|
||||
|
@ -116,9 +156,9 @@ public class GuiSideConfiguration extends GuiMekanism
|
|||
int xAxis = (mouseX - (width - xSize) / 2);
|
||||
int yAxis = (mouseY - (height - ySize) / 2);
|
||||
|
||||
String title = MekanismUtils.localize("gui.configuration.side");
|
||||
String title = currentType.localize() + " " + MekanismUtils.localize("gui.config");
|
||||
fontRendererObj.drawString(title, (xSize/2)-(fontRendererObj.getStringWidth(title)/2), 5, 0x404040);
|
||||
fontRendererObj.drawString(MekanismUtils.localize("gui.eject") + ": " + (configurable.getConfig().isEjecting(TransmissionType.ITEM) ? "On" : "Off"), 53, 17, 0x00CD00);
|
||||
fontRendererObj.drawString(MekanismUtils.localize("gui.eject") + ": " + (configurable.getConfig().isEjecting(currentType) ? "On" : "Off"), 53, 17, 0x00CD00);
|
||||
fontRendererObj.drawString(MekanismUtils.localize("gui.slots"), 77, 81, 0x787878);
|
||||
|
||||
for(int i = 0; i < slotPosMap.size(); i++)
|
||||
|
@ -126,7 +166,7 @@ public class GuiSideConfiguration extends GuiMekanism
|
|||
int x = slotPosMap.get(i).xPos;
|
||||
int y = slotPosMap.get(i).yPos;
|
||||
|
||||
SideData data = configurable.getConfig().getOutput(TransmissionType.ITEM, i);
|
||||
SideData data = configurable.getConfig().getOutput(currentType, i);
|
||||
|
||||
if(xAxis >= x && xAxis <= x+14 && yAxis >= y && yAxis <= y+14)
|
||||
{
|
||||
|
@ -177,7 +217,7 @@ public class GuiSideConfiguration extends GuiMekanism
|
|||
if(xAxis >= 156 && xAxis <= 170 && yAxis >= 6 && yAxis <= 20)
|
||||
{
|
||||
SoundHandler.playSound("gui.button.press");
|
||||
Mekanism.packetHandler.sendToServer(new ConfigurationUpdateMessage(ConfigurationPacket.EJECT, Coord4D.get(tile), 0, 0, TransmissionType.ITEM));
|
||||
Mekanism.packetHandler.sendToServer(new ConfigurationUpdateMessage(ConfigurationPacket.EJECT, Coord4D.get(tile), 0, 0, currentType));
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -194,7 +234,7 @@ public class GuiSideConfiguration extends GuiMekanism
|
|||
if(xAxis >= x && xAxis <= x+14 && yAxis >= y && yAxis <= y+14)
|
||||
{
|
||||
SoundHandler.playSound("gui.button.press");
|
||||
Mekanism.packetHandler.sendToServer(new ConfigurationUpdateMessage(ConfigurationPacket.SIDE_DATA, Coord4D.get(tile), button, i, TransmissionType.ITEM));
|
||||
Mekanism.packetHandler.sendToServer(new ConfigurationUpdateMessage(ConfigurationPacket.SIDE_DATA, Coord4D.get(tile), button, i, currentType));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -38,7 +38,7 @@ public class GuiTransporterConfig extends GuiMekanism
|
|||
|
||||
public GuiTransporterConfig(EntityPlayer player, ISideConfiguration tile)
|
||||
{
|
||||
super(new ContainerNull(player, (TileEntityContainerBlock)tile));
|
||||
super((TileEntityContainerBlock)tile, new ContainerNull(player, (TileEntityContainerBlock)tile));
|
||||
|
||||
ySize = 95;
|
||||
|
||||
|
|
|
@ -1,5 +1,122 @@
|
|||
package mekanism.client.gui.element;
|
||||
|
||||
public class GuiConfigTypeTab {
|
||||
import mekanism.api.transmitters.TransmissionType;
|
||||
import mekanism.client.gui.GuiSideConfiguration;
|
||||
import mekanism.client.gui.IGuiWrapper;
|
||||
import mekanism.client.sound.SoundHandler;
|
||||
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 GuiConfigTypeTab extends GuiElement
|
||||
{
|
||||
private TileEntity tileEntity;
|
||||
public TransmissionType transmission;
|
||||
|
||||
private int yPos;
|
||||
|
||||
public boolean visible;
|
||||
public boolean left;
|
||||
|
||||
public GuiConfigTypeTab(IGuiWrapper gui, TileEntity tile, TransmissionType type, ResourceLocation def)
|
||||
{
|
||||
super(getResource(type), gui, def);
|
||||
|
||||
tileEntity = tile;
|
||||
transmission = type;
|
||||
}
|
||||
|
||||
private static ResourceLocation getResource(TransmissionType t)
|
||||
{
|
||||
return MekanismUtils.getResource(ResourceType.GUI_ELEMENT, "Gui" + t.getTransmission() + "Tab.png");
|
||||
}
|
||||
|
||||
public void setY(int y)
|
||||
{
|
||||
yPos = y;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Rectangle4i getBounds(int guiWidth, int guiHeight)
|
||||
{
|
||||
return new Rectangle4i(guiWidth + getLeftBound(false)-4, guiHeight + yPos, 26, 26);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void renderBackground(int xAxis, int yAxis, int guiWidth, int guiHeight)
|
||||
{
|
||||
if(!visible)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
mc.renderEngine.bindTexture(RESOURCE);
|
||||
|
||||
guiObj.drawTexturedRect(guiWidth + getLeftBound(false)-4, guiHeight + yPos, 0, left ? 0 : 26, 26, 26);
|
||||
|
||||
if(xAxis >= getLeftBound(true) && xAxis <= getRightBound(true) && yAxis >= yPos+4 && yAxis <= yPos+22)
|
||||
{
|
||||
guiObj.drawTexturedRect(guiWidth + getLeftBound(true), guiHeight + yPos+4, 26, 0, 18, 18);
|
||||
}
|
||||
else {
|
||||
guiObj.drawTexturedRect(guiWidth + getLeftBound(true), guiHeight + yPos+4, 26, 18, 18, 18);
|
||||
}
|
||||
|
||||
mc.renderEngine.bindTexture(defaultLocation);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void renderForeground(int xAxis, int yAxis)
|
||||
{
|
||||
if(!visible)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
mc.renderEngine.bindTexture(RESOURCE);
|
||||
|
||||
if(xAxis >= getLeftBound(true) && xAxis <= getRightBound(true) && yAxis >= yPos+4 && yAxis <= yPos+22)
|
||||
{
|
||||
displayTooltip(transmission.localize(), xAxis, yAxis);
|
||||
}
|
||||
|
||||
mc.renderEngine.bindTexture(defaultLocation);
|
||||
}
|
||||
|
||||
public int getLeftBound(boolean adjust)
|
||||
{
|
||||
return left ? -21+(adjust ? 1 : 0) : 179-(adjust ? 1 : 0);
|
||||
}
|
||||
|
||||
public int getRightBound(boolean adjust)
|
||||
{
|
||||
return left ? -3+(adjust ? 1 : 0) : 197-(adjust ? 1 : 0);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void preMouseClicked(int xAxis, int yAxis, int button) {}
|
||||
|
||||
@Override
|
||||
public void mouseClicked(int xAxis, int yAxis, int button)
|
||||
{
|
||||
if(!visible)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
if(button == 0)
|
||||
{
|
||||
if(xAxis >= getLeftBound(true) && xAxis <= getRightBound(true) && yAxis >= yPos+4 && yAxis <= yPos+22)
|
||||
{
|
||||
((GuiSideConfiguration)guiObj).currentType = transmission;
|
||||
((GuiSideConfiguration)guiObj).updateTabs();
|
||||
SoundHandler.playSound("gui.button.press");
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,11 +1,10 @@
|
|||
package mekanism.client.gui.element;
|
||||
|
||||
import mekanism.api.EnumColor;
|
||||
import mekanism.client.gui.IGuiWrapper;
|
||||
import mekanism.client.render.MekanismRenderer;
|
||||
import mekanism.common.base.IDropperHandler;
|
||||
import mekanism.common.util.MekanismUtils;
|
||||
import mekanism.common.util.MekanismUtils.ResourceType;
|
||||
import net.minecraft.tileentity.TileEntity;
|
||||
import net.minecraft.util.IIcon;
|
||||
import net.minecraft.util.ResourceLocation;
|
||||
import codechicken.lib.vec.Rectangle4i;
|
||||
|
@ -15,9 +14,13 @@ public abstract class GuiGauge<T> extends GuiElement
|
|||
protected int xLocation;
|
||||
protected int yLocation;
|
||||
|
||||
protected int texX;
|
||||
protected int texY;
|
||||
|
||||
protected int width;
|
||||
protected int height;
|
||||
|
||||
public EnumColor color;
|
||||
protected int number;
|
||||
protected boolean dummy;
|
||||
|
||||
|
@ -32,6 +35,11 @@ public abstract class GuiGauge<T> extends GuiElement
|
|||
|
||||
width = type.width;
|
||||
height = type.height;
|
||||
|
||||
texX = type.texX;
|
||||
texY = type.texY;
|
||||
|
||||
color = type.color;
|
||||
number = type.number;
|
||||
}
|
||||
|
||||
|
@ -46,7 +54,7 @@ public abstract class GuiGauge<T> extends GuiElement
|
|||
{
|
||||
mc.renderEngine.bindTexture(RESOURCE);
|
||||
|
||||
guiObj.drawTexturedRect(guiWidth + xLocation, guiHeight + yLocation, 0, 0, width, height);
|
||||
guiObj.drawTexturedRect(guiWidth + xLocation, guiHeight + yLocation, texX, texY, width, height);
|
||||
|
||||
if(!dummy)
|
||||
{
|
||||
|
@ -134,19 +142,37 @@ public abstract class GuiGauge<T> extends GuiElement
|
|||
|
||||
public static enum Type
|
||||
{
|
||||
STANDARD(18, 60, 1, "GuiGaugeStandard.png"),
|
||||
WIDE(66, 50, 4, "GuiGaugeWide.png"),
|
||||
SMALL(18, 30, 1, "GuiGaugeSmall.png");
|
||||
STANDARD(null, 18, 60, 0, 0, 1, "GuiGaugeStandard.png"),
|
||||
STANDARD_YELLOW(EnumColor.YELLOW, 18, 60, 0, 60, 1, "GuiGaugeStandard.png"),
|
||||
STANDARD_RED(EnumColor.DARK_RED, 18, 60, 0, 120, 1, "GuiGaugeStandard.png"),
|
||||
STANDARD_ORANGE(EnumColor.ORANGE, 18, 60, 0, 180, 1, "GuiGaugeStandard.png"),
|
||||
STANDARD_BLUE(EnumColor.DARK_BLUE, 18, 60, 0, 240, 1, "GuiGaugeStandard.png"),
|
||||
WIDE(null, 66, 50, 0, 0, 4, "GuiGaugeWide.png"),
|
||||
WIDE_YELLOW(EnumColor.YELLOW, 66, 50, 0, 50, 4, "GuiGaugeWide.png"),
|
||||
WIDE_RED(EnumColor.DARK_RED, 66, 50, 0, 100, 4, "GuiGaugeWide.png"),
|
||||
WIDE_ORANGE(EnumColor.ORANGE, 66, 50, 0, 150, 4, "GuiGaugeWide.png"),
|
||||
WIDE_BLUE(EnumColor.DARK_BLUE, 66, 50, 0, 200, 4, "GuiGaugeWide.png"),
|
||||
SMALL(null, 18, 30, 0, 0, 1, "GuiGaugeSmall.png"),
|
||||
SMALL_YELLOW(EnumColor.YELLOW, 18, 30, 0, 30, 1, "GuiGaugeSmall.png"),
|
||||
SMALL_RED(EnumColor.DARK_RED, 18, 30, 0, 60, 1, "GuiGaugeSmall.png"),
|
||||
SMALL_ORANGE(EnumColor.ORANGE, 18, 30, 0, 90, 1, "GuiGaugeSmall.png"),
|
||||
SMALL_BLUE(EnumColor.DARK_BLUE, 18, 30, 0, 120, 1, "GuiGaugeSmall.png");
|
||||
|
||||
public EnumColor color;
|
||||
public int width;
|
||||
public int height;
|
||||
public int texX;
|
||||
public int texY;
|
||||
public int number;
|
||||
public String textureLocation;
|
||||
|
||||
private Type(int w, int h, int n, String t)
|
||||
private Type(EnumColor c, int w, int h, int tx, int ty, int n, String t)
|
||||
{
|
||||
color = c;
|
||||
width = w;
|
||||
height = h;
|
||||
texX = tx;
|
||||
texY = ty;
|
||||
number = n;
|
||||
textureLocation = t;
|
||||
}
|
||||
|
|
Before Width: | Height: | Size: 3.4 KiB After Width: | Height: | Size: 3.5 KiB |
Before Width: | Height: | Size: 3.4 KiB After Width: | Height: | Size: 3.5 KiB |
Before Width: | Height: | Size: 3.4 KiB After Width: | Height: | Size: 3.5 KiB |
Before Width: | Height: | Size: 509 B After Width: | Height: | Size: 3 KiB |
Before Width: | Height: | Size: 575 B After Width: | Height: | Size: 3.4 KiB |
Before Width: | Height: | Size: 564 B After Width: | Height: | Size: 3.2 KiB |
Before Width: | Height: | Size: 3.5 KiB After Width: | Height: | Size: 3.6 KiB |
Before Width: | Height: | Size: 3.3 KiB After Width: | Height: | Size: 3.4 KiB |
|
@ -448,6 +448,7 @@ gui.solarEvaporationController.short=Solar E. Controller
|
|||
gui.dictionary.noKey=No key.
|
||||
|
||||
gui.configuration=Configuration
|
||||
gui.config=Config
|
||||
gui.configuration.side=Side Config
|
||||
gui.configuration.transporter=Transporter Config
|
||||
gui.configuration.strictInput=Strict Input
|
||||
|
|