polishing the lesu.
This commit is contained in:
parent
c9c664352c
commit
11a7b42689
2 changed files with 45 additions and 25 deletions
|
@ -14,9 +14,6 @@ import techreborn.tiles.lesu.TileLesu;
|
||||||
|
|
||||||
import java.awt.*;
|
import java.awt.*;
|
||||||
|
|
||||||
/**
|
|
||||||
* Created by Mark on 14/06/2015.
|
|
||||||
*/
|
|
||||||
public class GuiLesu extends GuiContainer {
|
public class GuiLesu extends GuiContainer {
|
||||||
|
|
||||||
private static final ResourceLocation texture = new ResourceLocation(
|
private static final ResourceLocation texture = new ResourceLocation(
|
||||||
|
@ -36,18 +33,6 @@ public class GuiLesu extends GuiContainer {
|
||||||
this.containerLesu = (ContainerLesu) this.inventorySlots;
|
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
|
@Override
|
||||||
protected void drawGuiContainerBackgroundLayer(float p_146976_1_,
|
protected void drawGuiContainerBackgroundLayer(float p_146976_1_,
|
||||||
int p_146976_2_, int p_146976_3_)
|
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.connectedBlocks + " blocks", 10, 50, Color.WHITE.getRGB());
|
||||||
this.fontRendererObj.drawString(containerLesu.euStorage + " max eu", 10, 60, 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));
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,22 +1,36 @@
|
||||||
package techreborn.tiles.lesu;
|
package techreborn.tiles.lesu;
|
||||||
|
|
||||||
|
|
||||||
|
import ic2.api.tile.IWrenchable;
|
||||||
import net.minecraftforge.common.util.ForgeDirection;
|
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;
|
import java.util.ArrayList;
|
||||||
|
|
||||||
public class TileLesu extends TileAesu {
|
public class TileLesu extends EUStorageTile implements IWrenchable {
|
||||||
|
|
||||||
public int baseEU = 1000000000;
|
public int baseEU = 0;
|
||||||
public int storgeBlockSize = 100000;
|
public int storgeBlockSize = 1000000;
|
||||||
|
|
||||||
private ArrayList<LesuNetwork> countedNetworks = new ArrayList<LesuNetwork>();
|
private ArrayList<LesuNetwork> countedNetworks = new ArrayList<LesuNetwork>();
|
||||||
public int connectedBlocks = 0;
|
public int connectedBlocks = 0;
|
||||||
public int currentBlocks = 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
|
@Override
|
||||||
public void updateEntity() {
|
public void updateEntity() {
|
||||||
|
super.updateEntity();
|
||||||
if(worldObj.isRemote){
|
if(worldObj.isRemote){
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
@ -38,6 +52,33 @@ public class TileLesu extends TileAesu {
|
||||||
}
|
}
|
||||||
if(currentBlocks != connectedBlocks){
|
if(currentBlocks != connectedBlocks){
|
||||||
maxStorage = (connectedBlocks * storgeBlockSize) + baseEU;
|
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);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue