Added ChemicalReactor

This commit is contained in:
Gig 2015-05-12 00:17:17 +01:00
parent 1de5de9cec
commit a23243cd02
10 changed files with 328 additions and 1 deletions

View file

@ -8,6 +8,7 @@ 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.ContainerDieselGenerator;
import techreborn.client.container.ContainerGrinder;
@ -27,6 +28,7 @@ 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.GuiDieselGenerator;
import techreborn.client.gui.GuiGrinder;
@ -47,6 +49,7 @@ import techreborn.tiles.TileAlloySmelter;
import techreborn.tiles.TileAssemblingMachine;
import techreborn.tiles.TileBlastFurnace;
import techreborn.tiles.TileCentrifuge;
import techreborn.tiles.TileChemicalReactor;
import techreborn.tiles.TileChunkLoader;
import techreborn.tiles.TileDieselGenerator;
import techreborn.tiles.TileGrinder;
@ -84,6 +87,7 @@ public class GuiHandler implements IGuiHandler {
public static final int aesuID =17;
public static final int alloyFurnaceID = 18;
public static final int sawMillID = 19;
public static final int chemicalReactorID = 20;
@ -166,7 +170,11 @@ public class GuiHandler implements IGuiHandler {
} else if (ID == sawMillID)
{
return new ContainerIndustrialSawmill(
(TileIndustrialSawmill) world.getTileEntity(x, y, z), player);
(TileIndustrialSawmill) world.getTileEntity(x, y, z), player);
} else if (ID == chemicalReactorID)
{
return new ContainerChemicalReactor(
(TileChemicalReactor) world.getTileEntity(x, y, z), player);
} else if (ID == pdaID)
{
return null;
@ -255,6 +263,10 @@ public class GuiHandler implements IGuiHandler {
{
return new GuiIndustrialSawmill(player,
(TileIndustrialSawmill) world.getTileEntity(x, y, z));
} else if (ID == chemicalReactorID)
{
return new GuiChemicalReactor(player,
(TileChemicalReactor) world.getTileEntity(x, y, z));
} else if (ID == pdaID)
{
return new GuiPda(player);

View file

@ -0,0 +1,55 @@
package techreborn.client.container;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.inventory.Slot;
import techreborn.client.SlotOutput;
import techreborn.tiles.TileAlloySmelter;
import techreborn.tiles.TileBlastFurnace;
import techreborn.tiles.TileChemicalReactor;
public class ContainerChemicalReactor extends TechRebornContainer {
EntityPlayer player;
TileChemicalReactor tile;
@Override
public boolean canInteractWith(EntityPlayer player)
{
return true;
}
public int tickTime;
public ContainerChemicalReactor(TileChemicalReactor tilechemicalReactor,
EntityPlayer player)
{
tile = tilechemicalReactor;
this.player = player;
// input
this.addSlotToContainer(new Slot(tilechemicalReactor.inventory, 0, 70, 21));
this.addSlotToContainer(new Slot(tilechemicalReactor.inventory, 1, 90, 21));
// outputs
this.addSlotToContainer(new SlotOutput(tilechemicalReactor.inventory, 2, 80, 51));
//TODO battery Slot
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));
}
}
}

View file

@ -0,0 +1,52 @@
package techreborn.client.gui;
import net.minecraft.client.gui.GuiButton;
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.ContainerAlloySmelter;
import techreborn.client.container.ContainerBlastFurnace;
import techreborn.client.container.ContainerChemicalReactor;
import techreborn.tiles.TileAlloySmelter;
import techreborn.tiles.TileBlastFurnace;
import techreborn.tiles.TileChemicalReactor;
public class GuiChemicalReactor extends GuiContainer {
private static final ResourceLocation texture = new ResourceLocation("techreborn", "textures/gui/chemical_reactor.png");
TileChemicalReactor chemicalReactor;
public GuiChemicalReactor(EntityPlayer player, TileChemicalReactor tilechemicalReactor) {
super(new ContainerChemicalReactor(tilechemicalReactor, player));
this.xSize = 176;
this.ySize = 167;
chemicalReactor = tilechemicalReactor;
}
@Override
public void 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 + 4, l + 4, 20, 20, "R"));
super.initGui();
}
@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 = StatCollector.translateToLocal("tile.techreborn.chemicalReactor.name");
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);
}
}