Repository: techreborn/techreborn
Issue: Cannot automatically remove products of Extractor

1.9.4-1.3.2.120-universal Running in 1.10

Cannot automatically remove products of Extractor using any method. 


Changed files:
src/main/java/techreborn/client/gui/GuiExtractor.java, src/main/java/techreborn/client/gui/GuiGrinder.java, src/main/java/techreborn/client/container/ContainerExtractor.java, src/main/java/techreborn/tiles/teir1/TileExtractor.java, src/main/java/techreborn/client/GuiHandler.java

diff --git a/src/main/java/techreborn/client/GuiHandler.java b/src/main/java/techreborn/client/GuiHandler.java
index c5e20c032..7904262be 100644
--- a/src/main/java/techreborn/client/GuiHandler.java
+++ b/src/main/java/techreborn/client/GuiHandler.java
@@ -168,7 +168,7 @@ public class GuiHandler implements IGuiHandler
 			return new ContainerGenerator((TileGenerator) world.getTileEntity(new BlockPos(x, y, z)), player);
 		} else if (ID == extractorID)
 		{
-			return new ContainerExtractor((TileExtractor) world.getTileEntity(new BlockPos(x, y, z)), player);
+			container = new ContainerExtractor();
 		} else if (ID == compressorID)
 		{
 			return new ContainerCompressor((TileCompressor) world.getTileEntity(new BlockPos(x, y, z)), player);
diff --git a/src/main/java/techreborn/client/container/ContainerExtractor.java b/src/main/java/techreborn/client/container/ContainerExtractor.java
index f6385573d..74ad03583 100644
--- a/src/main/java/techreborn/client/container/ContainerExtractor.java
+++ b/src/main/java/techreborn/client/container/ContainerExtractor.java
@@ -1,34 +1,48 @@
 package techreborn.client.container;
 
+import java.util.List;
+
+import javax.annotation.Nullable;
+
 import net.minecraft.entity.player.EntityPlayer;
+import net.minecraft.util.EnumFacing;
+import reborncore.api.tile.IContainerLayout;
 import reborncore.client.gui.BaseSlot;
+import reborncore.client.gui.SlotInput;
 import reborncore.client.gui.SlotOutput;
 import techreborn.api.gui.SlotUpgrade;
 import techreborn.tiles.teir1.TileExtractor;
 
-public class ContainerExtractor extends ContainerCrafting
+public class ContainerExtractor extends ContainerCrafting implements IContainerLayout<TileExtractor>
 {
 
 	public int connectionStatus;
 	EntityPlayer player;
-	TileExtractor tile;
+	TileExtractor tileExtractor;
 
-	public ContainerExtractor(TileExtractor tileGrinder, EntityPlayer player)
+
+	@Override
+	public boolean canInteractWith(EntityPlayer p_75145_1_)
 	{
-		super(tileGrinder.crafter);
-		tile = tileGrinder;
-		this.player = player;
+		return true;
+	}
+
+	@Override
+	public void addInventorySlots() {
 
 		// input
-		this.addSlotToContainer(new BaseSlot(tileGrinder.inventory, 0, 56, 34));
-		this.addSlotToContainer(new SlotOutput(tileGrinder.inventory, 1, 116, 34));
+		this.addSlotToContainer(new SlotInput(tileExtractor.inventory, 0, 56, 34));
+		this.addSlotToContainer(new SlotOutput(tileExtractor.inventory, 1, 116, 34));
 
 		// upgrades
-		this.addSlotToContainer(new SlotUpgrade(tileGrinder.inventory, 2, 152, 8));
-		this.addSlotToContainer(new SlotUpgrade(tileGrinder.inventory, 3, 152, 26));
-		this.addSlotToContainer(new SlotUpgrade(tileGrinder.inventory, 4, 152, 44));
-		this.addSlotToContainer(new SlotUpgrade(tileGrinder.inventory, 5, 152, 62));
+		this.addSlotToContainer(new SlotUpgrade(tileExtractor.inventory, 2, 152, 8));
+		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));		
+	}
 
+	@Override
+	public void addPlayerSlots() {
 		int i;
 
 		for (i = 0; i < 3; ++i)
@@ -46,35 +60,30 @@ public class ContainerExtractor extends ContainerCrafting
 	}
 
 	@Override
-	public boolean canInteractWith(EntityPlayer p_75145_1_)
-	{
-		return true;
+	public void setTile(TileExtractor tile) {
+		this.tileExtractor = tile;
+		setCrafter(tile.crafter);
+	}
+
+	@Override
+	public TileExtractor getTile() {
+		return tileExtractor;
 	}
 
-	// @Override
-	// public void addListener(IContainerListener crafting) {
-	// super.addListener(crafting);
-	// crafting.sendProgressBarUpdate(this, 0, (int) tile.getProgressScaled(0));
-	// crafting.sendProgressBarUpdate(this, 2, (int) tile.getEnergy());
-	// }
-	//
-	// @SideOnly(Side.CLIENT)
-	// @Override
-	// public void updateProgressBar(int id, int value) {
-	// if (id == 0) {
-	// this.progress = value;
-	// }
-	// else if (id == 2) {
-	// this.energy = value;
-	// }
-	// this.tile.setEnergy(energy);
-	// }
-
-	// @SideOnly(Side.CLIENT)
-	// @Override
-	// public void updateProgressBar(int id, int value) {
-	// if (id == 10) {
-	// this.connectionStatus = value;
-	// }
-	// }
+	@Override
+	public void setPlayer(EntityPlayer player) {
+		this.player = player;
+		
+	}
+
+	@Override
+	public EntityPlayer getPlayer() {
+		return player;
+	}
+
+	@Nullable
+	@Override
+	public List<Integer> getSlotsForSide(EnumFacing facing) {
+		return null;
+	}
 }
diff --git a/src/main/java/techreborn/client/gui/GuiExtractor.java b/src/main/java/techreborn/client/gui/GuiExtractor.java
index 1fab87035..310407473 100644
--- a/src/main/java/techreborn/client/gui/GuiExtractor.java
+++ b/src/main/java/techreborn/client/gui/GuiExtractor.java
@@ -5,6 +5,7 @@ import net.minecraft.client.renderer.GlStateManager;
 import net.minecraft.entity.player.EntityPlayer;
 import net.minecraft.util.ResourceLocation;
 import net.minecraft.util.text.translation.I18n;
+import reborncore.common.container.RebornContainer;
 import techreborn.client.container.ContainerExtractor;
 import techreborn.tiles.teir1.TileExtractor;
 
@@ -14,15 +15,15 @@ public class GuiExtractor extends GuiContainer
 	public static final ResourceLocation texture = new ResourceLocation("techreborn", "textures/gui/compressor.png");
 
 	TileExtractor extractor;
-	ContainerExtractor containerGrinder;
+	ContainerExtractor containerExtractor;
 
-	public GuiExtractor(EntityPlayer player, TileExtractor tilegrinder)
+	public GuiExtractor(EntityPlayer player, TileExtractor tileExtractor)
 	{
-		super(new ContainerExtractor(tilegrinder, player));
+		super(RebornContainer.createContainer(ContainerExtractor.class, tileExtractor, player));
 		this.xSize = 176;
 		this.ySize = 167;
-		extractor = tilegrinder;
-		containerGrinder = (ContainerExtractor) this.inventorySlots;
+		this.extractor = tileExtractor;
+		containerExtractor = (ContainerExtractor) this.inventorySlots;
 	}
 
 	@Override
diff --git a/src/main/java/techreborn/client/gui/GuiGrinder.java b/src/main/java/techreborn/client/gui/GuiGrinder.java
index 717f619fb..0e4dbadd5 100644
--- a/src/main/java/techreborn/client/gui/GuiGrinder.java
+++ b/src/main/java/techreborn/client/gui/GuiGrinder.java
@@ -22,7 +22,7 @@ public class GuiGrinder extends GuiContainer
 		super(RebornContainer.createContainer(ContainerGrinder.class, tilegrinder, player));
 		this.xSize = 176;
 		this.ySize = 167;
-		grinder = tilegrinder;
+		this.grinder = tilegrinder;
 		containerGrinder = (ContainerGrinder) this.inventorySlots;
 	}
 
diff --git a/src/main/java/techreborn/tiles/teir1/TileExtractor.java b/src/main/java/techreborn/tiles/teir1/TileExtractor.java
index d7e9976af..cfa374b95 100644
--- a/src/main/java/techreborn/tiles/teir1/TileExtractor.java
+++ b/src/main/java/techreborn/tiles/teir1/TileExtractor.java
@@ -1,6 +1,8 @@
 package techreborn.tiles.teir1;
 
-import reborncore.common.IWrenchable;import reborncore.common.IWrenchable;
+import reborncore.common.IWrenchable;
+import reborncore.common.container.RebornContainer;
+import reborncore.common.IWrenchable;
 import net.minecraft.entity.player.EntityPlayer;
 import net.minecraft.inventory.ISidedInventory;
 import net.minecraft.item.ItemStack;
@@ -8,14 +10,17 @@ import net.minecraft.nbt.NBTTagCompound;
 import net.minecraft.util.EnumFacing;
 import reborncore.api.power.EnumPowerTier;
 import reborncore.api.recipe.IRecipeCrafterProvider;
+import reborncore.api.tile.IContainerProvider;
 import reborncore.api.tile.IInventoryProvider;
 import reborncore.common.powerSystem.TilePowerAcceptor;
 import reborncore.common.recipes.RecipeCrafter;
 import reborncore.common.util.Inventory;
 import techreborn.api.Reference;
+import techreborn.client.container.ContainerExtractor;
+import techreborn.client.container.ContainerGrinder;
 import techreborn.init.ModBlocks;
 
-public class TileExtractor extends TilePowerAcceptor implements IWrenchable,IInventoryProvider, ISidedInventory, IRecipeCrafterProvider
+public class TileExtractor extends TilePowerAcceptor implements IWrenchable,IInventoryProvider, IRecipeCrafterProvider, IContainerProvider
 {
 
 	public Inventory inventory = new Inventory(6, "TileExtractor", 64, this);
@@ -91,27 +96,6 @@ public class TileExtractor extends TilePowerAcceptor implements IWrenchable,IInv
 		return tagCompound;
 	}
 
-	// ISidedInventory
-	@Override
-	public int[] getSlotsForFace(EnumFacing side)
-	{
-		return side == EnumFacing.DOWN ? new int[] { 0, 1, 2 } : new int[] { 0, 1, 2 };
-	}
-
-	@Override
-	public boolean canInsertItem(int slotIndex, ItemStack itemStack, EnumFacing side)
-	{
-		if (slotIndex == 2)
-			return false;
-		return isItemValidForSlot(slotIndex, itemStack);
-	}
-
-	@Override
-	public boolean canExtractItem(int slotIndex, ItemStack itemStack, EnumFacing side)
-	{
-		return slotIndex == 2;
-	}
-
 	public int getProgressScaled(int scale)
 	{
 		if (crafter.currentTickTime != 0)
@@ -166,4 +150,9 @@ public class TileExtractor extends TilePowerAcceptor implements IWrenchable,IInv
 	public RecipeCrafter getRecipeCrafter() {
 		return crafter;
 	}
+
+	@Override
+	public RebornContainer getContainer() {
+		return RebornContainer.getContainerFromClass(ContainerExtractor.class, this);
+	}
 }