From 11a7b42689141f0726df77befe13742c74bfbb68 Mon Sep 17 00:00:00 2001 From: modmuss50 Date: Sun, 14 Jun 2015 16:54:49 +0100 Subject: [PATCH] polishing the lesu. --- .../java/techreborn/client/gui/GuiLesu.java | 21 -------- .../java/techreborn/tiles/lesu/TileLesu.java | 49 +++++++++++++++++-- 2 files changed, 45 insertions(+), 25 deletions(-) diff --git a/src/main/java/techreborn/client/gui/GuiLesu.java b/src/main/java/techreborn/client/gui/GuiLesu.java index dae364164..8ab62f3ee 100644 --- a/src/main/java/techreborn/client/gui/GuiLesu.java +++ b/src/main/java/techreborn/client/gui/GuiLesu.java @@ -14,9 +14,6 @@ import techreborn.tiles.lesu.TileLesu; import java.awt.*; -/** - * Created by Mark on 14/06/2015. - */ public class GuiLesu extends GuiContainer { private static final ResourceLocation texture = new ResourceLocation( @@ -36,18 +33,6 @@ public class GuiLesu extends GuiContainer { this.containerLesu = (ContainerLesu) 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 + 96, l + 8, 18, 20, "++")); - this.buttonList.add(new GuiButton(1, k + 96, l + 8 + 22, 18, 20, "+")); - this.buttonList.add(new GuiButton(2, k + 96, l + 8 + (22*2), 18, 20, "-")); - this.buttonList.add(new GuiButton(3, k + 96, l + 8 + (22*3), 18, 20, "--")); - } - @Override protected void drawGuiContainerBackgroundLayer(float p_146976_1_, int p_146976_2_, int p_146976_3_) @@ -68,10 +53,4 @@ public class GuiLesu extends GuiContainer { this.fontRendererObj.drawString(containerLesu.connectedBlocks + " blocks", 10, 50, Color.WHITE.getRGB()); this.fontRendererObj.drawString(containerLesu.euStorage + " max eu", 10, 60, Color.WHITE.getRGB()); } - - @Override - protected void actionPerformed(GuiButton button) { - super.actionPerformed(button); - PacketHandler.sendPacketToServer(new PacketAesu(button.id, aesu)); - } } diff --git a/src/main/java/techreborn/tiles/lesu/TileLesu.java b/src/main/java/techreborn/tiles/lesu/TileLesu.java index ae6d5cea1..20e635a49 100644 --- a/src/main/java/techreborn/tiles/lesu/TileLesu.java +++ b/src/main/java/techreborn/tiles/lesu/TileLesu.java @@ -1,22 +1,36 @@ package techreborn.tiles.lesu; +import ic2.api.tile.IWrenchable; import net.minecraftforge.common.util.ForgeDirection; -import techreborn.tiles.TileAesu; +import techreborn.blocks.storage.EUStorageTile; +import techreborn.config.ConfigTechReborn; +import techreborn.util.Inventory; import java.util.ArrayList; -public class TileLesu extends TileAesu { +public class TileLesu extends EUStorageTile implements IWrenchable { - public int baseEU = 1000000000; - public int storgeBlockSize = 100000; + public int baseEU = 0; + public int storgeBlockSize = 1000000; private ArrayList countedNetworks = new ArrayList(); public int connectedBlocks = 0; public int currentBlocks = 0; + private double euLastTick = 0; + private double euChange; + private int ticks; + + public Inventory inventory = new Inventory(2, "TileAesu", 64); + + public TileLesu() { + super(5, 0, 0); + } + @Override public void updateEntity() { + super.updateEntity(); if(worldObj.isRemote){ return; } @@ -38,6 +52,33 @@ public class TileLesu extends TileAesu { } if(currentBlocks != connectedBlocks){ maxStorage = (connectedBlocks * storgeBlockSize) + baseEU; + output = connectedBlocks; } + + if(ticks == ConfigTechReborn.aveargeEuOutTickTime){ + euChange = -1; + ticks = 0; + + } else { + ticks ++; + euChange += energy - euLastTick; + if(euLastTick == energy){ + euChange = 0; + } + } + + euLastTick = energy; + } + + @Override + public String getInventoryName() { + return "Lesu"; + } + + public double getEuChange(){ + if(euChange == -1){ + return -1; + } + return (euChange / ticks); } }