Finished the lesu
This commit is contained in:
parent
783765676b
commit
c9c664352c
8 changed files with 484 additions and 78 deletions
|
@ -3,57 +3,12 @@ package techreborn.client;
|
|||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.tileentity.TileEntity;
|
||||
import net.minecraft.world.World;
|
||||
import techreborn.client.container.ContainerAesu;
|
||||
import techreborn.client.container.ContainerAlloyFurnace;
|
||||
import techreborn.client.container.ContainerAlloySmelter;
|
||||
import techreborn.client.container.ContainerAssemblingMachine;
|
||||
import techreborn.client.container.ContainerBlastFurnace;
|
||||
import techreborn.client.container.ContainerCentrifuge;
|
||||
import techreborn.client.container.ContainerChemicalReactor;
|
||||
import techreborn.client.container.ContainerChunkloader;
|
||||
import techreborn.client.container.ContainerDestructoPack;
|
||||
import techreborn.client.container.ContainerDieselGenerator;
|
||||
import techreborn.client.container.ContainerGrinder;
|
||||
import techreborn.client.container.ContainerImplosionCompressor;
|
||||
import techreborn.client.container.ContainerIndustrialElectrolyzer;
|
||||
import techreborn.client.container.ContainerIndustrialSawmill;
|
||||
import techreborn.client.container.ContainerLathe;
|
||||
import techreborn.client.container.ContainerMatterFabricator;
|
||||
import techreborn.client.container.ContainerPlateCuttingMachine;
|
||||
import techreborn.client.container.ContainerQuantumChest;
|
||||
import techreborn.client.container.ContainerQuantumTank;
|
||||
import techreborn.client.container.ContainerDigitalChest;
|
||||
import techreborn.client.container.ContainerRollingMachine;
|
||||
import techreborn.client.container.ContainerThermalGenerator;
|
||||
import techreborn.client.container.ContainerSemifluidGenerator;
|
||||
import techreborn.client.container.ContainerGasTurbine;
|
||||
import techreborn.client.gui.GuiAesu;
|
||||
import techreborn.client.gui.GuiAlloyFurnace;
|
||||
import techreborn.client.gui.GuiAlloySmelter;
|
||||
import techreborn.client.gui.GuiAssemblingMachine;
|
||||
import techreborn.client.gui.GuiBlastFurnace;
|
||||
import techreborn.client.gui.GuiCentrifuge;
|
||||
import techreborn.client.gui.GuiChemicalReactor;
|
||||
import techreborn.client.gui.GuiChunkLoader;
|
||||
import techreborn.client.gui.GuiDestructoPack;
|
||||
import techreborn.client.gui.GuiDieselGenerator;
|
||||
import techreborn.client.gui.GuiGrinder;
|
||||
import techreborn.client.gui.GuiImplosionCompressor;
|
||||
import techreborn.client.gui.GuiIndustrialElectrolyzer;
|
||||
import techreborn.client.gui.GuiIndustrialSawmill;
|
||||
import techreborn.client.gui.GuiLathe;
|
||||
import techreborn.client.gui.GuiMatterFabricator;
|
||||
import techreborn.client.gui.GuiPlateCuttingMachine;
|
||||
import techreborn.client.gui.GuiQuantumChest;
|
||||
import techreborn.client.gui.GuiQuantumTank;
|
||||
import techreborn.client.gui.GuiDigitalChest;
|
||||
import techreborn.client.gui.GuiRollingMachine;
|
||||
import techreborn.client.gui.GuiThermalGenerator;
|
||||
import techreborn.client.gui.GuiSemifluidGenerator;
|
||||
import techreborn.client.gui.GuiGasTurbine;
|
||||
import techreborn.client.container.*;
|
||||
import techreborn.client.gui.*;
|
||||
import techreborn.pda.GuiPda;
|
||||
import techreborn.tiles.*;
|
||||
import cpw.mods.fml.common.network.IGuiHandler;
|
||||
import techreborn.tiles.lesu.TileLesu;
|
||||
|
||||
public class GuiHandler implements IGuiHandler {
|
||||
|
||||
|
@ -82,6 +37,7 @@ public class GuiHandler implements IGuiHandler {
|
|||
public static final int gasTurbineID = 22;
|
||||
public static final int digitalChestID = 23;
|
||||
public static final int destructoPackID = 25;
|
||||
public static final int lesuID = 26;
|
||||
|
||||
@Override
|
||||
public Object getServerGuiElement(int ID, EntityPlayer player, World world,
|
||||
|
@ -184,7 +140,9 @@ public class GuiHandler implements IGuiHandler {
|
|||
return null;
|
||||
} else if (ID == destructoPackID) {
|
||||
return new ContainerDestructoPack(player);
|
||||
}
|
||||
} else if (ID == lesuID) {
|
||||
return new ContainerLesu((TileLesu) world.getTileEntity(x, y, z), player);
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
|
@ -290,7 +248,9 @@ public class GuiHandler implements IGuiHandler {
|
|||
return new GuiPda(player);
|
||||
} else if (ID == destructoPackID) {
|
||||
return new GuiDestructoPack(new ContainerDestructoPack(player));
|
||||
}
|
||||
} else if (ID == lesuID) {
|
||||
return new GuiLesu(player, (TileLesu)world.getTileEntity(x, y, z));
|
||||
}
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
|
102
src/main/java/techreborn/client/container/ContainerLesu.java
Normal file
102
src/main/java/techreborn/client/container/ContainerLesu.java
Normal file
|
@ -0,0 +1,102 @@
|
|||
package techreborn.client.container;
|
||||
|
||||
import cpw.mods.fml.relauncher.Side;
|
||||
import cpw.mods.fml.relauncher.SideOnly;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.inventory.ICrafting;
|
||||
import net.minecraft.inventory.Slot;
|
||||
import techreborn.tiles.lesu.TileLesu;
|
||||
|
||||
public class ContainerLesu extends TechRebornContainer {
|
||||
|
||||
EntityPlayer player;
|
||||
|
||||
TileLesu tile;
|
||||
|
||||
@Override
|
||||
public boolean canInteractWith(EntityPlayer player)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
public int euOut;
|
||||
public int storedEu;
|
||||
public int euChange;
|
||||
public int connectedBlocks;
|
||||
public double euStorage;
|
||||
|
||||
public ContainerLesu(TileLesu tileaesu,
|
||||
EntityPlayer player)
|
||||
{
|
||||
tile = tileaesu;
|
||||
this.player = player;
|
||||
|
||||
// input
|
||||
this.addSlotToContainer(new Slot(tileaesu.inventory, 0, 116, 23));
|
||||
this.addSlotToContainer(new Slot(tileaesu.inventory, 1, 116, 59));
|
||||
|
||||
int i;
|
||||
|
||||
for (i = 0; i < 3; ++i)
|
||||
{
|
||||
for (int j = 0; j < 9; ++j)
|
||||
{
|
||||
this.addSlotToContainer(new Slot(player.inventory, j + i * 9
|
||||
+ 9, 7 + j * 16, 84 + i * 18 + 30));
|
||||
}
|
||||
}
|
||||
|
||||
for (i = 0; i < 9; ++i)
|
||||
{
|
||||
this.addSlotToContainer(new Slot(player.inventory, i, 7 + i * 16,
|
||||
142 + 30));
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void detectAndSendChanges() {
|
||||
super.detectAndSendChanges();
|
||||
for (int i = 0; i < this.crafters.size(); i++) {
|
||||
ICrafting icrafting = (ICrafting)this.crafters.get(i);
|
||||
if(this.euOut != tile.output){
|
||||
icrafting.sendProgressBarUpdate(this, 0, tile.output);
|
||||
}
|
||||
if(this.storedEu != tile.energy){
|
||||
icrafting.sendProgressBarUpdate(this, 1, (int) tile.energy);
|
||||
}
|
||||
if(this.euChange != tile.getEuChange() && tile.getEuChange() != -1){
|
||||
icrafting.sendProgressBarUpdate(this, 2, (int) tile.getEuChange());
|
||||
}
|
||||
if(this.connectedBlocks != tile.connectedBlocks){
|
||||
icrafting.sendProgressBarUpdate(this, 3, tile.connectedBlocks);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void addCraftingToCrafters(ICrafting crafting) {
|
||||
super.addCraftingToCrafters(crafting);
|
||||
crafting.sendProgressBarUpdate(this, 0, tile.output);
|
||||
crafting.sendProgressBarUpdate(this, 1, (int) tile.energy);
|
||||
crafting.sendProgressBarUpdate(this, 2 , (int) tile.getEuChange());
|
||||
crafting.sendProgressBarUpdate(this, 3 , tile.connectedBlocks);
|
||||
}
|
||||
|
||||
@SideOnly(Side.CLIENT)
|
||||
@Override
|
||||
public void updateProgressBar(int id, int value) {
|
||||
if(id == 0){
|
||||
this.euOut = value;
|
||||
} else if(id == 1){
|
||||
this.storedEu = value;
|
||||
} else if(id == 2){
|
||||
this.euChange = value;
|
||||
} else if(id == 3){
|
||||
this.connectedBlocks = value;
|
||||
} else if(id == 4){
|
||||
this.euStorage = value;
|
||||
}
|
||||
this.euStorage = (connectedBlocks * 100000) + 1000000000;
|
||||
}
|
||||
|
||||
}
|
77
src/main/java/techreborn/client/gui/GuiLesu.java
Normal file
77
src/main/java/techreborn/client/gui/GuiLesu.java
Normal file
|
@ -0,0 +1,77 @@
|
|||
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.container.ContainerLesu;
|
||||
import techreborn.packets.PacketAesu;
|
||||
import techreborn.packets.PacketHandler;
|
||||
import techreborn.tiles.TileAesu;
|
||||
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(
|
||||
"techreborn", "textures/gui/aesu.png");
|
||||
|
||||
TileLesu aesu;
|
||||
|
||||
ContainerLesu containerLesu;
|
||||
|
||||
public GuiLesu(EntityPlayer player,
|
||||
TileLesu tileaesu)
|
||||
{
|
||||
super(new ContainerLesu(tileaesu, player));
|
||||
this.xSize = 156;
|
||||
this.ySize = 200;
|
||||
aesu = tileaesu;
|
||||
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_)
|
||||
{
|
||||
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.fontRendererObj.drawString(StatCollector.translateToLocal("tile.techreborn.lesu.name"), 40, 10, Color.WHITE.getRGB());
|
||||
this.fontRendererObj.drawString(containerLesu.euOut + " eu/tick", 10, 20, Color.WHITE.getRGB());
|
||||
this.fontRendererObj.drawString(containerLesu.storedEu + " eu", 10, 30, Color.WHITE.getRGB());
|
||||
this.fontRendererObj.drawString(containerLesu.euChange + " eu change", 10, 40, 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());
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void actionPerformed(GuiButton button) {
|
||||
super.actionPerformed(button);
|
||||
PacketHandler.sendPacketToServer(new PacketAesu(button.id, aesu));
|
||||
}
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue