polishing the lesu.

This commit is contained in:
modmuss50 2015-06-14 16:54:49 +01:00
parent c9c664352c
commit 11a7b42689
2 changed files with 45 additions and 25 deletions

View file

@ -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));
}
}

View file

@ -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<LesuNetwork> countedNetworks = new ArrayList<LesuNetwork>();
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);
}
}