diff --git a/src/main/java/techreborn/blocks/BlockGrinder.java b/src/main/java/techreborn/blocks/BlockGrinder.java index 55a0789dc..ef62b5a28 100644 --- a/src/main/java/techreborn/blocks/BlockGrinder.java +++ b/src/main/java/techreborn/blocks/BlockGrinder.java @@ -2,6 +2,8 @@ package techreborn.blocks; import cpw.mods.fml.relauncher.Side; import cpw.mods.fml.relauncher.SideOnly; +import techreborn.Core; +import techreborn.client.GuiHandler; import techreborn.client.TechRebornCreativeTab; import techreborn.tiles.TileGrinder; import net.minecraft.block.Block; @@ -9,6 +11,7 @@ import net.minecraft.block.BlockContainer; import net.minecraft.block.material.Material; import net.minecraft.client.renderer.texture.IIconRegister; import net.minecraft.entity.EntityLivingBase; +import net.minecraft.entity.player.EntityPlayer; import net.minecraft.item.ItemStack; import net.minecraft.tileentity.TileEntity; import net.minecraft.util.IIcon; @@ -38,6 +41,16 @@ public class BlockGrinder extends BlockMachineBase{ return new TileGrinder(); } + @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.grinderID, world, x, y, + z); + return true; + } + @Override @SideOnly(Side.CLIENT) public void registerBlockIcons(IIconRegister icon) diff --git a/src/main/java/techreborn/blocks/BlockImplosionCompressor.java b/src/main/java/techreborn/blocks/BlockImplosionCompressor.java index 20365fda0..0d8dac25b 100644 --- a/src/main/java/techreborn/blocks/BlockImplosionCompressor.java +++ b/src/main/java/techreborn/blocks/BlockImplosionCompressor.java @@ -2,6 +2,8 @@ package techreborn.blocks; import cpw.mods.fml.relauncher.Side; import cpw.mods.fml.relauncher.SideOnly; +import techreborn.Core; +import techreborn.client.GuiHandler; import techreborn.client.TechRebornCreativeTab; import techreborn.tiles.TileImplosionCompressor; import net.minecraft.block.Block; @@ -9,6 +11,7 @@ import net.minecraft.block.BlockContainer; import net.minecraft.block.material.Material; import net.minecraft.client.renderer.texture.IIconRegister; import net.minecraft.entity.EntityLivingBase; +import net.minecraft.entity.player.EntityPlayer; import net.minecraft.item.ItemStack; import net.minecraft.tileentity.TileEntity; import net.minecraft.util.IIcon; @@ -38,6 +41,16 @@ public class BlockImplosionCompressor extends BlockMachineBase{ return new TileImplosionCompressor(); } + @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.compresserID, world, x, y, + z); + return true; + } + @Override @SideOnly(Side.CLIENT) public void registerBlockIcons(IIconRegister icon) diff --git a/src/main/java/techreborn/blocks/BlockMatterFabricator.java b/src/main/java/techreborn/blocks/BlockMatterFabricator.java index a07ae2882..0414109e4 100644 --- a/src/main/java/techreborn/blocks/BlockMatterFabricator.java +++ b/src/main/java/techreborn/blocks/BlockMatterFabricator.java @@ -2,6 +2,8 @@ package techreborn.blocks; import cpw.mods.fml.relauncher.Side; import cpw.mods.fml.relauncher.SideOnly; +import techreborn.Core; +import techreborn.client.GuiHandler; import techreborn.client.TechRebornCreativeTab; import techreborn.tiles.TileMatterFabricator; import net.minecraft.block.Block; @@ -9,6 +11,7 @@ import net.minecraft.block.BlockContainer; import net.minecraft.block.material.Material; import net.minecraft.client.renderer.texture.IIconRegister; import net.minecraft.entity.EntityLivingBase; +import net.minecraft.entity.player.EntityPlayer; import net.minecraft.item.ItemStack; import net.minecraft.tileentity.TileEntity; import net.minecraft.util.IIcon; @@ -38,6 +41,16 @@ public class BlockMatterFabricator extends BlockMachineBase{ return new TileMatterFabricator(); } + @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.matterfabID, world, x, y, + z); + return true; + } + @Override @SideOnly(Side.CLIENT) public void registerBlockIcons(IIconRegister icon) diff --git a/src/main/java/techreborn/client/GuiHandler.java b/src/main/java/techreborn/client/GuiHandler.java index bfc283e8e..d11dd9f17 100644 --- a/src/main/java/techreborn/client/GuiHandler.java +++ b/src/main/java/techreborn/client/GuiHandler.java @@ -5,6 +5,9 @@ import net.minecraft.world.World; import techreborn.client.container.ContainerAlloySmelter; import techreborn.client.container.ContainerBlastFurnace; import techreborn.client.container.ContainerCentrifuge; +import techreborn.client.container.ContainerGrinder; +import techreborn.client.container.ContainerImplosionCompressor; +import techreborn.client.container.ContainerMatterFabricator; import techreborn.client.container.ContainerQuantumChest; import techreborn.client.container.ContainerQuantumTank; import techreborn.client.container.ContainerRollingMachine; @@ -12,6 +15,9 @@ import techreborn.client.container.ContainerThermalGenerator; import techreborn.client.gui.GuiAlloySmelter; import techreborn.client.gui.GuiBlastFurnace; import techreborn.client.gui.GuiCentrifuge; +import techreborn.client.gui.GuiGrinder; +import techreborn.client.gui.GuiImplosionCompressor; +import techreborn.client.gui.GuiMatterFabricator; import techreborn.client.gui.GuiQuantumChest; import techreborn.client.gui.GuiQuantumTank; import techreborn.client.gui.GuiRollingMachine; @@ -20,6 +26,9 @@ import techreborn.pda.GuiPda; import techreborn.tiles.TileAlloySmelter; import techreborn.tiles.TileBlastFurnace; import techreborn.tiles.TileCentrifuge; +import techreborn.tiles.TileGrinder; +import techreborn.tiles.TileImplosionCompressor; +import techreborn.tiles.TileMatterFabricator; import techreborn.tiles.TileQuantumChest; import techreborn.tiles.TileQuantumTank; import techreborn.tiles.TileRollingMachine; @@ -35,7 +44,10 @@ public class GuiHandler implements IGuiHandler { public static final int rollingMachineID = 4; public static final int blastFurnaceID = 5; public static final int alloySmelterID = 6; - public static final int pdaID = 7; + public static final int grinderID = 7; + public static final int compresserID = 8; + public static final int matterfabID = 9; + public static final int pdaID = 10; @Override public Object getServerGuiElement(int ID, EntityPlayer player, World world, @@ -69,6 +81,18 @@ public class GuiHandler implements IGuiHandler { { return new ContainerAlloySmelter( (TileAlloySmelter) world.getTileEntity(x, y, z), player); + } else if (ID == grinderID) + { + return new ContainerGrinder( + (TileGrinder) world.getTileEntity(x, y, z), player); + } else if (ID == compresserID) + { + return new ContainerImplosionCompressor( + (TileImplosionCompressor) world.getTileEntity(x, y, z), player); + } else if (ID == matterfabID) + { + return new ContainerMatterFabricator( + (TileMatterFabricator) world.getTileEntity(x, y, z), player); } else if (ID == pdaID) { return null; @@ -109,6 +133,19 @@ public class GuiHandler implements IGuiHandler { { return new GuiAlloySmelter(player, (TileAlloySmelter) world.getTileEntity(x, y, z)); + } else if (ID == grinderID) + { + return new GuiGrinder(player, + (TileGrinder) world.getTileEntity(x, y, z)); + } else if (ID == compresserID) + { + return new GuiImplosionCompressor(player, + (TileImplosionCompressor) world.getTileEntity(x, y, z)); + } else if (ID == matterfabID) + { + return new GuiMatterFabricator(player, + (TileMatterFabricator) world.getTileEntity(x, y, z)); + } else if (ID == pdaID) { return new GuiPda(player); diff --git a/src/main/java/techreborn/client/container/ContainerGrinder.java b/src/main/java/techreborn/client/container/ContainerGrinder.java new file mode 100644 index 000000000..ceb296b0f --- /dev/null +++ b/src/main/java/techreborn/client/container/ContainerGrinder.java @@ -0,0 +1,19 @@ +package techreborn.client.container; + +import techreborn.tiles.TileGrinder; +import net.minecraft.entity.player.EntityPlayer; + +public class ContainerGrinder extends TechRebornContainer{ + + public ContainerGrinder(TileGrinder tileEntity, EntityPlayer player) + { + // TODO Auto-generated constructor stub + } + + @Override + public boolean canInteractWith(EntityPlayer p_75145_1_) + { + return true; + } + +} diff --git a/src/main/java/techreborn/client/container/ContainerImplosionCompressor.java b/src/main/java/techreborn/client/container/ContainerImplosionCompressor.java new file mode 100644 index 000000000..14eb13acc --- /dev/null +++ b/src/main/java/techreborn/client/container/ContainerImplosionCompressor.java @@ -0,0 +1,21 @@ +package techreborn.client.container; + +import techreborn.tiles.TileGrinder; +import techreborn.tiles.TileImplosionCompressor; +import net.minecraft.entity.player.EntityPlayer; + +public class ContainerImplosionCompressor extends TechRebornContainer{ + + public ContainerImplosionCompressor(TileImplosionCompressor tilecompresser, + EntityPlayer player) + { + // TODO Auto-generated constructor stub + } + + @Override + public boolean canInteractWith(EntityPlayer p_75145_1_) + { + return true; + } + +} diff --git a/src/main/java/techreborn/client/container/ContainerMatterFabricator.java b/src/main/java/techreborn/client/container/ContainerMatterFabricator.java new file mode 100644 index 000000000..31f8ad304 --- /dev/null +++ b/src/main/java/techreborn/client/container/ContainerMatterFabricator.java @@ -0,0 +1,59 @@ +package techreborn.client.container; + +import techreborn.client.SlotOutput; +import techreborn.tiles.TileAlloySmelter; +import techreborn.tiles.TileMatterFabricator; +import net.minecraft.entity.player.EntityPlayer; +import net.minecraft.inventory.Slot; + +public class ContainerMatterFabricator extends TechRebornContainer{ + + EntityPlayer player; + + TileMatterFabricator tile; + + public int tickTime; + + public ContainerMatterFabricator(TileMatterFabricator tileMatterfab, + EntityPlayer player) + { + tile = tileMatterfab; + this.player = player; + + // input + this.addSlotToContainer(new Slot(tileMatterfab.inventory, 0, 33, 17)); + this.addSlotToContainer(new Slot(tileMatterfab.inventory, 1, 33, 35)); + this.addSlotToContainer(new Slot(tileMatterfab.inventory, 2, 33, 53)); + this.addSlotToContainer(new Slot(tileMatterfab.inventory, 3, 51, 17)); + this.addSlotToContainer(new Slot(tileMatterfab.inventory, 4, 51, 35)); + this.addSlotToContainer(new Slot(tileMatterfab.inventory, 5, 51, 53)); + + // outputs + this.addSlotToContainer(new SlotOutput(tileMatterfab.inventory, 6, + 116, 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)); + } + } + + @Override + public boolean canInteractWith(EntityPlayer p_75145_1_) + { + return true; + } + +} diff --git a/src/main/java/techreborn/client/gui/GuiGrinder.java b/src/main/java/techreborn/client/gui/GuiGrinder.java new file mode 100644 index 000000000..166d0aefd --- /dev/null +++ b/src/main/java/techreborn/client/gui/GuiGrinder.java @@ -0,0 +1,29 @@ +package techreborn.client.gui; + +import techreborn.client.container.ContainerAlloySmelter; +import techreborn.client.container.ContainerGrinder; +import techreborn.tiles.TileAlloySmelter; +import techreborn.tiles.TileGrinder; +import net.minecraft.client.gui.inventory.GuiContainer; +import net.minecraft.entity.player.EntityPlayer; +import net.minecraft.inventory.Container; + +public class GuiGrinder extends GuiContainer{ + + TileGrinder tilegrinder; + + public GuiGrinder(EntityPlayer player, TileGrinder tilegrinder) + { + super(new ContainerGrinder(tilegrinder, player)); + + } + + @Override + protected void drawGuiContainerBackgroundLayer(float p_146976_1_, + int p_146976_2_, int p_146976_3_) + { + // TODO Auto-generated method stub + + } + +} diff --git a/src/main/java/techreborn/client/gui/GuiImplosionCompressor.java b/src/main/java/techreborn/client/gui/GuiImplosionCompressor.java new file mode 100644 index 000000000..eca202ab9 --- /dev/null +++ b/src/main/java/techreborn/client/gui/GuiImplosionCompressor.java @@ -0,0 +1,28 @@ +package techreborn.client.gui; + +import techreborn.client.container.ContainerGrinder; +import techreborn.client.container.ContainerImplosionCompressor; +import techreborn.tiles.TileImplosionCompressor; +import net.minecraft.client.gui.inventory.GuiContainer; +import net.minecraft.entity.player.EntityPlayer; +import net.minecraft.inventory.Container; + +public class GuiImplosionCompressor extends GuiContainer{ + + TileImplosionCompressor tilecompresser; + + public GuiImplosionCompressor(EntityPlayer player, TileImplosionCompressor tilecompresser) + { + super(new ContainerImplosionCompressor(tilecompresser, player)); + + } + + @Override + protected void drawGuiContainerBackgroundLayer(float p_146976_1_, + int p_146976_2_, int p_146976_3_) + { + // TODO Auto-generated method stub + + } + +} diff --git a/src/main/java/techreborn/client/gui/GuiMatterFabricator.java b/src/main/java/techreborn/client/gui/GuiMatterFabricator.java new file mode 100644 index 000000000..5d4fa8a0d --- /dev/null +++ b/src/main/java/techreborn/client/gui/GuiMatterFabricator.java @@ -0,0 +1,48 @@ +package techreborn.client.gui; + +import techreborn.client.container.ContainerImplosionCompressor; +import techreborn.client.container.ContainerMatterFabricator; +import techreborn.tiles.TileImplosionCompressor; +import techreborn.tiles.TileMatterFabricator; +import net.minecraft.client.gui.inventory.GuiContainer; +import net.minecraft.client.resources.I18n; +import net.minecraft.entity.player.EntityPlayer; +import net.minecraft.inventory.Container; +import net.minecraft.util.ResourceLocation; + +public class GuiMatterFabricator extends GuiContainer{ + + private static final ResourceLocation texture = new ResourceLocation( + "techreborn", "textures/gui/matterfabricator.png"); + + TileMatterFabricator matterfab; + + public GuiMatterFabricator(EntityPlayer player, TileMatterFabricator tilematterfab) + { + super(new ContainerMatterFabricator(tilematterfab, player)); + this.xSize = 176; + this.ySize = 167; + matterfab = tilematterfab; + + } + + @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("Matta Fabricator", 60, 6, 4210752); + this.fontRendererObj.drawString( + I18n.format("container.inventory", new Object[0]), 8, + this.ySize - 96 + 2, 4210752); + } + +} diff --git a/src/main/java/techreborn/tiles/TileMatterFabricator.java b/src/main/java/techreborn/tiles/TileMatterFabricator.java index 5f75b3b5f..2adaa7d53 100644 --- a/src/main/java/techreborn/tiles/TileMatterFabricator.java +++ b/src/main/java/techreborn/tiles/TileMatterFabricator.java @@ -11,7 +11,7 @@ public class TileMatterFabricator extends TileMachineBase implements IWrenchable public int tickTime; public BasicSink energy; - public Inventory inventory = new Inventory(5, "TileMatterFabricator", 64); + public Inventory inventory = new Inventory(7, "TileMatterFabricator", 64); @Override diff --git a/src/main/resources/assets/techreborn/textures/gui/matterfabricator.png b/src/main/resources/assets/techreborn/textures/gui/matterfabricator.png new file mode 100644 index 000000000..dd8ea6956 Binary files /dev/null and b/src/main/resources/assets/techreborn/textures/gui/matterfabricator.png differ