Added Industrial Sawmill pokes @modmuss50 to look at the nei handler crash issue bet I did it wrong

This commit is contained in:
Gig 2015-05-11 17:04:27 +01:00
parent 3fe5605de3
commit a8a46352c8
10 changed files with 417 additions and 0 deletions

View file

@ -13,6 +13,7 @@ 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;
@ -31,6 +32,7 @@ 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;
@ -50,6 +52,7 @@ import techreborn.tiles.TileDieselGenerator;
import techreborn.tiles.TileGrinder;
import techreborn.tiles.TileImplosionCompressor;
import techreborn.tiles.TileIndustrialElectrolyzer;
import techreborn.tiles.TileIndustrialSawmill;
import techreborn.tiles.TileLathe;
import techreborn.tiles.TileMatterFabricator;
import techreborn.tiles.TilePlateCuttingMachine;
@ -80,6 +83,7 @@ public class GuiHandler implements IGuiHandler {
public static final int industrialElectrolyzerID = 16;
public static final int aesuID =17;
public static final int alloyFurnaceID = 18;
public static final int sawMillID = 19;
@ -159,6 +163,10 @@ public class GuiHandler implements IGuiHandler {
{
return new ContainerAlloyFurnace(
(TileAlloyFurnace) world.getTileEntity(x, y, z), player);
} else if (ID == sawMillID)
{
return new ContainerIndustrialSawmill(
(TileIndustrialSawmill) world.getTileEntity(x, y, z), player);
} else if (ID == pdaID)
{
return null;
@ -243,6 +251,10 @@ public class GuiHandler implements IGuiHandler {
{
return new GuiAlloyFurnace(player,
(TileAlloyFurnace) world.getTileEntity(x, y, z));
} else if (ID == sawMillID)
{
return new GuiIndustrialSawmill(player,
(TileIndustrialSawmill) world.getTileEntity(x, y, z));
} else if (ID == pdaID)
{
return new GuiPda(player);

View file

@ -0,0 +1,57 @@
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.TileIndustrialSawmill;
public class ContainerIndustrialSawmill extends TechRebornContainer {
EntityPlayer player;
TileIndustrialSawmill tile;
@Override
public boolean canInteractWith(EntityPlayer player)
{
return true;
}
public int tickTime;
public ContainerIndustrialSawmill(TileIndustrialSawmill tileIndustrialSawmill,
EntityPlayer player)
{
tile = tileIndustrialSawmill;
this.player = player;
// input
this.addSlotToContainer(new Slot(tileIndustrialSawmill.inventory, 0, 32, 26));
this.addSlotToContainer(new Slot(tileIndustrialSawmill.inventory, 1, 32, 44));
// outputs
this.addSlotToContainer(new SlotOutput(tileIndustrialSawmill.inventory, 2,84, 35));
this.addSlotToContainer(new SlotOutput(tileIndustrialSawmill.inventory, 3,102, 35));
this.addSlotToContainer(new SlotOutput(tileIndustrialSawmill.inventory, 4,120, 35));
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,61 @@
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.ContainerIndustrialSawmill;
import techreborn.tiles.TileAlloySmelter;
import techreborn.tiles.TileBlastFurnace;
import techreborn.tiles.TileIndustrialSawmill;
public class GuiIndustrialSawmill extends GuiContainer {
private static final ResourceLocation texture = new ResourceLocation(
"techreborn", "textures/gui/industrial_sawmill.png");
TileIndustrialSawmill sawmill;
public GuiIndustrialSawmill(EntityPlayer player,
TileIndustrialSawmill tilesawmill)
{
super(new ContainerIndustrialSawmill(tilesawmill, player));
this.xSize = 176;
this.ySize = 167;
sawmill = tilesawmill;
}
@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.tilesawmill.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);
}
}