Added basic aesu controls, just need to finish the gui :)

This commit is contained in:
modmuss50 2015-06-10 13:52:54 +01:00
parent 92b95b9ff0
commit 9b1093c22c
5 changed files with 154 additions and 0 deletions

View file

@ -1,10 +1,14 @@
package techreborn.client.gui;
import net.minecraft.client.gui.GuiButton;
import net.minecraft.client.gui.inventory.GuiContainer;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.util.ResourceLocation;
import net.minecraft.util.StatCollector;
import techreborn.client.container.ContainerAesu;
import techreborn.client.gui.componets.GuiHiddenButton;
import techreborn.packets.PacketAesu;
import techreborn.packets.PacketHandler;
import techreborn.tiles.TileAesu;
public class GuiAesu extends GuiContainer {
@ -23,6 +27,18 @@ public class GuiAesu extends GuiContainer {
aesu = tileaesu;
}
@Override
public void initGui() {
super.initGui();
this.buttonList.clear();
int k = (this.width - this.xSize) / 2;
int l = (this.height - this.ySize) / 2;
this.buttonList.add(new GuiHiddenButton(0, k + 106, l + 4, 18, 18, ""));
this.buttonList.add(new GuiHiddenButton(1, k + 106, l + 4 + 18, 18, 18, ""));
this.buttonList.add(new GuiHiddenButton(2, k + 106, l + 4 + (18*2), 18, 18, ""));
this.buttonList.add(new GuiHiddenButton(3, k + 106, l + 4 + (18*3), 18, 18, ""));
}
@Override
protected void drawGuiContainerBackgroundLayer(float p_146976_1_,
int p_146976_2_, int p_146976_3_)
@ -38,4 +54,10 @@ public class GuiAesu extends GuiContainer {
{
this.fontRendererObj.drawString(StatCollector.translateToLocal("tile.techreborn.aesu.name"), 40, 6, 4210752);
}
@Override
protected void actionPerformed(GuiButton button) {
super.actionPerformed(button);
PacketHandler.sendPacketToServer(new PacketAesu(button.id, aesu));
}
}

View file

@ -0,0 +1,51 @@
package techreborn.client.gui.componets;
import net.minecraft.client.Minecraft;
import net.minecraft.client.gui.FontRenderer;
import net.minecraft.client.gui.GuiButton;
import net.minecraft.client.renderer.OpenGlHelper;
import org.lwjgl.opengl.GL11;
public class GuiHiddenButton extends GuiButton {
public GuiHiddenButton(int id, int xPosition, int yPosition, String displayString) {
super(id, xPosition, yPosition, displayString);
}
public GuiHiddenButton(int id, int xPosition, int yPosition, int width, int height, String displayString) {
super(id, xPosition, yPosition, width, height, displayString);
}
@Override
public void drawButton(Minecraft p_146112_1_, int p_146112_2_, int p_146112_3_)
{
if (this.visible)
{
FontRenderer fontrenderer = p_146112_1_.fontRenderer;
p_146112_1_.getTextureManager().bindTexture(buttonTextures);
GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F);
this.field_146123_n = p_146112_2_ >= this.xPosition && p_146112_3_ >= this.yPosition && p_146112_2_ < this.xPosition + this.width && p_146112_3_ < this.yPosition + this.height;
GL11.glEnable(GL11.GL_BLEND);
OpenGlHelper.glBlendFunc(770, 771, 1, 0);
GL11.glBlendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA);
this.mouseDragged(p_146112_1_, p_146112_2_, p_146112_3_);
int l = 14737632;
if (packedFGColour != 0)
{
l = packedFGColour;
}
else if (!this.enabled)
{
l = 10526880;
}
else if (this.field_146123_n)
{
l = 16777120;
}
this.drawCenteredString(fontrenderer, this.displayString, this.xPosition + this.width / 2, this.yPosition + (this.height - 8) / 2, l);
}
}
}