Added Semifluid generator. Suffers from issue #19 as well.

This commit is contained in:
joflashstudios 2015-06-04 23:34:04 -04:00
parent 9b74c5438f
commit 81273e33ad
6 changed files with 426 additions and 1 deletions

View file

@ -23,6 +23,7 @@ import techreborn.client.container.ContainerQuantumChest;
import techreborn.client.container.ContainerQuantumTank;
import techreborn.client.container.ContainerRollingMachine;
import techreborn.client.container.ContainerThermalGenerator;
import techreborn.client.container.ContainerSemifluidGenerator;
import techreborn.client.gui.GuiAesu;
import techreborn.client.gui.GuiAlloyFurnace;
import techreborn.client.gui.GuiAlloySmelter;
@ -43,6 +44,7 @@ import techreborn.client.gui.GuiQuantumChest;
import techreborn.client.gui.GuiQuantumTank;
import techreborn.client.gui.GuiRollingMachine;
import techreborn.client.gui.GuiThermalGenerator;
import techreborn.client.gui.GuiSemifluidGenerator;
import techreborn.pda.GuiPda;
import techreborn.tiles.*;
import cpw.mods.fml.common.network.IGuiHandler;
@ -70,6 +72,7 @@ public class GuiHandler implements IGuiHandler {
public static final int alloyFurnaceID = 18;
public static final int sawMillID = 19;
public static final int chemicalReactorID = 20;
public static final int semifluidGeneratorID = 21;
@ -81,6 +84,10 @@ public class GuiHandler implements IGuiHandler {
{
return new ContainerThermalGenerator(
(TileThermalGenerator) world.getTileEntity(x, y, z), player);
} else if (ID == semifluidGeneratorID)
{
return new ContainerSemifluidGenerator(
(TileSemifluidGenerator) world.getTileEntity(x, y, z), player);
} else if (ID == quantumTankID)
{
return new ContainerQuantumTank(
@ -173,7 +180,12 @@ public class GuiHandler implements IGuiHandler {
{
return new GuiThermalGenerator(player,
(TileThermalGenerator) world.getTileEntity(x, y, z));
} else if (ID == quantumTankID)
} else if (ID == semifluidGeneratorID)
{
return new GuiSemifluidGenerator(player,
(TileSemifluidGenerator) world.getTileEntity(x, y, z));
}
else if (ID == quantumTankID)
{
return new GuiQuantumTank(player,
(TileQuantumTank) world.getTileEntity(x, y, z));

View file

@ -0,0 +1,50 @@
package techreborn.client.container;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.inventory.Slot;
import techreborn.client.SlotFake;
import techreborn.client.SlotOutput;
import techreborn.tiles.TileSemifluidGenerator;
public class ContainerSemifluidGenerator extends TechRebornContainer {
public TileSemifluidGenerator tileSemifluidGenerator;
public EntityPlayer player;
public ContainerSemifluidGenerator(TileSemifluidGenerator tileSemifluidGenerator,
EntityPlayer player)
{
super();
this.tileSemifluidGenerator = tileSemifluidGenerator;
this.player = player;
this.addSlotToContainer(new Slot(tileSemifluidGenerator.inventory, 0, 80,
17));
this.addSlotToContainer(new SlotOutput(tileSemifluidGenerator.inventory,
1, 80, 53));
this.addSlotToContainer(new SlotFake(tileSemifluidGenerator.inventory, 2,
59, 42, false, false, 1));
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, 8 + j * 18, 84 + i * 18));
}
}
for (i = 0; i < 9; ++i)
{
this.addSlotToContainer(new Slot(player.inventory, i, 8 + i * 18,
142));
}
}
@Override
public boolean canInteractWith(EntityPlayer player)
{
return true;
}
}

View file

@ -0,0 +1,49 @@
package techreborn.client.gui;
import net.minecraft.client.gui.inventory.GuiContainer;
import net.minecraft.client.resources.I18n;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.util.ResourceLocation;
import net.minecraft.util.StatCollector;
import techreborn.client.container.ContainerSemifluidGenerator;
import techreborn.tiles.TileSemifluidGenerator;
public class GuiSemifluidGenerator extends GuiContainer {
//TODO: use semifluid generator texture
private static final ResourceLocation texture = new ResourceLocation(
"techreborn", "textures/gui/ThermalGenerator.png");
TileSemifluidGenerator tile;
public GuiSemifluidGenerator(EntityPlayer player, TileSemifluidGenerator tile)
{
super(new ContainerSemifluidGenerator(tile, player));
this.xSize = 176;
this.ySize = 167;
this.tile = tile;
}
@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_)
{
String name = "Semifluid Generator";
this.fontRendererObj.drawString(name, this.xSize / 2 - this.fontRendererObj.getStringWidth(name) / 2, 6, 4210752);
this.fontRendererObj.drawString(
I18n.format("container.inventory", new Object[0]), 8,
this.ySize - 96 + 2, 4210752);
this.fontRendererObj.drawString("Liquid Amount", 10, 20, 16448255);
this.fontRendererObj.drawString(tile.tank.getFluidAmount() + "", 10,
30, 16448255);
}
}