Hey everybody, I decided to make this tutorial because I got stuck here for around two days. It sucked. Anyway, so have you ever wanted to make a custom furnace or custom crafting table? Well there are tons of tutorials out there for that, but when you're done, there's a chance that your going to get stuck with you can't actually pick up the items in the inventory. The secret is in your Guihandler class or your proxy class, depending on where you register Gui's. As per usual you have the
@Override
public Object getClientGuiElement(int ID, EntityPlayer player, World world,
int x, int y, int z) {
switch (ID) {
case 0:
return new GuiLiquidator(player.inventory, (TileEntityLiquidator)world.getBlockTileEntity(x, y, z));
}
return null;
}
But due to the fact that it's a container aswell, you have to have this
package siramnot.mods.dmi;
import siramnot.mods.dmi.blocks.tileeents.TileEntityLiquidator;
import siramnot.mods.dmi.gui.ContainerLiquidator;
import siramnot.mods.dmi.gui.GuiLiquidator;
import net.minecraft.client.gui.inventory.GuiFurnace;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.world.World;
import cpw.mods.fml.common.network.IGuiHandler;
import net.minecraft.tileentity.*;
public class GuiHandler implements IGuiHandler {
@Override
public Object getServerGuiElement(int ID, EntityPlayer player, World world,
int x, int y, int z) {
switch (ID) {
case 0:
return new ContainerLiquidator(player.inventory, (TileEntityLiquidator)world.getBlockTileEntity(x, y, z));
}
// TODO Auto-generated method stub
return null;
}
@Override
public Object getClientGuiElement(int ID, EntityPlayer player, World world,
int x, int y, int z) {
switch (ID) {
case 0:
return new GuiLiquidator(player.inventory, (TileEntityLiquidator)world.getBlockTileEntity(x, y, z));
}
return null;
}
}
But due to the fact that it's a container aswell, you have to have this