Added gui and buttons to Chunkloader
This commit is contained in:
parent
fed4ea8bd7
commit
1826927149
6 changed files with 72 additions and 4 deletions
|
@ -35,6 +35,16 @@ public class BlockChunkLoader extends BlockMachineBase{
|
|||
return new TileChunkLoader();
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean onBlockActivated(World world, int x, int y, int z,
|
||||
EntityPlayer player, int side, float hitX, float hitY, float hitZ)
|
||||
{
|
||||
if (!player.isSneaking())
|
||||
player.openGui(Core.INSTANCE, GuiHandler.chunkloaderID, world, x, y,
|
||||
z);
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
public void registerBlockIcons(IIconRegister icon)
|
||||
|
|
|
@ -5,6 +5,7 @@ import net.minecraft.world.World;
|
|||
import techreborn.client.container.ContainerAlloySmelter;
|
||||
import techreborn.client.container.ContainerBlastFurnace;
|
||||
import techreborn.client.container.ContainerCentrifuge;
|
||||
import techreborn.client.container.ContainerChunkloader;
|
||||
import techreborn.client.container.ContainerGrinder;
|
||||
import techreborn.client.container.ContainerImplosionCompressor;
|
||||
import techreborn.client.container.ContainerMatterFabricator;
|
||||
|
@ -15,6 +16,7 @@ import techreborn.client.container.ContainerThermalGenerator;
|
|||
import techreborn.client.gui.GuiAlloySmelter;
|
||||
import techreborn.client.gui.GuiBlastFurnace;
|
||||
import techreborn.client.gui.GuiCentrifuge;
|
||||
import techreborn.client.gui.GuiChunkLoader;
|
||||
import techreborn.client.gui.GuiGrinder;
|
||||
import techreborn.client.gui.GuiImplosionCompressor;
|
||||
import techreborn.client.gui.GuiMatterFabricator;
|
||||
|
@ -26,6 +28,7 @@ import techreborn.pda.GuiPda;
|
|||
import techreborn.tiles.TileAlloySmelter;
|
||||
import techreborn.tiles.TileBlastFurnace;
|
||||
import techreborn.tiles.TileCentrifuge;
|
||||
import techreborn.tiles.TileChunkLoader;
|
||||
import techreborn.tiles.TileGrinder;
|
||||
import techreborn.tiles.TileImplosionCompressor;
|
||||
import techreborn.tiles.TileMatterFabricator;
|
||||
|
@ -48,6 +51,7 @@ public class GuiHandler implements IGuiHandler {
|
|||
public static final int compresserID = 8;
|
||||
public static final int matterfabID = 9;
|
||||
public static final int pdaID = 10;
|
||||
public static final int chunkloaderID = 11;
|
||||
|
||||
@Override
|
||||
public Object getServerGuiElement(int ID, EntityPlayer player, World world,
|
||||
|
@ -93,6 +97,10 @@ public class GuiHandler implements IGuiHandler {
|
|||
{
|
||||
return new ContainerMatterFabricator(
|
||||
(TileMatterFabricator) world.getTileEntity(x, y, z), player);
|
||||
} else if (ID == chunkloaderID)
|
||||
{
|
||||
return new ContainerChunkloader(
|
||||
(TileChunkLoader) world.getTileEntity(x, y, z), player);
|
||||
} else if (ID == pdaID)
|
||||
{
|
||||
return null;
|
||||
|
@ -145,7 +153,10 @@ public class GuiHandler implements IGuiHandler {
|
|||
{
|
||||
return new GuiMatterFabricator(player,
|
||||
(TileMatterFabricator) world.getTileEntity(x, y, z));
|
||||
|
||||
} else if (ID == chunkloaderID)
|
||||
{
|
||||
return new GuiChunkLoader(player,
|
||||
(TileChunkLoader) world.getTileEntity(x, y, z));
|
||||
} else if (ID == pdaID)
|
||||
{
|
||||
return new GuiPda(player);
|
||||
|
|
|
@ -2,11 +2,33 @@ package techreborn.client.container;
|
|||
|
||||
import techreborn.tiles.TileChunkLoader;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.inventory.Slot;
|
||||
|
||||
public class ContainerChunkloader extends TechRebornContainer{
|
||||
|
||||
EntityPlayer player;
|
||||
|
||||
|
||||
public ContainerChunkloader(TileChunkLoader tilechunkloader, EntityPlayer player)
|
||||
{
|
||||
this.player = player;
|
||||
|
||||
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));
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
|
|
@ -2,8 +2,10 @@ package techreborn.client.gui;
|
|||
|
||||
import techreborn.client.container.ContainerAlloySmelter;
|
||||
import techreborn.client.container.ContainerChunkloader;
|
||||
import techreborn.pda.GuiButtonCustomTexture;
|
||||
import techreborn.tiles.TileAlloySmelter;
|
||||
import techreborn.tiles.TileChunkLoader;
|
||||
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;
|
||||
|
@ -12,9 +14,14 @@ import net.minecraft.util.ResourceLocation;
|
|||
|
||||
public class GuiChunkLoader extends GuiContainer{
|
||||
|
||||
private GuiButton plusOneButton;
|
||||
private GuiButton plusTenButton;
|
||||
private GuiButton minusOneButton;
|
||||
private GuiButton minusTenButton;
|
||||
|
||||
private static final ResourceLocation texture = new ResourceLocation(
|
||||
"techreborn", "textures/gui/industrial_chunkloader.png");
|
||||
|
||||
|
||||
TileChunkLoader chunkloader;
|
||||
|
||||
public GuiChunkLoader(EntityPlayer player, TileChunkLoader tilechunkloader)
|
||||
|
@ -24,6 +31,24 @@ public class GuiChunkLoader extends GuiContainer{
|
|||
this.ySize = 167;
|
||||
chunkloader = tilechunkloader;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void initGui()
|
||||
{
|
||||
super.initGui();
|
||||
this.guiLeft = this.width / 2 - this.xSize / 2;
|
||||
this.guiTop = this.height / 2 - this.ySize / 2;
|
||||
plusOneButton = new GuiButton(0, guiLeft + 5, guiTop + 37, 40, 20, "+1");
|
||||
plusTenButton = new GuiButton(0, guiLeft + 45, guiTop + 37, 40, 20, "+10");
|
||||
|
||||
minusOneButton = new GuiButton(0, guiLeft + 90, guiTop + 37, 40, 20, "-1");
|
||||
minusTenButton = new GuiButton(0, guiLeft + 130, guiTop + 37, 40, 20, "-10");
|
||||
|
||||
buttonList.add(plusOneButton);
|
||||
buttonList.add(plusTenButton);
|
||||
buttonList.add(minusOneButton);
|
||||
buttonList.add(minusTenButton);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void drawGuiContainerBackgroundLayer(float p_146976_1_,
|
||||
|
@ -38,7 +63,7 @@ public class GuiChunkLoader extends GuiContainer{
|
|||
protected void drawGuiContainerForegroundLayer(int p_146979_1_,
|
||||
int p_146979_2_)
|
||||
{
|
||||
this.fontRendererObj.drawString("Industrial Chunkloader", 60, 6, 4210752);
|
||||
this.fontRendererObj.drawString("Industrial Chunkloader", 30, 6, 4210752);
|
||||
this.fontRendererObj.drawString(
|
||||
I18n.format("container.inventory", new Object[0]), 8,
|
||||
this.ySize - 96 + 2, 4210752);
|
||||
|
|
|
@ -13,7 +13,7 @@ tile.techreborn.blastfurnace.name=Blast Furnace
|
|||
tile.techreborn.matterfabricator.name=Matter Fabricator
|
||||
tile.techreborn.implosioncompressor.name=Implosion Compressor
|
||||
tile.techreborn.grinder.name=Industrial Grinder
|
||||
tile.techreborn.chunkloader.name=Industrial Chunk loader
|
||||
tile.techreborn.chunkloader.name=Industrial Chunkloader
|
||||
|
||||
|
||||
#Ores
|
||||
|
|
Binary file not shown.
After Width: | Height: | Size: 1.7 KiB |
Loading…
Add table
Reference in a new issue