Added AESU logic
This commit is contained in:
parent
58aac2ce0b
commit
e81fc202ad
4 changed files with 58 additions and 103 deletions
src/main/java/techreborn/client/gui
|
@ -24,9 +24,15 @@
|
|||
|
||||
package techreborn.client.gui;
|
||||
|
||||
import java.io.IOException;
|
||||
|
||||
import net.minecraft.client.gui.GuiButton;
|
||||
import net.minecraft.client.renderer.GlStateManager;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import reborncore.common.network.NetworkManager;
|
||||
import reborncore.common.powerSystem.PowerSystem;
|
||||
import techreborn.client.gui.widget.GuiButtonUpDown;
|
||||
import techreborn.packets.PacketAesu;
|
||||
import techreborn.tiles.storage.TileAdjustableSU;
|
||||
|
||||
public class GuiAESU extends GuiBase {
|
||||
|
@ -63,66 +69,18 @@ public class GuiAESU extends GuiBase {
|
|||
GlStateManager.popMatrix();
|
||||
|
||||
this.builder.drawMultiEnergyBar(this, 81, 28, (int) this.tile.getEnergy(), (int) this.tile.getMaxPower(), mouseX, mouseY, 0, layer);
|
||||
}
|
||||
|
||||
buttonList.add(new GuiButtonUpDown(300, 121, 79, this, layer));
|
||||
buttonList.add(new GuiButtonUpDown(301, 121 + 12, 79, this, layer));
|
||||
buttonList.add(new GuiButtonUpDown(302, 121 + 24, 79, this, layer));
|
||||
buttonList.add(new GuiButtonUpDown(303, 121 + 36, 79, this, layer));
|
||||
}
|
||||
|
||||
@Override
|
||||
public void actionPerformed(final GuiButton button) throws IOException {
|
||||
super.actionPerformed(button);
|
||||
if (button.id >= 300 && button.id <= 303) {
|
||||
NetworkManager.sendToServer(new PacketAesu(button.id, tile));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// private static final ResourceLocation texture = new ResourceLocation("techreborn", "textures/gui/aesu.png");
|
||||
//
|
||||
// TileAdjustableSU aesu;
|
||||
//
|
||||
// ContainerAESU containerAesu;
|
||||
//
|
||||
// public GuiAESU(EntityPlayer player, TileAdjustableSU tileaesu) {
|
||||
// super(new ContainerAESU(tileaesu, player));
|
||||
// this.xSize = 176;
|
||||
// this.ySize = 197;
|
||||
// aesu = tileaesu;
|
||||
// this.containerAesu = (ContainerAESU) this.inventorySlots;
|
||||
// }
|
||||
//
|
||||
// @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 GuiButton(0, k + 115, l + 5, 15, 20, "++"));
|
||||
// this.buttonList.add(new GuiButton(1, k + 115, l + 5 + 20, 15, 20, "+"));
|
||||
// this.buttonList.add(new GuiButton(2, k + 115, l + 5 + (20 * 2), 15, 20, "-"));
|
||||
// this.buttonList.add(new GuiButton(3, k + 115, l + 5 + (20 * 3), 15, 20, "--"));
|
||||
// }
|
||||
//
|
||||
// @Override
|
||||
// protected void drawGuiContainerBackgroundLayer(float p_146976_1_, int p_146976_2_, int p_146976_3_) {
|
||||
// this.drawDefaultBackground();
|
||||
// GlStateManager.color(1.0F, 1.0F, 1.0F, 1.0F);
|
||||
// this.mc.getTextureManager().bindTexture(texture);
|
||||
// int k = (this.width - this.xSize) / 2;
|
||||
// int l = (this.height - this.ySize) / 2;
|
||||
// this.drawTexturedModalRect(k, l, 0, 0, this.xSize, this.ySize);
|
||||
// }
|
||||
//
|
||||
// protected void drawGuiContainerForegroundLayer(int p_146979_1_, int p_146979_2_) {
|
||||
// this.fontRenderer.drawString(I18n.format("tile.techreborn:adjustable_su.name"), 40, 10,
|
||||
// Color.WHITE.getRGB());
|
||||
// this.fontRenderer.drawString(PowerSystem.getLocaliszedPower(containerAesu.euOut) + " /tick", 10, 20,
|
||||
// Color.WHITE.getRGB());
|
||||
// this.fontRenderer.drawString(PowerSystem.getLocaliszedPower(containerAesu.storedEu) + " ", 10, 30,
|
||||
// Color.WHITE.getRGB());
|
||||
// this.fontRenderer.drawString(PowerSystem.getLocaliszedPower(containerAesu.euChange) + " change", 10, 40,
|
||||
// Color.WHITE.getRGB());
|
||||
// }
|
||||
//
|
||||
// @Override
|
||||
// protected void actionPerformed(GuiButton button) throws IOException {
|
||||
// super.actionPerformed(button);
|
||||
// NetworkManager.sendToServer(new PacketAesu(button.id, aesu));
|
||||
// }
|
||||
//
|
||||
// @Override
|
||||
// public void drawScreen(int mouseX, int mouseY, float partialTicks) {
|
||||
// super.drawScreen(mouseX, mouseY, partialTicks);
|
||||
// this.renderHoveredToolTip(mouseX, mouseY);
|
||||
// }
|
||||
//}
|
||||
|
|
|
@ -21,8 +21,10 @@
|
|||
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||
* SOFTWARE.
|
||||
*/
|
||||
|
||||
package techreborn.client.gui.widget;
|
||||
|
||||
import net.minecraft.client.Minecraft;
|
||||
import net.minecraft.client.gui.GuiButton;
|
||||
import techreborn.client.gui.GuiBase;
|
||||
|
||||
|
@ -40,5 +42,23 @@ public class GuiButtonUpDown extends GuiButton {
|
|||
this.layer = layer;
|
||||
this.gui = gui;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean mousePressed(Minecraft mc, int mouseX, int mouseY) {
|
||||
if (layer == GuiBase.Layer.FOREGROUND) {
|
||||
mouseX -= gui.getGuiLeft();
|
||||
mouseY -= gui.getGuiTop();
|
||||
}
|
||||
if (this.enabled && this.visible && mouseX >= this.x && mouseY >= this.y && mouseX < this.x + this.width && mouseY < this.y + this.height) {
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public void drawButton(Minecraft mc, int mouseX, int mouseY, float partialTicks) {
|
||||
// We already have texture drawn
|
||||
}
|
||||
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue