From 9af69638e27e583d79862fc156a2813dd8404f67 Mon Sep 17 00:00:00 2001 From: modmuss50 Date: Sat, 5 Nov 2016 10:39:13 +0000 Subject: [PATCH] Fix #793 --- .../java/techreborn/client/GuiHandler.java | 4 +- .../client/container/ContainerExtractor.java | 49 +++++-------------- .../client/container/ContainerGrinder.java | 44 +++++------------ 3 files changed, 27 insertions(+), 70 deletions(-) diff --git a/src/main/java/techreborn/client/GuiHandler.java b/src/main/java/techreborn/client/GuiHandler.java index 537334c7b..7f3425154 100644 --- a/src/main/java/techreborn/client/GuiHandler.java +++ b/src/main/java/techreborn/client/GuiHandler.java @@ -132,11 +132,11 @@ public class GuiHandler implements IGuiHandler { } else if (ID == vacuumFreezerID) { return new ContainerVacuumFreezer((TileVacuumFreezer) world.getTileEntity(new BlockPos(x, y, z)), player); } else if (ID == grinderID) { - container = new ContainerGrinder(); + container = new ContainerGrinder(player, (TileGrinder) world.getTileEntity(new BlockPos(x, y, z))); } else if (ID == generatorID) { return new ContainerGenerator((TileGenerator) world.getTileEntity(new BlockPos(x, y, z)), player); } else if (ID == extractorID) { - container = new ContainerExtractor(); + container = new ContainerExtractor(player, (TileExtractor) world.getTileEntity(new BlockPos(x, y, z))); } else if (ID == compressorID) { return new ContainerCompressor((TileCompressor) world.getTileEntity(new BlockPos(x, y, z)), player); } else if (ID == electricFurnaceID) { diff --git a/src/main/java/techreborn/client/container/ContainerExtractor.java b/src/main/java/techreborn/client/container/ContainerExtractor.java index bea39771c..1045575bd 100644 --- a/src/main/java/techreborn/client/container/ContainerExtractor.java +++ b/src/main/java/techreborn/client/container/ContainerExtractor.java @@ -6,26 +6,22 @@ import reborncore.api.tile.IContainerLayout; import reborncore.client.gui.BaseSlot; import reborncore.client.gui.SlotInput; import reborncore.client.gui.SlotOutput; +import reborncore.common.recipes.RecipeCrafter; import techreborn.api.gui.SlotUpgrade; import techreborn.tiles.teir1.TileExtractor; import javax.annotation.Nullable; import java.util.List; -public class ContainerExtractor extends ContainerCrafting implements IContainerLayout { +public class ContainerExtractor extends ContainerCrafting { - public int connectionStatus; EntityPlayer player; TileExtractor tileExtractor; - @Override - public boolean canInteractWith(EntityPlayer p_75145_1_) { - return true; - } - - @Override - public void addInventorySlots() { - + public ContainerExtractor(EntityPlayer player, TileExtractor tileExtractor) { + super(tileExtractor.crafter); + this.player = player; + this.tileExtractor = tileExtractor; // input this.addSlotToContainer(new SlotInput(tileExtractor.inventory, 0, 56, 34)); this.addSlotToContainer(new SlotOutput(tileExtractor.inventory, 1, 116, 34)); @@ -35,9 +31,15 @@ public class ContainerExtractor extends ContainerCrafting implements IContainerL this.addSlotToContainer(new SlotUpgrade(tileExtractor.inventory, 3, 152, 26)); this.addSlotToContainer(new SlotUpgrade(tileExtractor.inventory, 4, 152, 44)); this.addSlotToContainer(new SlotUpgrade(tileExtractor.inventory, 5, 152, 62)); + + addPlayerSlots(); } @Override + public boolean canInteractWith(EntityPlayer p_75145_1_) { + return true; + } + public void addPlayerSlots() { int i; @@ -52,31 +54,4 @@ public class ContainerExtractor extends ContainerCrafting implements IContainerL } } - @Override - public void setTile(TileExtractor tile) { - this.tileExtractor = tile; - setCrafter(tile.crafter); - } - - @Override - public TileExtractor getTile() { - return tileExtractor; - } - - @Override - public void setPlayer(EntityPlayer player) { - this.player = player; - - } - - @Override - public EntityPlayer getPlayer() { - return player; - } - - @Nullable - @Override - public List getSlotsForSide(EnumFacing facing) { - return null; - } } diff --git a/src/main/java/techreborn/client/container/ContainerGrinder.java b/src/main/java/techreborn/client/container/ContainerGrinder.java index b0457b6a3..ef1fa408f 100644 --- a/src/main/java/techreborn/client/container/ContainerGrinder.java +++ b/src/main/java/techreborn/client/container/ContainerGrinder.java @@ -6,24 +6,32 @@ import reborncore.api.tile.IContainerLayout; import reborncore.client.gui.BaseSlot; import reborncore.client.gui.SlotInput; import reborncore.client.gui.SlotOutput; +import reborncore.common.recipes.RecipeCrafter; import techreborn.api.gui.SlotUpgrade; import techreborn.tiles.teir1.TileGrinder; import javax.annotation.Nullable; import java.util.List; -public class ContainerGrinder extends ContainerCrafting implements IContainerLayout { +public class ContainerGrinder extends ContainerCrafting { public int connectionStatus; EntityPlayer player; TileGrinder tile; + public ContainerGrinder(EntityPlayer player, TileGrinder tile) { + super(tile.crafter); + this.player = player; + this.tile = tile; + addInventorySlots(); + } + @Override public boolean canInteractWith(EntityPlayer p_75145_1_) { return true; } - @Override + public void addInventorySlots() { // input this.addSlotToContainer(new SlotInput(tile.inventory, 0, 56, 34)); @@ -34,9 +42,11 @@ public class ContainerGrinder extends ContainerCrafting implements IContainerLay this.addSlotToContainer(new SlotUpgrade(tile.inventory, 3, 152, 26)); this.addSlotToContainer(new SlotUpgrade(tile.inventory, 4, 152, 44)); this.addSlotToContainer(new SlotUpgrade(tile.inventory, 5, 152, 62)); + + addPlayerSlots(); } - @Override + public void addPlayerSlots() { int i; @@ -51,32 +61,4 @@ public class ContainerGrinder extends ContainerCrafting implements IContainerLay } } - @Override - public void setTile(TileGrinder tile) { - this.tile = tile; - setCrafter(tile.crafter); - } - - @Nullable - @Override - public TileGrinder getTile() { - return tile; - } - - @Override - public void setPlayer(EntityPlayer player) { - this.player = player; - } - - @Nullable - @Override - public EntityPlayer getPlayer() { - return player; - } - - @Nullable - @Override - public List getSlotsForSide(EnumFacing facing) { - return null; - } }