Jump to content

[SOLVED][1.8] Help with Custom Crafting Table that holds items inside its slots


Recommended Posts

Posted

The game keeps on crashing every time I try to open up the GUI for the custom crafting table that has a tile entity (since it has a custom design). Here is my code:

 

TileEntity

public class BlockNileWorkbench extends BlockContainer{


public BlockNileWorkbench() {
	super(Material.wood);
	this.setCreativeTab(ZeroQuest.ZeroTab);
	this.setHardness(2F);
	this.setResistance(12.5F);
	this.setStepSound(soundTypeWood);
}
    private Random rand = new Random();

    @Override
public TileEntity createNewTileEntity(World world, int par1) {
	return new TileEntityNileWorkbench();
}

    @Override
public int getRenderType(){ //RenderBlocks for Render type//
	return -1;		
}
    
    @Override
public boolean isOpaqueCube(){
	return false;		
}
    
    @Override
    public boolean onBlockActivated(World worldIn, BlockPos pos, IBlockState state, EntityPlayer playerIn, EnumFacing side, float hitX, float hitY, float hitZ)
    {
        if (worldIn.isRemote)
        {
            return true;
        }
        else
        {
            TileEntity tileentity = worldIn.getTileEntity(pos);

            if (tileentity instanceof TileEntityNileWorkbench)
            {
                playerIn.displayGUIChest((TileEntityNileWorkbench)tileentity);
            }

            return true;
        }
    }
    
    public void breakBlock(World worldIn, BlockPos pos, IBlockState state)
    {
        TileEntity tileentity = worldIn.getTileEntity(pos);

        if (tileentity instanceof IInventory)
        {
            InventoryHelper.dropInventoryItems(worldIn, pos, (IInventory)tileentity);
            worldIn.updateComparatorOutputLevel(pos, this);
        }

        super.breakBlock(worldIn, pos, state);
    }
}

 

Container

public class BlockNileWorkbench extends BlockContainer{


public BlockNileWorkbench() {
	super(Material.wood);
	this.setCreativeTab(ZeroQuest.ZeroTab);
	this.setHardness(2F);
	this.setResistance(12.5F);
	this.setStepSound(soundTypeWood);
}
    private Random rand = new Random();

    @Override
public TileEntity createNewTileEntity(World world, int par1) {
	return new TileEntityNileWorkbench();
}

    @Override
public int getRenderType(){ //RenderBlocks for Render type//
	return -1;		
}
    
    @Override
public boolean isOpaqueCube(){
	return false;		
}
    
    @Override
    public boolean onBlockActivated(World worldIn, BlockPos pos, IBlockState state, EntityPlayer playerIn, EnumFacing side, float hitX, float hitY, float hitZ)
    {
        if (worldIn.isRemote)
        {
            return true;
        }
        else
        {
            TileEntity tileentity = worldIn.getTileEntity(pos);

            if (tileentity instanceof TileEntityNileWorkbench)
            {
                playerIn.displayGUIChest((TileEntityNileWorkbench)tileentity);
            }

            return true;
        }
    }
    
    public void breakBlock(World worldIn, BlockPos pos, IBlockState state)
    {
        TileEntity tileentity = worldIn.getTileEntity(pos);

        if (tileentity instanceof IInventory)
        {
            InventoryHelper.dropInventoryItems(worldIn, pos, (IInventory)tileentity);
            worldIn.updateComparatorOutputLevel(pos, this);
        }

        super.breakBlock(worldIn, pos, state);
    }
}

 

GUI

public class BlockNileWorkbench extends BlockContainer{


public BlockNileWorkbench() {
	super(Material.wood);
	this.setCreativeTab(ZeroQuest.ZeroTab);
	this.setHardness(2F);
	this.setResistance(12.5F);
	this.setStepSound(soundTypeWood);
}
    private Random rand = new Random();

    @Override
public TileEntity createNewTileEntity(World world, int par1) {
	return new TileEntityNileWorkbench();
}

    @Override
public int getRenderType(){ //RenderBlocks for Render type//
	return -1;		
}
    
    @Override
public boolean isOpaqueCube(){
	return false;		
}
    
    @Override
    public boolean onBlockActivated(World worldIn, BlockPos pos, IBlockState state, EntityPlayer playerIn, EnumFacing side, float hitX, float hitY, float hitZ)
    {
        if (worldIn.isRemote)
        {
            return true;
        }
        else
        {
            TileEntity tileentity = worldIn.getTileEntity(pos);

            if (tileentity instanceof TileEntityNileWorkbench)
            {
                playerIn.displayGUIChest((TileEntityNileWorkbench)tileentity);
            }

            return true;
        }
    }
    
    public void breakBlock(World worldIn, BlockPos pos, IBlockState state)
    {
        TileEntity tileentity = worldIn.getTileEntity(pos);

        if (tileentity instanceof IInventory)
        {
            InventoryHelper.dropInventoryItems(worldIn, pos, (IInventory)tileentity);
            worldIn.updateComparatorOutputLevel(pos, this);
        }

        super.breakBlock(worldIn, pos, state);
    }
}

 

Block

public class BlockNileWorkbench extends BlockContainer{


public BlockNileWorkbench() {
	super(Material.wood);
	this.setCreativeTab(ZeroQuest.ZeroTab);
	this.setHardness(2F);
	this.setResistance(12.5F);
	this.setStepSound(soundTypeWood);
}
    private Random rand = new Random();

    @Override
public TileEntity createNewTileEntity(World world, int par1) {
	return new TileEntityNileWorkbench();
}

    @Override
public int getRenderType(){ //RenderBlocks for Render type//
	return -1;		
}
    
    @Override
public boolean isOpaqueCube(){
	return false;		
}
    
    @Override
    public boolean onBlockActivated(World worldIn, BlockPos pos, IBlockState state, EntityPlayer playerIn, EnumFacing side, float hitX, float hitY, float hitZ)
    {
        if (worldIn.isRemote)
        {
            return true;
        }
        else
        {
            TileEntity tileentity = worldIn.getTileEntity(pos);

            if (tileentity instanceof TileEntityNileWorkbench)
            {
                playerIn.displayGUIChest((TileEntityNileWorkbench)tileentity);
            }

            return true;
        }
    }
    
    public void breakBlock(World worldIn, BlockPos pos, IBlockState state)
    {
        TileEntity tileentity = worldIn.getTileEntity(pos);

        if (tileentity instanceof IInventory)
        {
            InventoryHelper.dropInventoryItems(worldIn, pos, (IInventory)tileentity);
            worldIn.updateComparatorOutputLevel(pos, this);
        }

        super.breakBlock(worldIn, pos, state);
    }
}

 

Here is the error log

 

[17:09:43] [Client thread/FATAL] [FML]: Exception caught executing FutureTask: java.util.concurrent.ExecutionException: java.lang.NullPointerException

java.util.concurrent.ExecutionException: java.lang.NullPointerException

at java.util.concurrent.FutureTask.report(Unknown Source) ~[?:1.8.0_25]

at java.util.concurrent.FutureTask.get(Unknown Source) ~[?:1.8.0_25]

at net.minecraftforge.fml.common.FMLCommonHandler.callFuture(FMLCommonHandler.java:677) [FMLCommonHandler.class:?]

at net.minecraft.client.Minecraft.runGameLoop(Minecraft.java:1011) [Minecraft.class:?]

at net.minecraft.client.Minecraft.run(Minecraft.java:345) [Minecraft.class:?]

at net.minecraft.client.main.Main.main(Main.java:117) [Main.class:?]

at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) ~[?:1.8.0_25]

at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source) ~[?:1.8.0_25]

at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source) ~[?:1.8.0_25]

at java.lang.reflect.Method.invoke(Unknown Source) ~[?:1.8.0_25]

at net.minecraft.launchwrapper.Launch.launch(Launch.java:135) [launchwrapper-1.11.jar:?]

at net.minecraft.launchwrapper.Launch.main(Launch.java:28) [launchwrapper-1.11.jar:?]

at net.minecraftforge.gradle.GradleStartCommon.launch(GradleStartCommon.java:78) [start/:?]

at GradleStart.main(GradleStart.java:45) [start/:?]

Caused by: java.lang.NullPointerException

at net.minecraft.inventory.InventoryBasic.<init>(InventoryBasic.java:33) ~[inventoryBasic.class:?]

at net.minecraft.client.network.NetHandlerPlayClient.handleOpenWindow(NetHandlerPlayClient.java:981) ~[NetHandlerPlayClient.class:?]

at net.minecraft.network.play.server.S2DPacketOpenWindow.processPacket(S2DPacketOpenWindow.java:44) ~[s2DPacketOpenWindow.class:?]

at net.minecraft.network.play.server.S2DPacketOpenWindow.processPacket(S2DPacketOpenWindow.java:81) ~[s2DPacketOpenWindow.class:?]

at net.minecraft.network.PacketThreadUtil$1.run(PacketThreadUtil.java:18) ~[PacketThreadUtil$1.class:?]

at java.util.concurrent.Executors$RunnableAdapter.call(Unknown Source) ~[?:1.8.0_25]

at java.util.concurrent.FutureTask.run(Unknown Source) ~[?:1.8.0_25]

at net.minecraftforge.fml.common.FMLCommonHandler.callFuture(FMLCommonHandler.java:676) ~[FMLCommonHandler.class:?]

... 11 more

[17:09:43] [server thread/FATAL] [FML]: Exception caught executing FutureTask: java.util.concurrent.ExecutionException: net.minecraft.util.ReportedException: Ticking player

java.util.concurrent.ExecutionException: net.minecraft.util.ReportedException: Ticking player

at java.util.concurrent.FutureTask.report(Unknown Source) ~[?:1.8.0_25]

at java.util.concurrent.FutureTask.get(Unknown Source) ~[?:1.8.0_25]

at net.minecraftforge.fml.common.FMLCommonHandler.callFuture(FMLCommonHandler.java:677) [FMLCommonHandler.class:?]

at net.minecraft.server.MinecraftServer.updateTimeLightAndEntities(MinecraftServer.java:655) [MinecraftServer.class:?]

at net.minecraft.server.MinecraftServer.tick(MinecraftServer.java:598) [MinecraftServer.class:?]

at net.minecraft.server.integrated.IntegratedServer.tick(IntegratedServer.java:164) [integratedServer.class:?]

at net.minecraft.server.MinecraftServer.run(MinecraftServer.java:478) [MinecraftServer.class:?]

at java.lang.Thread.run(Unknown Source) [?:1.8.0_25]

Caused by: net.minecraft.util.ReportedException: Ticking player

at net.minecraft.entity.player.EntityPlayerMP.onUpdateEntity(EntityPlayerMP.java:394) ~[EntityPlayerMP.class:?]

at net.minecraft.network.NetHandlerPlayServer.processPlayer(NetHandlerPlayServer.java:326) ~[NetHandlerPlayServer.class:?]

at net.minecraft.network.play.client.C03PacketPlayer.processPacket(C03PacketPlayer.java:33) ~[C03PacketPlayer.class:?]

at net.minecraft.network.play.client.C03PacketPlayer.processPacket(C03PacketPlayer.java:93) ~[C03PacketPlayer.class:?]

at net.minecraft.network.PacketThreadUtil$1.run(PacketThreadUtil.java:18) ~[PacketThreadUtil$1.class:?]

at java.util.concurrent.Executors$RunnableAdapter.call(Unknown Source) ~[?:1.8.0_25]

at java.util.concurrent.FutureTask.run(Unknown Source) ~[?:1.8.0_25]

at net.minecraftforge.fml.common.FMLCommonHandler.callFuture(FMLCommonHandler.java:676) ~[FMLCommonHandler.class:?]

... 5 more

Caused by: java.lang.NullPointerException

at net.minecraft.world.World.isValid(World.java:216) ~[World.class:?]

at net.minecraft.world.World.getTileEntity(World.java:2253) ~[World.class:?]

at common.zeroquest.tileentity.TileEntityNileWorkbench.isUseableByPlayer(TileEntityNileWorkbench.java:110) ~[TileEntityNileWorkbench.class:?]

at net.minecraft.inventory.ContainerChest.canInteractWith(ContainerChest.java:45) ~[ContainerChest.class:?]

at net.minecraftforge.event.entity.player.PlayerOpenContainerEvent.<init>(PlayerOpenContainerEvent.java:27) ~[PlayerOpenContainerEvent.class:?]

at net.minecraftforge.common.ForgeHooks.canInteractWith(ForgeHooks.java:487) ~[ForgeHooks.class:?]

at net.minecraft.entity.player.EntityPlayer.onUpdate(EntityPlayer.java:295) ~[EntityPlayer.class:?]

at net.minecraft.entity.player.EntityPlayerMP.onUpdateEntity(EntityPlayerMP.java:340) ~[EntityPlayerMP.class:?]

at net.minecraft.network.NetHandlerPlayServer.processPlayer(NetHandlerPlayServer.java:326) ~[NetHandlerPlayServer.class:?]

at net.minecraft.network.play.client.C03PacketPlayer.processPacket(C03PacketPlayer.java:33) ~[C03PacketPlayer.class:?]

at net.minecraft.network.play.client.C03PacketPlayer.processPacket(C03PacketPlayer.java:93) ~[C03PacketPlayer.class:?]

at net.minecraft.network.PacketThreadUtil$1.run(PacketThreadUtil.java:18) ~[PacketThreadUtil$1.class:?]

at java.util.concurrent.Executors$RunnableAdapter.call(Unknown Source) ~[?:1.8.0_25]

at java.util.concurrent.FutureTask.run(Unknown Source) ~[?:1.8.0_25]

at net.minecraftforge.fml.common.FMLCommonHandler.callFuture(FMLCommonHandler.java:676) ~[FMLCommonHandler.class:?]

... 5 more

[17:09:43] [server thread/ERROR]: Encountered an unexpected exception

net.minecraft.util.ReportedException: Ticking entity

at net.minecraft.server.MinecraftServer.updateTimeLightAndEntities(MinecraftServer.java:709) ~[MinecraftServer.class:?]

at net.minecraft.server.MinecraftServer.tick(MinecraftServer.java:598) ~[MinecraftServer.class:?]

at net.minecraft.server.integrated.IntegratedServer.tick(IntegratedServer.java:164) ~[integratedServer.class:?]

at net.minecraft.server.MinecraftServer.run(MinecraftServer.java:478) [MinecraftServer.class:?]

at java.lang.Thread.run(Unknown Source) [?:1.8.0_25]

Caused by: java.lang.NullPointerException

at net.minecraft.world.World.isValid(World.java:216) ~[World.class:?]

at net.minecraft.world.World.getTileEntity(World.java:2253) ~[World.class:?]

at common.zeroquest.tileentity.TileEntityNileWorkbench.isUseableByPlayer(TileEntityNileWorkbench.java:110) ~[TileEntityNileWorkbench.class:?]

at net.minecraft.inventory.ContainerChest.canInteractWith(ContainerChest.java:45) ~[ContainerChest.class:?]

at net.minecraftforge.event.entity.player.PlayerOpenContainerEvent.<init>(PlayerOpenContainerEvent.java:27) ~[PlayerOpenContainerEvent.class:?]

at net.minecraftforge.common.ForgeHooks.canInteractWith(ForgeHooks.java:487) ~[ForgeHooks.class:?]

at net.minecraft.entity.player.EntityPlayerMP.onUpdate(EntityPlayerMP.java:231) ~[EntityPlayerMP.class:?]

at net.minecraft.world.World.updateEntityWithOptionalForce(World.java:1865) ~[World.class:?]

at net.minecraft.world.WorldServer.updateEntityWithOptionalForce(WorldServer.java:732) ~[WorldServer.class:?]

at net.minecraft.world.World.updateEntity(World.java:1835) ~[World.class:?]

at net.minecraft.world.World.updateEntities(World.java:1664) ~[World.class:?]

at net.minecraft.world.WorldServer.updateEntities(WorldServer.java:571) ~[WorldServer.class:?]

at net.minecraft.server.MinecraftServer.updateTimeLightAndEntities(MinecraftServer.java:703) ~[MinecraftServer.class:?]

... 4 more

[17:09:44] [server thread/ERROR]: This crash report has been saved to: C:\Users\NovaPC\Desktop\ModStuff\Code1.8\eclipse\.\crash-reports\crash-2014-12-30_17.09.43-server.txt

[17:09:44] [server thread/INFO]: Stopping server

[17:09:44] [server thread/INFO]: Saving players

[17:09:44] [Client thread/INFO] [sTDOUT]: [net.minecraft.init.Bootstrap:printToSYSOUT:568]: ---- Minecraft Crash Report ----

// I just don't know what went wrong :(

 

Time: 12/30/14 5:09 PM

Description: Ticking entity

 

java.lang.NullPointerException: Ticking entity

at net.minecraft.world.World.isValid(World.java:216)

at net.minecraft.world.World.getTileEntity(World.java:2253)

at common.zeroquest.tileentity.TileEntityNileWorkbench.isUseableByPlayer(TileEntityNileWorkbench.java:110)

at net.minecraft.inventory.ContainerChest.canInteractWith(ContainerChest.java:45)

at net.minecraftforge.event.entity.player.PlayerOpenContainerEvent.<init>(PlayerOpenContainerEvent.java:27)

at net.minecraftforge.common.ForgeHooks.canInteractWith(ForgeHooks.java:487)

at net.minecraft.entity.player.EntityPlayerMP.onUpdate(EntityPlayerMP.java:231)

at net.minecraft.world.World.updateEntityWithOptionalForce(World.java:1865)

at net.minecraft.world.WorldServer.updateEntityWithOptionalForce(WorldServer.java:732)

at net.minecraft.world.World.updateEntity(World.java:1835)

at net.minecraft.world.World.updateEntities(World.java:1664)

at net.minecraft.world.WorldServer.updateEntities(WorldServer.java:571)

at net.minecraft.server.MinecraftServer.updateTimeLightAndEntities(MinecraftServer.java:703)

at net.minecraft.server.MinecraftServer.tick(MinecraftServer.java:598)

at net.minecraft.server.integrated.IntegratedServer.tick(IntegratedServer.java:164)

at net.minecraft.server.MinecraftServer.run(MinecraftServer.java:478)

at java.lang.Thread.run(Unknown Source)

 

 

A detailed walkthrough of the error, its code path and all known details is as follows:

---------------------------------------------------------------------------------------

 

-- Head --

Stacktrace:

at net.minecraft.world.World.isValid(World.java:216)

at net.minecraft.world.World.getTileEntity(World.java:2253)

at common.zeroquest.tileentity.TileEntityNileWorkbench.isUseableByPlayer(TileEntityNileWorkbench.java:110)

at net.minecraft.inventory.ContainerChest.canInteractWith(ContainerChest.java:45)

at net.minecraftforge.event.entity.player.PlayerOpenContainerEvent.<init>(PlayerOpenContainerEvent.java:27)

at net.minecraftforge.common.ForgeHooks.canInteractWith(ForgeHooks.java:487)

at net.minecraft.entity.player.EntityPlayerMP.onUpdate(EntityPlayerMP.java:231)

at net.minecraft.world.World.updateEntityWithOptionalForce(World.java:1865)

at net.minecraft.world.WorldServer.updateEntityWithOptionalForce(WorldServer.java:732)

at net.minecraft.world.World.updateEntity(World.java:1835)

 

-- Entity being ticked --

Details:

Entity Type: null (net.minecraft.entity.player.EntityPlayerMP)

Entity ID: 173

Entity Name: Player442

Entity's Exact location: -40.87, 64.00, -13.97

Entity's Block location: -41.00,64.00,-14.00 - World: (-41,64,-14), Chunk: (at 7,4,2 in -3,-1; contains blocks -48,0,-16 to -33,255,-1), Region: (-1,-1; contains chunks -32,-32 to -1,-1, blocks -512,0,-512 to -1,255,-1)

Entity's Momentum: 0.00, -0.08, 0.00

Entity's Rider: ~~ERROR~~ NullPointerException: null

Entity's Vehicle: ~~ERROR~~ NullPointerException: null

Stacktrace:

at net.minecraft.world.World.updateEntities(World.java:1664)

at net.minecraft.world.WorldServer.updateEntities(WorldServer.java:571)

 

 

 

Also, I have the 1.7.10 Code posted up on Github: https://github.com/NViper21/ZeroQuest

Main Developer and Owner of Zero Quest

Visit the Wiki for more information

If I helped anyone, please give me a applaud and a thank you!

Posted

Oops, my bad! Here are the classes

 

Block

public class BlockNileWorkbench extends BlockContainer{


public BlockNileWorkbench() {
	super(Material.wood);
	this.setCreativeTab(ZeroQuest.ZeroTab);
	this.setHardness(2F);
	this.setResistance(12.5F);
	this.setStepSound(soundTypeWood);
}
    private Random rand = new Random();

    @Override
public TileEntity createNewTileEntity(World world, int par1) {
	return new TileEntityNileWorkbench();
}

    @Override
public int getRenderType(){ //RenderBlocks for Render type//
	return -1;		
}
    
    @Override
public boolean isOpaqueCube(){
	return false;		
}
    
    @Override
    public boolean onBlockActivated(World worldIn, BlockPos pos, IBlockState state, EntityPlayer playerIn, EnumFacing side, float hitX, float hitY, float hitZ)
    {
        if (worldIn.isRemote)
        {
            return true;
        }
        else
        {
            TileEntity tileentity = worldIn.getTileEntity(pos);

            if (tileentity instanceof TileEntityNileWorkbench)
            {
                playerIn.displayGUIChest((TileEntityNileWorkbench)tileentity);
            }

            return true;
        }
    }
    
    public void breakBlock(World worldIn, BlockPos pos, IBlockState state)
    {
        TileEntity tileentity = worldIn.getTileEntity(pos);

        if (tileentity instanceof IInventory)
        {
            InventoryHelper.dropInventoryItems(worldIn, pos, (IInventory)tileentity);
            worldIn.updateComparatorOutputLevel(pos, this);
        }

        super.breakBlock(worldIn, pos, state);
    }
}

 

Container

public class ContainerNileWorkbench extends Container
{
    public InventoryCrafting craftMatrix = new InventoryCrafting(this, 3, 3);
    public IInventory craftResult = new InventoryCraftResult();
    private World worldObj;
    private BlockPos field_178145_h;
    private static final String __OBFID = "CL_00001744";

    public ContainerNileWorkbench(InventoryPlayer playerInventory, IInventory inven, World worldIn, BlockPos p_i45800_3_)
    {
        this.worldObj = worldIn;
        this.field_178145_h = p_i45800_3_;
        this.addSlotToContainer(new SlotCrafting(playerInventory.player, this.craftMatrix, this.craftResult, 0, 124, 35));
        int i;
        int j;

        for (i = 0; i < 3; ++i)
        {
            for (j = 0; j < 3; ++j)
            {
                this.addSlotToContainer(new Slot(this.craftMatrix, j + i * 3, 30 + j * 18, 17 + i * 18));
            }
        }

        for (i = 0; i < 3; ++i)
        {
            for (j = 0; j < 9; ++j)
            {
                this.addSlotToContainer(new Slot(playerInventory, j + i * 9 + 9, 8 + j * 18, 84 + i * 18));
            }
        }

        for (i = 0; i < 9; ++i)
        {
            this.addSlotToContainer(new Slot(playerInventory, i, 8 + i * 18, 142));
        }

        this.onCraftMatrixChanged(this.craftMatrix);
    }

    public void onCraftMatrixChanged(IInventory inventoryIn)
    {
        this.craftResult.setInventorySlotContents(0, CraftingManager.getInstance().findMatchingRecipe(this.craftMatrix, this.worldObj));
    }

    public void onContainerClosed(EntityPlayer playerIn)
    {
        super.onContainerClosed(playerIn);

        if (!this.worldObj.isRemote)
        {
            for (int i = 0; i < 9; ++i)
            {
                ItemStack itemstack = this.craftMatrix.getStackInSlotOnClosing(i);

                if (itemstack != null)
                {
                    playerIn.dropPlayerItemWithRandomChoice(itemstack, false);
                }
            }
        }
    }

    public boolean canInteractWith(EntityPlayer playerIn)
    {
        return this.worldObj.getBlockState(this.field_178145_h).getBlock() != Blocks.crafting_table ? false : playerIn.getDistanceSq((double)this.field_178145_h.getX() + 0.5D, (double)this.field_178145_h.getY() + 0.5D, (double)this.field_178145_h.getZ() + 0.5D) <= 64.0D;
    }

    public ItemStack transferStackInSlot(EntityPlayer playerIn, int index)
    {
        ItemStack itemstack = null;
        Slot slot = (Slot)this.inventorySlots.get(index);

        if (slot != null && slot.getHasStack())
        {
            ItemStack itemstack1 = slot.getStack();
            itemstack = itemstack1.copy();

            if (index == 0)
            {
                if (!this.mergeItemStack(itemstack1, 10, 46, true))
                {
                    return null;
                }

                slot.onSlotChange(itemstack1, itemstack);
            }
            else if (index >= 10 && index < 37)
            {
                if (!this.mergeItemStack(itemstack1, 37, 46, false))
                {
                    return null;
                }
            }
            else if (index >= 37 && index < 46)
            {
                if (!this.mergeItemStack(itemstack1, 10, 37, false))
                {
                    return null;
                }
            }
            else if (!this.mergeItemStack(itemstack1, 10, 46, false))
            {
                return null;
            }

            if (itemstack1.stackSize == 0)
            {
                slot.putStack((ItemStack)null);
            }
            else
            {
                slot.onSlotChanged();
            }

            if (itemstack1.stackSize == itemstack.stackSize)
            {
                return null;
            }

            slot.onPickupFromSlot(playerIn, itemstack1);
        }

        return itemstack;
    }

    public boolean canMergeSlot(ItemStack p_94530_1_, Slot p_94530_2_)
    {
        return p_94530_2_.inventory != this.craftResult && super.canMergeSlot(p_94530_1_, p_94530_2_);
    }
}

 

Gui

@SideOnly(Side.CLIENT)
public class GuiNileWorkbench extends GuiContainer{

private static final ResourceLocation field_110422_t = new ResourceLocation(ZeroQuest.modid + ":" + "textures/gui/niletable.png");
    private IInventory tileTable;
    private final InventoryPlayer playerInventory;
    
    public GuiNileWorkbench(InventoryPlayer playerInv , IInventory furnaceInv, World worldIn, BlockPos blockPosition)
    {
        super(new ContainerNileWorkbench(playerInv, furnaceInv, worldIn, blockPosition));
        this.playerInventory = playerInv;
        this.tileTable = furnaceInv;
    }

/**
         * Draw the foreground layer for the GuiContainer (everything in front of the items)
         */
@Override
protected void drawGuiContainerForegroundLayer(int x, int z)	
{
         this.fontRendererObj.drawString(StatCollector.translateToLocal("Crafting"), 30, 6, 4210752);
         this.fontRendererObj.drawString(I18n.format("container.inventory", new Object[0]), 8, this.ySize - 96 + 2, 4210752);
}
/**
         * Draw the background layer for the GuiContainer (everything behind the items)
         */
@Override
protected void drawGuiContainerBackgroundLayer(float f, int x, int y)
{
         GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F);
         this.mc.getTextureManager().bindTexture(field_110422_t);
         int k = (this.width - this.xSize) / 2;
         int l = (this.height - this.ySize) / 2;
         this.drawTexturedModalRect(k, l, 0, 0, this.xSize, this.ySize);
}
}

 

TileEntity

public class TileEntityNileWorkbench extends TileEntity implements IInventory
{
private ItemStack[] inventory;
    public IInventory craftResult = new InventoryCraftResult();
public ItemStack[] craftMatrixInventory;
public BlockPos pos;
    
    public TileEntityNileWorkbench() {
        super();
        inventory = new ItemStack[32];
        craftMatrixInventory = new ItemStack[9]; //TODO: magic number
    }

@Override
public int getSizeInventory() {
	return inventory.length;
}


@Override
public ItemStack getStackInSlot(int i) {
	return this.inventory[i];
}

    @Override
    public ItemStack decrStackSize(int slot, int amount) {

        ItemStack itemStack = getStackInSlot(slot);
        if (itemStack != null) {
            if (itemStack.stackSize <= amount) {
                setInventorySlotContents(slot, null);
            }
            else {
                itemStack = itemStack.splitStack(amount);
                if (itemStack.stackSize == 0) {
                    setInventorySlotContents(slot, null);
                }
            }
        }
        return itemStack;
    }

    @Override
    public ItemStack getStackInSlotOnClosing(int slot) {

        if (inventory[slot] != null) {
            ItemStack itemStack = inventory[slot];
            inventory[slot] = null;
            return itemStack;
        }
        else
            return null;
    }

@Override
public void setInventorySlotContents(int i, ItemStack itemstack) {
	inventory[i] = itemstack;


	if (itemstack != null && itemstack.stackSize > getInventoryStackLimit()) {
		itemstack.stackSize = getInventoryStackLimit();
	}
	markDirty();
}


@Override
public String getName() {
	return "Nile Table";
}


@Override
public boolean hasCustomName() {
	return false;
}


@Override
public int getInventoryStackLimit() {
	return 64;
}

@Override
public IChatComponent getDisplayName() {
	return null;
}

@Override
    public boolean isUseableByPlayer(EntityPlayer player)
    {
        return this.worldObj.getTileEntity(this.pos) != this ? false : player.getDistanceSq((double)this.pos.getX() + 0.5D, (double)this.pos.getY() + 0.5D, (double)this.pos.getZ() + 0.5D) <= 64.0D;
    }


@Override
public void openInventory(EntityPlayer playerIn) {}


@Override
public void closeInventory(EntityPlayer playerIn) {}

@Override
public boolean isItemValidForSlot(int i, ItemStack itemstack) {
	return true;
}

    public void readFromNBT(NBTTagCompound compound)
    {
        super.readFromNBT(compound);
        NBTTagList nbttaglist = compound.getTagList("Items", 10);
        this.inventory = new ItemStack[this.getSizeInventory()];

        for (int i = 0; i < nbttaglist.tagCount(); ++i)
        {
            NBTTagCompound nbttagcompound1 = nbttaglist.getCompoundTagAt(i);
            int j = nbttagcompound1.getByte("Slot") & 255;

            if (j >= 0 && j < this.inventory.length)
            {
                this.inventory[j] = ItemStack.loadItemStackFromNBT(nbttagcompound1);
            }
        }
    }

    public void writeToNBT(NBTTagCompound compound)
    {
        super.writeToNBT(compound);
        NBTTagList nbttaglist = new NBTTagList();

        for (int i = 0; i < this.inventory.length; ++i)
        {
            if (this.inventory[i] != null)
            {
                NBTTagCompound nbttagcompound1 = new NBTTagCompound();
                nbttagcompound1.setByte("Slot", (byte)i);
                this.inventory[i].writeToNBT(nbttagcompound1);
                nbttaglist.appendTag(nbttagcompound1);
            }
        }

        compound.setTag("Items", nbttaglist);
    }
    
    public Container createContainer(InventoryPlayer playerInventory, EntityPlayer playerIn)
    {
        return new ContainerNileWorkbench(playerInventory, craftResult, this.worldObj, pos);
    }

    public int getField(int id)
    {
        return 0;
    }

    public void setField(int id, int value) {}

    public int getFieldCount()
    {
        return 0;
    }

    public void clear()
    {
        for (int i = 0; i < this.inventory.length; ++i)
        {
            this.inventory[i] = null;
        }
    }	
}

Main Developer and Owner of Zero Quest

Visit the Wiki for more information

If I helped anyone, please give me a applaud and a thank you!

Posted

The code that you posted is extremely broad. Believe it or not, it takes time to analyze code to identify what's going wrong, and the more code you post, the longer it takes. If it takes too long, people might give up. Therefore, narrowing your code down will help others help you. A good way to narrow down your search is to use breakpoints and debug mode.

 

In Eclipse, to set a breakpoint, right click on the left edge of the text area, and select "toggle breakpoint":

84cc0fc742.png

 

You can set breakpoints in the forge library code too, not just the code that you have written. When you start running in debug mode, when the code reaches a breakpoint, it will pause BEFORE executing that line. When the program is paused, you can check the values of every variable at that point in the program by mousing over them:

5ebf42a3cd.png

 

To narrow down your code, set a bunch of breakpoints in your code. When you reach one without any errors, you know that all the code before that breakpoint works. As soon as you get an error, you know that the error must be caused by something in between the last breakpoint and the current breakpoint.

 

Using this technique, you can more precisely identify the portion of code that is causing the problem. You might even figure out the problem yourself in the process.

Posted

Ok.. I really dont understand what's going on, but here is what im getting

 

Variables

this	TileEntityNileWorkbench  (id=83)	
blockMetadata	-1	
blockType	null	
craftMatrixInventory	ItemStack[9]  (id=151)	
craftResult	InventoryCraftResult  (id=155)	
inventory	ItemStack[32]  (id=157)	
isVanilla	false	
pos	BlockPos  (id=158)	

player	EntityPlayerMP  (id=87)	
_combatTracker	CombatTracker  (id=100)	
absorptionAmount	0.0	
activePotionsMap	HashMap<K,V>  (id=102)	
addedToChunk	true	
arrowHitTimer	0	

 

Threads

Thread [server thread] (Suspended (breakpoint at line 110 in TileEntityNileWorkbench))	
owns: ArrayDeque<E>  (id=82)	
TileEntityNileWorkbench.isUseableByPlayer(EntityPlayer) line: 110	
ContainerChest.canInteractWith(EntityPlayer) line: 45	
PlayerOpenContainerEvent.<init>(EntityPlayer, Container) line: 27	
ForgeHooks.canInteractWith(EntityPlayer, Container) line: 487	
EntityPlayerMP(EntityPlayer).onUpdate() line: 295	
EntityPlayerMP.onUpdateEntity() line: 340	
NetworkDispatcher$1(NetHandlerPlayServer).processPlayer(C03PacketPlayer) line: 326	
C03PacketPlayer.processPacket(INetHandlerPlayServer) line: 33	
C03PacketPlayer.processPacket(INetHandler) line: 93	
PacketThreadUtil$1.run() line: 18	
Executors$RunnableAdapter<T>.call() line: not available	
ListenableFutureTask<V>(FutureTask<V>).run() line: not available	
FMLCommonHandler.callFuture(FutureTask) line: 676	
IntegratedServer(MinecraftServer).updateTimeLightAndEntities() line: 655	
IntegratedServer(MinecraftServer).tick() line: 598	
IntegratedServer.tick() line: 164	
IntegratedServer(MinecraftServer).run() line: 478	
Thread.run() line: not available	

Main Developer and Owner of Zero Quest

Visit the Wiki for more information

If I helped anyone, please give me a applaud and a thank you!

Posted

Looking at the stack trace (error messages), try setting breakpoints at these locations (the numbers are most likely line numbers):

net.minecraftforge.fml.common.FMLCommonHandler.callFuture(FMLCommonHandler.java:677)

net.minecraft.inventory.InventoryBasic.<init>(InventoryBasic.java:33) ~[inventoryBasic.class:?]

 

Then look at what values are null. In the segment you posted above,

blockType

is

null

, which may or may not cause problems. There might be other null variables that you should check too. If you see any bit of code of the form

variable.something

and

variable

is null, that's will cause a null pointer.

Posted

Here's what I got:

 

task	ListenableFutureTask<V>  (id=96)	
callable	Executors$RunnableAdapter<T>  (id=97)	
	result	null	
	task	PacketThreadUtil$1  (id=119)	
executionList	ExecutionList  (id=100)	
	executed	false	
	runnables	null	
outcome	null	
runner	null	
state	0	
waiters	null	

Main Developer and Owner of Zero Quest

Visit the Wiki for more information

If I helped anyone, please give me a applaud and a thank you!

Posted

For some reason, the block/tile entity pulls up a chest's gui, here's the code so far now

 

Block

public class BlockNileWorkbench extends BlockContainer{


public BlockNileWorkbench() {
	super(Material.wood);
	this.setCreativeTab(ZeroQuest.ZeroTab);
	this.setHardness(2F);
	this.setResistance(12.5F);
	this.setStepSound(soundTypeWood);
}
    private Random rand = new Random();

    @Override
public TileEntity createNewTileEntity(World world, int par1) {
	return new TileEntityNileWorkbench();
}

    @Override
public int getRenderType(){ //RenderBlocks for Render type//
	return -1;		
}
    
    @Override
public boolean isOpaqueCube(){
	return false;		
}
    
    @Override
    public boolean onBlockActivated(World worldIn, BlockPos pos, IBlockState state, EntityPlayer playerIn, EnumFacing side, float hitX, float hitY, float hitZ)
    {
        if (worldIn.isRemote)
        {
            return true;
        }
        else
        {
            TileEntity tileentity = worldIn.getTileEntity(pos);

            if (tileentity instanceof TileEntityNileWorkbench)
            {
                playerIn.displayGUIChest((TileEntityNileWorkbench)tileentity);
            }

            return true;
        }
    }
    
    public void breakBlock(World worldIn, BlockPos pos, IBlockState state)
    {
        TileEntity tileentity = worldIn.getTileEntity(pos);

        if (tileentity instanceof IInventory)
        {
            InventoryHelper.dropInventoryItems(worldIn, pos, (IInventory)tileentity);
            worldIn.updateComparatorOutputLevel(pos, this);
        }

        super.breakBlock(worldIn, pos, state);
    }
}

 

Gui

@SideOnly(Side.CLIENT)
public class GuiNileWorkbench extends GuiContainer{

private static final ResourceLocation field_110422_t = new ResourceLocation(ZeroQuest.modid + ":" + "textures/gui/niletable.png");
    private IInventory tileTable;
    private final InventoryPlayer playerInventory;
    
    public GuiNileWorkbench(InventoryPlayer playerInv, IInventory furnaceInv, World worldIn, BlockPos blockPosition)
    {
        super(new ContainerNileWorkbench(playerInv, furnaceInv, worldIn, blockPosition));
        this.playerInventory = playerInv;
        this.tileTable = furnaceInv;
        
    }

/**
         * Draw the foreground layer for the GuiContainer (everything in front of the items)
         */
@Override
protected void drawGuiContainerForegroundLayer(int x, int z)	
{
         this.fontRendererObj.drawString(StatCollector.translateToLocal("Crafting"), 30, 6, 4210752);
         this.fontRendererObj.drawString(I18n.format("container.inventory", new Object[0]), 8, this.ySize - 96 + 2, 4210752);
}
/**
         * Draw the background layer for the GuiContainer (everything behind the items)
         */
@Override
protected void drawGuiContainerBackgroundLayer(float f, int x, int y)
{
         GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F);
         this.mc.getTextureManager().bindTexture(field_110422_t);
         int k = (this.width - this.xSize) / 2;
         int l = (this.height - this.ySize) / 2;
         this.drawTexturedModalRect(k, l, 0, 0, this.xSize, this.ySize);
}
}

 

TileEntity

public class TileEntityNileWorkbench extends TileEntity implements IInventory
{
private ItemStack[] inventory;
    public IInventory craftResult = new InventoryCraftResult();
public ItemStack[] craftMatrixInventory;
    
    public TileEntityNileWorkbench() {
        super();
        inventory = new ItemStack[32];
        craftMatrixInventory = new ItemStack[9]; //TODO: magic number
    }

@Override
public int getSizeInventory() {
	return inventory.length;
}


@Override
public ItemStack getStackInSlot(int i) {
	return this.inventory[i];
}

@Override
public IChatComponent getDisplayName() {
	return ChatHelper.getChatComponent(getName());
}	

@Override
public String getName() {
	return "Nile Table";
}


@Override
public boolean hasCustomName() {
	return false;
}


@Override
public int getInventoryStackLimit() {
	return 64;
}


    public String getGuiID()
    {
        return "0";
    }

    @Override
    public ItemStack decrStackSize(int slot, int amount) {

        ItemStack itemStack = getStackInSlot(slot);
        if (itemStack != null) {
            if (itemStack.stackSize <= amount) {
                setInventorySlotContents(slot, null);
            }
            else {
                itemStack = itemStack.splitStack(amount);
                if (itemStack.stackSize == 0) {
                    setInventorySlotContents(slot, null);
                }
            }
        }
        return itemStack;
    }

    @Override
    public ItemStack getStackInSlotOnClosing(int slot) {

        if (inventory[slot] != null) {
            ItemStack itemStack = inventory[slot];
            inventory[slot] = null;
            return itemStack;
        }
        else
            return null;
    }

@Override
public void setInventorySlotContents(int i, ItemStack itemstack) {
	inventory[i] = itemstack;


	if (itemstack != null && itemstack.stackSize > getInventoryStackLimit()) {
		itemstack.stackSize = getInventoryStackLimit();
	}
	markDirty();
}

@Override
public boolean isUseableByPlayer(EntityPlayer entityplayer) {
	return entityplayer.getDistanceSq(this.pos.getX() + 0.5, this.pos.getY() + 0.5, this.pos.getZ() + 0.5) <= 64;
}

@Override
public void openInventory(EntityPlayer playerIn) {}


@Override
public void closeInventory(EntityPlayer playerIn) {}

@Override
public boolean isItemValidForSlot(int i, ItemStack itemstack) {
	return true;
}

    @Override
    public void readFromNBT(NBTTagCompound nbtTagCompound) {


        super.readFromNBT(nbtTagCompound);


        // Read in the ItemStacks in the inventory from NBT
        NBTTagList tagList = nbtTagCompound.getTagList("Items", getBlockMetadata());
        inventory = new ItemStack[this.getSizeInventory()];
        for (int i = 0; i < tagList.tagCount(); ++i) {
            NBTTagCompound tagCompound = (NBTTagCompound) tagList.getCompoundTagAt(i);
            byte slot = tagCompound.getByte("Slot");
            if (slot >= 0 && slot < inventory.length) {
                inventory[slot] = ItemStack.loadItemStackFromNBT(tagCompound);
            }
        }
        
     // Read in the Crafting Matrix from NBT
        NBTTagList craftingTag = nbtTagCompound.getTagList("CraftingMatrix", getBlockMetadata());
        craftMatrixInventory = new ItemStack[9]; //TODO: magic number
        for (int i = 0; i < craftingTag.tagCount(); ++i) {
            NBTTagCompound tagCompound = (NBTTagCompound) craftingTag.getCompoundTagAt(i);
            byte slot = tagCompound.getByte("Slot");
            if (slot >= 0 && slot < craftMatrixInventory.length) {
                craftMatrixInventory[slot] = ItemStack.loadItemStackFromNBT(tagCompound);
            }
        }


        // Read craftingResult from NBT
        NBTTagCompound tagCraftResult = nbtTagCompound.getCompoundTag("CraftingResult");
        craftResult.setInventorySlotContents(0, ItemStack.loadItemStackFromNBT(tagCraftResult));
    }


    @Override
    public void writeToNBT(NBTTagCompound nbtTagCompound) {


        super.writeToNBT(nbtTagCompound);


        // Write the ItemStacks in the inventory to NBT
        NBTTagList tagList = new NBTTagList();
        for (int currentIndex = 0; currentIndex < inventory.length; ++currentIndex) {
            if (inventory[currentIndex] != null) {
                NBTTagCompound tagCompound = new NBTTagCompound();
                tagCompound.setByte("Slot", (byte) currentIndex);
                inventory[currentIndex].writeToNBT(tagCompound);
                tagList.appendTag(tagCompound);
            }
        }
        nbtTagCompound.setTag("Items", tagList);
        
        // Write Crafting Matrix to NBT
        NBTTagList craftingTag = new NBTTagList();
        for (int currentIndex = 0; currentIndex < craftMatrixInventory.length; ++currentIndex) {
            if (craftMatrixInventory[currentIndex] != null) {
                NBTTagCompound tagCompound = new NBTTagCompound();
                tagCompound.setByte("Slot", (byte) currentIndex);
                craftMatrixInventory[currentIndex].writeToNBT(tagCompound);
                craftingTag.appendTag(tagCompound);
            }
        }
        nbtTagCompound.setTag("CraftingMatrix", craftingTag);
        
        // Write craftingResult to NBT
        if (craftResult.getStackInSlot(0) != null)
            nbtTagCompound.setTag("CraftingResult", craftResult.getStackInSlot(0).writeToNBT(new NBTTagCompound()));
    }
    
    public Container createContainer(InventoryPlayer playerInventory, EntityPlayer playerIn)
    {
        return new ContainerNileWorkbench(playerInventory, craftResult, this.worldObj, pos);
    }

    public int getField(int id)
    {
        return 0;
    }

    public void setField(int id, int value) {}

    public int getFieldCount()
    {
        return 0;
    }

    public void clear()
    {
        for (int i = 0; i < this.inventory.length; ++i)
        {
            this.inventory[i] = null;
        }
    }
}

 

Container

public class ContainerNileWorkbench extends Container
{
    public InventoryCrafting craftMatrix = new InventoryCrafting(this, 3, 3);
    public IInventory craftResult = new InventoryCraftResult();
    private World worldObj;
    private BlockPos field_178145_h;
    private static final String __OBFID = "CL_00001744";

    public ContainerNileWorkbench(InventoryPlayer playerInventory, IInventory inven, World worldIn, BlockPos p_i45800_3_)
    {
        this.worldObj = worldIn;
        this.field_178145_h = p_i45800_3_;
        this.addSlotToContainer(new SlotCrafting(playerInventory.player, this.craftMatrix, this.craftResult, 0, 124, 35));
        int i;
        int j;

        for (i = 0; i < 3; ++i)
        {
            for (j = 0; j < 3; ++j)
            {
                this.addSlotToContainer(new Slot(this.craftMatrix, j + i * 3, 30 + j * 18, 17 + i * 18));
            }
        }

        for (i = 0; i < 3; ++i)
        {
            for (j = 0; j < 9; ++j)
            {
                this.addSlotToContainer(new Slot(playerInventory, j + i * 9 + 9, 8 + j * 18, 84 + i * 18));
            }
        }

        for (i = 0; i < 9; ++i)
        {
            this.addSlotToContainer(new Slot(playerInventory, i, 8 + i * 18, 142));
        }

        this.onCraftMatrixChanged(this.craftMatrix);
    }

    public void onCraftMatrixChanged(IInventory inventoryIn)
    {
        this.craftResult.setInventorySlotContents(0, CraftingManager.getInstance().findMatchingRecipe(this.craftMatrix, this.worldObj));
    }

    public void onContainerClosed(EntityPlayer playerIn)
    {
        super.onContainerClosed(playerIn);

        if (!this.worldObj.isRemote)
        {
            for (int i = 0; i < 9; ++i)
            {
                ItemStack itemstack = this.craftMatrix.getStackInSlotOnClosing(i);

                if (itemstack != null)
                {
                    playerIn.dropPlayerItemWithRandomChoice(itemstack, false);
                }
            }
        }
    }

    public boolean canInteractWith(EntityPlayer playerIn)
    {
        return this.worldObj.getBlockState(this.field_178145_h).getBlock() != ModBlocks.nileWorktable ? false : playerIn.getDistanceSq((double)this.field_178145_h.getX() + 0.5D, (double)this.field_178145_h.getY() + 0.5D, (double)this.field_178145_h.getZ() + 0.5D) <= 64.0D;
    }

    public ItemStack transferStackInSlot(EntityPlayer playerIn, int index)
    {
        ItemStack itemstack = null;
        Slot slot = (Slot)this.inventorySlots.get(index);

        if (slot != null && slot.getHasStack())
        {
            ItemStack itemstack1 = slot.getStack();
            itemstack = itemstack1.copy();

            if (index == 0)
            {
                if (!this.mergeItemStack(itemstack1, 10, 46, true))
                {
                    return null;
                }

                slot.onSlotChange(itemstack1, itemstack);
            }
            else if (index >= 10 && index < 37)
            {
                if (!this.mergeItemStack(itemstack1, 37, 46, false))
                {
                    return null;
                }
            }
            else if (index >= 37 && index < 46)
            {
                if (!this.mergeItemStack(itemstack1, 10, 37, false))
                {
                    return null;
                }
            }
            else if (!this.mergeItemStack(itemstack1, 10, 46, false))
            {
                return null;
            }

            if (itemstack1.stackSize == 0)
            {
                slot.putStack((ItemStack)null);
            }
            else
            {
                slot.onSlotChanged();
            }

            if (itemstack1.stackSize == itemstack.stackSize)
            {
                return null;
            }

            slot.onPickupFromSlot(playerIn, itemstack1);
        }

        return itemstack;
    }

    public boolean canMergeSlot(ItemStack p_94530_1_, Slot p_94530_2_)
    {
        return p_94530_2_.inventory != this.craftResult && super.canMergeSlot(p_94530_1_, p_94530_2_);
    }
}

Main Developer and Owner of Zero Quest

Visit the Wiki for more information

If I helped anyone, please give me a applaud and a thank you!

Posted

Well when you figure out your crash, remove

public void onContainerClosed(EntityPlayer playerIn)
    {
        super.onContainerClosed(playerIn);

        if (!this.worldObj.isRemote)
        {
            for (int i = 0; i < 9; ++i)
            {
                ItemStack itemstack = this.craftMatrix.getStackInSlotOnClosing(i);

                if (itemstack != null)
                {
                    playerIn.dropPlayerItemWithRandomChoice(itemstack, false);
                }
            }
        }
    }

 

Because thats the code that dispenses the items after you exit the workbench

Former developer for DivineRPG, Pixelmon and now the maker of Essence of the Gods

Posted

The problem is I don't know WHY it's crashing. The debugger doesn't even let me into the world, which basically doesn't even allow to test out the breakpoints in the tileentity and the container. I finally got it to where it doesn't crash when you first open it, but now if I leave the world and re-enter, it crashes immediately. Also when I open up the GUI, it's the completely wrong GUI (its a chest's gui instead of a crafting table) The code that is on my github worked perfectly in 1.7.10. The code of the progress I did so far is in the previous post I made

 

Crash Log

[09:01:00] [server thread/ERROR]: Encountered an unexpected exception
java.lang.NullPointerException
at net.minecraft.tileentity.TileEntity.getBlockMetadata(TileEntity.java:133) ~[TileEntity.class:?]
at common.zeroquest.tileentity.TileEntityNileWorkbench.readFromNBT(TileEntityNileWorkbench.java:136) ~[TileEntityNileWorkbench.class:?]
at net.minecraft.tileentity.TileEntity.createAndLoadEntity(TileEntity.java:109) ~[TileEntity.class:?]
at net.minecraft.world.chunk.storage.AnvilChunkLoader.loadEntities(AnvilChunkLoader.java:516) ~[AnvilChunkLoader.class:?]
at net.minecraftforge.common.chunkio.ChunkIOProvider.callStage2(ChunkIOProvider.java:41) ~[ChunkIOProvider.class:?]
at net.minecraftforge.common.chunkio.ChunkIOProvider.callStage2(ChunkIOProvider.java:12) ~[ChunkIOProvider.class:?]
at net.minecraftforge.common.util.AsynchronousExecutor.skipQueue(AsynchronousExecutor.java:344) ~[AsynchronousExecutor.class:?]
at net.minecraftforge.common.util.AsynchronousExecutor.getSkipQueue(AsynchronousExecutor.java:302) ~[AsynchronousExecutor.class:?]
at net.minecraftforge.common.chunkio.ChunkIOExecutor.syncChunkLoad(ChunkIOExecutor.java:12) ~[ChunkIOExecutor.class:?]
at net.minecraft.world.gen.ChunkProviderServer.loadChunk(ChunkProviderServer.java:117) ~[ChunkProviderServer.class:?]
at net.minecraft.world.gen.ChunkProviderServer.loadChunk(ChunkProviderServer.java:92) ~[ChunkProviderServer.class:?]
at net.minecraft.server.MinecraftServer.initialWorldChunkLoad(MinecraftServer.java:302) ~[MinecraftServer.class:?]
at net.minecraft.server.integrated.IntegratedServer.loadAllWorlds(IntegratedServer.java:112) ~[integratedServer.class:?]
at net.minecraft.server.integrated.IntegratedServer.startServer(IntegratedServer.java:126) ~[integratedServer.class:?]
at net.minecraft.server.MinecraftServer.run(MinecraftServer.java:438) [MinecraftServer.class:?]
at java.lang.Thread.run(Unknown Source) [?:1.8.0_25]
[09:01:00] [server thread/ERROR]: This crash report has been saved to: C:\Users\NovaPC\Desktop\ModStuff\Code1.8\eclipse\.\crash-reports\crash-2015-01-05_09.01.00-server.txt
[09:01:00] [server thread/INFO] [FML]: Applying holder lookups
[09:01:00] [server thread/INFO] [FML]: Holder lookups applied
[09:01:00] [server thread/INFO] [FML]: The state engine was in incorrect state SERVER_STARTING and forced into state SERVER_STOPPED. Errors may have been discarded.
[09:01:00] [Client thread/INFO] [sTDOUT]: [net.minecraft.init.Bootstrap:printToSYSOUT:568]: ---- Minecraft Crash Report ----
// My bad.

Time: 1/5/15 9:01 AM
Description: Exception in server tick loop

java.lang.NullPointerException: Exception in server tick loop
at net.minecraft.tileentity.TileEntity.getBlockMetadata(TileEntity.java:133)
at common.zeroquest.tileentity.TileEntityNileWorkbench.readFromNBT(TileEntityNileWorkbench.java:136)
at net.minecraft.tileentity.TileEntity.createAndLoadEntity(TileEntity.java:109)
at net.minecraft.world.chunk.storage.AnvilChunkLoader.loadEntities(AnvilChunkLoader.java:516)
at net.minecraftforge.common.chunkio.ChunkIOProvider.callStage2(ChunkIOProvider.java:41)
at net.minecraftforge.common.chunkio.ChunkIOProvider.callStage2(ChunkIOProvider.java:12)
at net.minecraftforge.common.util.AsynchronousExecutor.skipQueue(AsynchronousExecutor.java:344)
at net.minecraftforge.common.util.AsynchronousExecutor.getSkipQueue(AsynchronousExecutor.java:302)
at net.minecraftforge.common.chunkio.ChunkIOExecutor.syncChunkLoad(ChunkIOExecutor.java:12)
at net.minecraft.world.gen.ChunkProviderServer.loadChunk(ChunkProviderServer.java:117)
at net.minecraft.world.gen.ChunkProviderServer.loadChunk(ChunkProviderServer.java:92)
at net.minecraft.server.MinecraftServer.initialWorldChunkLoad(MinecraftServer.java:302)
at net.minecraft.server.integrated.IntegratedServer.loadAllWorlds(IntegratedServer.java:112)
at net.minecraft.server.integrated.IntegratedServer.startServer(IntegratedServer.java:126)
at net.minecraft.server.MinecraftServer.run(MinecraftServer.java:438)
at java.lang.Thread.run(Unknown Source)

 

========EDIT==========

Ok so now I got it where it doesn't crash from closing the client all together and re-enter the world or from just leaving the world and re-entering that same world and to even keep my stuff inside the container (though I'm not sure if its even using my custom container since the gui is wrong). What I did to fix that problem was replace the getBlockMetadata() method in the readFromNBT in the TileEntity and removed that onContainerClosed() method completely out of my custom container. But now my new problem is that it's still displaying the incorrect GUI. What do I do now?

Main Developer and Owner of Zero Quest

Visit the Wiki for more information

If I helped anyone, please give me a applaud and a thank you!

Posted

Ok, I completely scratched out the 1.8 source codes and went back to the 1.7.10 codes and modified them and the result I got is:

+The GUI is displaying the right one (not the chest gui)

+Items stay inside the container aftering leaving the world and re-entering and closing client

+No crashing upon leaving and re-entering the game, opening the GUI

 

But the downside is:

-When trying to get the crafting result item, the client crashes and this error is thrown:

 

[11:07:12] [Client thread/FATAL]: Reported exception thrown!
net.minecraft.util.ReportedException: Updating screen events
at net.minecraft.client.Minecraft.runTick(Minecraft.java:1676) ~[Minecraft.class:?]
at net.minecraft.client.Minecraft.runGameLoop(Minecraft.java:1021) ~[Minecraft.class:?]
at net.minecraft.client.Minecraft.run(Minecraft.java:345) [Minecraft.class:?]
at net.minecraft.client.main.Main.main(Main.java:117) [Main.class:?]
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) ~[?:1.8.0_25]
at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source) ~[?:1.8.0_25]
at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source) ~[?:1.8.0_25]
at java.lang.reflect.Method.invoke(Unknown Source) ~[?:1.8.0_25]
at net.minecraft.launchwrapper.Launch.launch(Launch.java:135) [launchwrapper-1.11.jar:?]
at net.minecraft.launchwrapper.Launch.main(Launch.java:28) [launchwrapper-1.11.jar:?]
at net.minecraftforge.gradle.GradleStartCommon.launch(GradleStartCommon.java:78) [start/:?]
at GradleStart.main(GradleStart.java:45) [start/:?]
Caused by: java.lang.NullPointerException
at common.zeroquest.events.AchievementEvents.CraftingEvent(AchievementEvents.java:26) ~[AchievementEvents.class:?]
at net.minecraftforge.fml.common.eventhandler.ASMEventHandler_8_AchievementEvents_CraftingEvent_ItemCraftedEvent.invoke(.dynamic) ~[?:?]
at net.minecraftforge.fml.common.eventhandler.ASMEventHandler.invoke(ASMEventHandler.java:55) ~[ASMEventHandler.class:?]
at net.minecraftforge.fml.common.eventhandler.EventBus.post(EventBus.java:138) ~[EventBus.class:?]
at net.minecraftforge.fml.common.FMLCommonHandler.firePlayerCraftingEvent(FMLCommonHandler.java:578) ~[FMLCommonHandler.class:?]
at common.zeroquest.inventory.SlotNileCrafting.onPickupFromSlot(SlotNileCrafting.java:134) ~[slotNileCrafting.class:?]
at net.minecraft.inventory.Container.slotClick(Container.java:328) ~[Container.class:?]
at net.minecraft.client.multiplayer.PlayerControllerMP.windowClick(PlayerControllerMP.java:492) ~[PlayerControllerMP.class:?]
at net.minecraft.client.gui.inventory.GuiContainer.handleMouseClick(GuiContainer.java:641) ~[GuiContainer.class:?]
at net.minecraft.client.gui.inventory.GuiContainer.mouseClicked(GuiContainer.java:390) ~[GuiContainer.class:?]
at net.minecraft.client.gui.GuiScreen.handleMouseInput(GuiScreen.java:544) ~[GuiScreen.class:?]
at net.minecraft.client.gui.GuiScreen.handleInput(GuiScreen.java:516) ~[GuiScreen.class:?]
at net.minecraft.client.Minecraft.runTick(Minecraft.java:1662) ~[Minecraft.class:?]
... 11 more
[11:07:12] [Client thread/INFO] [sTDOUT]: [net.minecraft.init.Bootstrap:printToSYSOUT:568]: ---- Minecraft Crash Report ----
// Oops.

Time: 1/5/15 11:07 AM
Description: Updating screen events

java.lang.NullPointerException: Updating screen events
at common.zeroquest.events.AchievementEvents.CraftingEvent(AchievementEvents.java:26)
at net.minecraftforge.fml.common.eventhandler.ASMEventHandler_8_AchievementEvents_CraftingEvent_ItemCraftedEvent.invoke(.dynamic)
at net.minecraftforge.fml.common.eventhandler.ASMEventHandler.invoke(ASMEventHandler.java:55)
at net.minecraftforge.fml.common.eventhandler.EventBus.post(EventBus.java:138)
at net.minecraftforge.fml.common.FMLCommonHandler.firePlayerCraftingEvent(FMLCommonHandler.java:578)
at common.zeroquest.inventory.SlotNileCrafting.onPickupFromSlot(SlotNileCrafting.java:134)
at net.minecraft.inventory.Container.slotClick(Container.java:328)
at net.minecraft.client.multiplayer.PlayerControllerMP.windowClick(PlayerControllerMP.java:492)
at net.minecraft.client.gui.inventory.GuiContainer.handleMouseClick(GuiContainer.java:641)
at net.minecraft.client.gui.inventory.GuiContainer.mouseClicked(GuiContainer.java:390)
at net.minecraft.client.gui.GuiScreen.handleMouseInput(GuiScreen.java:544)
at net.minecraft.client.gui.GuiScreen.handleInput(GuiScreen.java:516)
at net.minecraft.client.Minecraft.runTick(Minecraft.java:1662)
at net.minecraft.client.Minecraft.runGameLoop(Minecraft.java:1021)
at net.minecraft.client.Minecraft.run(Minecraft.java:345)
at net.minecraft.client.main.Main.main(Main.java:117)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
at java.lang.reflect.Method.invoke(Unknown Source)
at net.minecraft.launchwrapper.Launch.launch(Launch.java:135)
at net.minecraft.launchwrapper.Launch.main(Launch.java:28)
at net.minecraftforge.gradle.GradleStartCommon.launch(GradleStartCommon.java:78)
at GradleStart.main(GradleStart.java:45)


A detailed walkthrough of the error, its code path and all known details is as follows:
---------------------------------------------------------------------------------------

-- Head --
Stacktrace:
at common.zeroquest.events.AchievementEvents.CraftingEvent(AchievementEvents.java:26)
at net.minecraftforge.fml.common.eventhandler.ASMEventHandler_8_AchievementEvents_CraftingEvent_ItemCraftedEvent.invoke(.dynamic)
at net.minecraftforge.fml.common.eventhandler.ASMEventHandler.invoke(ASMEventHandler.java:55)
at net.minecraftforge.fml.common.eventhandler.EventBus.post(EventBus.java:138)
at net.minecraftforge.fml.common.FMLCommonHandler.firePlayerCraftingEvent(FMLCommonHandler.java:578)
at common.zeroquest.inventory.SlotNileCrafting.onPickupFromSlot(SlotNileCrafting.java:134)
at net.minecraft.inventory.Container.slotClick(Container.java:328)
at net.minecraft.client.multiplayer.PlayerControllerMP.windowClick(PlayerControllerMP.java:492)
at net.minecraft.client.gui.inventory.GuiContainer.handleMouseClick(GuiContainer.java:641)
at net.minecraft.client.gui.inventory.GuiContainer.mouseClicked(GuiContainer.java:390)
at net.minecraft.client.gui.GuiScreen.handleMouseInput(GuiScreen.java:544)
at net.minecraft.client.gui.GuiScreen.handleInput(GuiScreen.java:516)

-- Affected screen --
Details:
Screen name: common.zeroquest.client.gui.GuiNileWorkbench

-- Affected level --
Details:
Level name: MpServer
All players: 1 total; [EntityPlayerSP['Player154'/345, l='MpServer', x=-98.42, y=70.00, z=-30.08]]
Chunk stats: MultiplayerChunkCache: 556, 556
Level seed: 0
Level generator: ID 00 - default, ver 1. Features enabled: false
Level generator options: 
Level spawn location: -88.00,64.00,-24.00 - World: (-88,64,-24), Chunk: (at 8,4,8 in -6,-2; contains blocks -96,0,-32 to -81,255,-17), Region: (-1,-1; contains chunks -32,-32 to -1,-1, blocks -512,0,-512 to -1,255,-1)
Level time: 3353 game time, 3353 day time
Level dimension: 0
Level storage version: 0x00000 - Unknown?
Level weather: Rain time: 0 (now: false), thunder time: 0 (now: false)
Level game mode: Game mode: creative (ID 1). Hardcore: false. Cheats: false
Forced entities: 150 total; [EntityItem['item.tile.rail'/256, l='MpServer', x=-40.13, y=26.00, z=-42.22], EntityItem['item.tile.rail'/257, l='MpServer', x=-41.47, y=26.00, z=-30.75], EntityCreeper['Creeper'/258, l='MpServer', x=-39.44, y=14.00, z=28.38], EntityZombie['Zombie'/268, l='MpServer', x=-20.50, y=42.00, z=6.50], EntitySkeleton['Skeleton'/60, l='MpServer', x=-178.88, y=34.00, z=-103.53], EntityCow['Cow'/61, l='MpServer', x=-177.81, y=69.00, z=-55.28], EntityCow['Cow'/63, l='MpServer', x=-178.03, y=69.00, z=-36.06], EntityCreeper['Creeper'/69, l='MpServer', x=-163.91, y=30.00, z=-94.22], EntityCreeper['Creeper'/70, l='MpServer', x=-167.43, y=31.16, z=-96.90], EntityBat['Bat'/71, l='MpServer', x=-164.48, y=33.31, z=-85.42], EntityCreeper['Creeper'/72, l='MpServer', x=-167.50, y=30.00, z=-92.50], EntityCreeper['Creeper'/73, l='MpServer', x=-167.50, y=30.00, z=-90.50], EntitySkeleton['Skeleton'/74, l='MpServer', x=-164.88, y=31.00, z=-90.50], EntityCow['Cow'/75, l='MpServer', x=-161.47, y=68.00, z=-35.63], EntityPig['Pig'/76, l='MpServer', x=-167.00, y=65.00, z=9.16], EntityPig['Pig'/77, l='MpServer', x=-162.15, y=66.01, z=16.44], EntityPig['Pig'/78, l='MpServer', x=-160.47, y=67.00, z=16.50], EntityPig['Pig'/79, l='MpServer', x=-166.88, y=64.00, z=24.59], EntityPig['Pig'/80, l='MpServer', x=-163.81, y=64.00, z=21.88], EntityPig['Pig'/81, l='MpServer', x=-168.31, y=64.00, z=25.53], EntityCreeper['Creeper'/82, l='MpServer', x=-166.84, y=15.00, z=42.09], EntityZombie['Zombie'/83, l='MpServer', x=-176.64, y=18.00, z=38.52], EntityPig['Pig'/84, l='MpServer', x=-174.47, y=63.00, z=39.78], EntityPig['Pig'/85, l='MpServer', x=-169.39, y=63.00, z=30.24], EntityCow['Cow'/89, l='MpServer', x=-154.75, y=63.00, z=-96.25], EntityPlayerSP['Player154'/345, l='MpServer', x=-98.42, y=70.00, z=-30.08], EntityZombie['Zombie'/90, l='MpServer', x=-148.32, y=29.91, z=-77.65], EntitySpider['Spider'/91, l='MpServer', x=-149.31, y=26.00, z=-89.97], EntityPig['Pig'/92, l='MpServer', x=-144.28, y=67.00, z=-84.91], EntityBat['Bat'/93, l='MpServer', x=-163.01, y=11.95, z=-74.55], EntityCow['Cow'/94, l='MpServer', x=-158.91, y=68.00, z=-40.59], EntityBat['Bat'/95, l='MpServer', x=-156.21, y=25.06, z=-24.39], EntityPig['Pig'/96, l='MpServer', x=-147.97, y=67.00, z=13.94], EntityPig['Pig'/97, l='MpServer', x=-148.22, y=65.00, z=18.91], EntityPig['Pig'/98, l='MpServer', x=-157.56, y=65.00, z=25.47], EntityPig['Pig'/99, l='MpServer', x=-159.50, y=71.00, z=19.50], EntityRabbit['Rabbit'/102, l='MpServer', x=-135.63, y=70.00, z=-96.97], EntityItem['item.tile.gravel'/103, l='MpServer', x=-134.25, y=29.00, z=-91.22], EntityItem['item.tile.gravel'/104, l='MpServer', x=-133.91, y=29.00, z=-93.34], EntityPig['Pig'/105, l='MpServer', x=-131.72, y=69.00, z=-82.22], EntityRabbit['Rabbit'/106, l='MpServer', x=-124.59, y=70.00, z=-91.44], EntityPig['Pig'/107, l='MpServer', x=-136.88, y=69.00, z=-80.50], EntityCow['Cow'/108, l='MpServer', x=-138.44, y=69.00, z=-82.50], EntityCow['Cow'/109, l='MpServer', x=-143.06, y=68.00, z=-90.13], EntityZombie['Zombie'/110, l='MpServer', x=-140.03, y=26.00, z=-72.44], EntityCow['Cow'/111, l='MpServer', x=-139.06, y=69.00, z=-72.66], EntitySkeleton['Skeleton'/112, l='MpServer', x=-136.50, y=23.00, z=-56.50], EntityZombie['Zombie'/113, l='MpServer', x=-138.03, y=23.00, z=-58.59], EntityItem['item.tile.torch'/114, l='MpServer', x=-143.56, y=27.00, z=11.13], EntityRabbit['Rabbit'/121, l='MpServer', x=-120.47, y=71.00, z=-80.59], EntityItem['item.tile.torch'/122, l='MpServer', x=-119.50, y=24.00, z=-67.38], EntityItem['item.tile.torch'/123, l='MpServer', x=-120.19, y=34.00, z=-64.25], EntityPig['Pig'/124, l='MpServer', x=-122.81, y=71.00, z=-73.91], EntityCreeper['Creeper'/125, l='MpServer', x=-113.59, y=11.02, z=-54.41], EntityItem['item.tile.rail'/126, l='MpServer', x=-121.88, y=29.00, z=-53.25], EntityItem['item.tile.rail'/127, l='MpServer', x=-121.88, y=29.00, z=-58.22], EntityItem['item.tile.rail'/128, l='MpServer', x=-120.31, y=29.00, z=-59.25], EntityMinecartChest['container.minecart'/129, l='MpServer', x=-120.50, y=24.06, z=-61.50], EntityItem['item.tile.torch'/130, l='MpServer', x=-114.31, y=23.00, z=-48.56], EntityBat['Bat'/131, l='MpServer', x=-117.74, y=35.69, z=-50.50], EntityBat['Bat'/132, l='MpServer', x=-117.52, y=35.45, z=-51.04], EntityItem['item.item.string'/133, l='MpServer', x=-119.78, y=30.00, z=-45.34], EntityItem['item.tile.rail'/134, l='MpServer', x=-119.13, y=30.00, z=-39.81], EntityItem['item.tile.torch'/135, l='MpServer', x=-119.13, y=30.00, z=-39.81], EntityMinecartChest['container.minecart'/136, l='MpServer', x=-119.50, y=30.00, z=-39.50], EntityMinecartChest['container.minecart'/137, l='MpServer', x=-121.50, y=33.06, z=-47.50], EntityPig['Pig'/138, l='MpServer', x=-112.88, y=69.00, z=-17.63], EntityCreeper['Creeper'/139, l='MpServer', x=-126.69, y=32.00, z=-2.53], EntityZombie['Zombie'/140, l='MpServer', x=-124.75, y=33.00, z=-2.72], EntityItem['item.tile.torch'/141, l='MpServer', x=-125.88, y=30.00, z=1.28], EntityBat['Bat'/142, l='MpServer', x=-114.07, y=22.46, z=-2.52], EntityItem['item.tile.gravel'/143, l='MpServer', x=-113.72, y=31.00, z=12.97], EntityZombie['Zombie'/144, l='MpServer', x=-124.31, y=46.00, z=47.56], EntityZombie['Zombie'/145, l='MpServer', x=-125.28, y=46.00, z=47.53], EntityZombie['Zombie'/146, l='MpServer', x=-129.44, y=46.00, z=44.97], EntityMinecartChest['container.minecart'/151, l='MpServer', x=-111.50, y=35.06, z=-67.50], EntityItem['item.tile.torch'/152, l='MpServer', x=-100.97, y=33.00, z=-66.56], EntityMinecartChest['container.minecart'/153, l='MpServer', x=-110.50, y=26.06, z=-58.50], EntityCreeper['Creeper'/154, l='MpServer', x=-104.50, y=25.00, z=-58.13], EntityCreeper['Creeper'/155, l='MpServer', x=-99.69, y=33.00, z=-59.03], EntityCreeper['Creeper'/156, l='MpServer', x=-105.31, y=33.00, z=-60.03], EntitySkeleton['Skeleton'/157, l='MpServer', x=-108.50, y=13.00, z=-47.50], EntityZombie['Zombie'/158, l='MpServer', x=-108.50, y=13.00, z=-46.50], EntityBat['Bat'/159, l='MpServer', x=-98.75, y=31.10, z=-47.75], EntityItem['item.tile.rail'/160, l='MpServer', x=-104.03, y=22.00, z=-44.97], EntityEnderman['Enderman'/161, l='MpServer', x=-101.94, y=37.00, z=-39.47], EntityBat['Bat'/162, l='MpServer', x=-97.75, y=50.18, z=-48.10], EntityPig['Pig'/163, l='MpServer', x=-110.31, y=71.00, z=-51.38], EntityPig['Pig'/164, l='MpServer', x=-111.00, y=72.00, z=-35.16], EntityItem['item.tile.torch'/165, l='MpServer', x=-97.13, y=29.00, z=-29.06], EntityCreeper['Creeper'/166, l='MpServer', x=-100.50, y=29.00, z=-31.50], EntityItem['item.tile.torch'/167, l='MpServer', x=-106.03, y=23.00, z=-2.47], EntityItem['item.tile.torch'/168, l='MpServer', x=-97.81, y=27.00, z=-1.22], EntityItem['item.tile.gravel'/169, l='MpServer', x=-112.00, y=31.00, z=12.56], EntityItem['item.tile.torch'/170, l='MpServer', x=-104.97, y=23.00, z=3.56], EntityItem['item.tile.rail'/171, l='MpServer', x=-106.81, y=23.00, z=5.16], EntityItem['item.tile.rail'/172, l='MpServer', x=-105.59, y=23.00, z=9.19], EntityItem['item.tile.gravel'/173, l='MpServer', x=-109.88, y=31.00, z=12.31], EntityItem['item.tile.rail'/174, l='MpServer', x=-96.81, y=23.00, z=6.13], EntityItem['item.tile.rail'/175, l='MpServer', x=-100.50, y=27.00, z=18.38], EntityItem['item.tile.torch'/176, l='MpServer', x=-101.00, y=27.00, z=26.16], EntitySheep['Sheep'/186, l='MpServer', x=-90.28, y=72.00, z=-94.31], EntitySheep['Sheep'/187, l='MpServer', x=-91.97, y=71.00, z=-101.34], EntitySheep['Sheep'/188, l='MpServer', x=-99.94, y=70.00, z=-95.97], EntityCreeper['Creeper'/189, l='MpServer', x=-95.16, y=25.00, z=-92.75], EntitySheep['Sheep'/190, l='MpServer', x=-93.06, y=71.00, z=-84.97], EntityCreeper['Creeper'/191, l='MpServer', x=-81.63, y=29.00, z=-66.53], EntityCreeper['Creeper'/192, l='MpServer', x=-93.38, y=25.00, z=-77.09], EntitySpider['Spider'/193, l='MpServer', x=-86.34, y=31.00, z=-69.31], EntityCreeper['Creeper'/194, l='MpServer', x=-80.56, y=30.00, z=-66.09], EntityCreeper['Creeper'/195, l='MpServer', x=-86.09, y=30.00, z=-67.47], EntitySkeleton['Skeleton'/196, l='MpServer', x=-91.34, y=22.00, z=-52.19], EntityItem['item.tile.rail'/197, l='MpServer', x=-80.88, y=21.00, z=-62.63], EntityItem['item.tile.torch'/198, l='MpServer', x=-92.03, y=29.00, z=-37.19], EntityZombie['Zombie'/199, l='MpServer', x=-93.50, y=20.00, z=-42.09], EntityBat['Bat'/200, l='MpServer', x=-83.34, y=21.10, z=-16.25], EntityPig['Pig'/201, l='MpServer', x=-94.69, y=67.00, z=-17.56], EntityItem['item.tile.torch'/202, l='MpServer', x=-92.09, y=24.00, z=-8.91], EntityZombie['Zombie'/203, l='MpServer', x=-82.50, y=27.00, z=10.50], EntityCreeper['Creeper'/204, l='MpServer', x=-88.72, y=22.75, z=7.50], EntityItem['item.tile.torch'/205, l='MpServer', x=-85.69, y=26.00, z=10.66], EntityItem['item.tile.rail'/206, l='MpServer', x=-94.22, y=23.00, z=7.25], EntityZombie['Zombie'/207, l='MpServer', x=-80.53, y=32.00, z=47.03], EntitySkeleton['Skeleton'/220, l='MpServer', x=-77.95, y=28.03, z=-61.20], EntityItem['item.tile.rail'/221, l='MpServer', x=-73.41, y=24.00, z=-62.25], EntityItem['item.tile.rail'/222, l='MpServer', x=-73.53, y=24.00, z=-57.75], EntityMinecartChest['container.minecart'/223, l='MpServer', x=-66.50, y=27.06, z=-60.50], EntityBat['Bat'/224, l='MpServer', x=-75.13, y=25.10, z=-62.50], EntityItem['item.tile.rail'/225, l='MpServer', x=-73.13, y=24.00, z=-55.88], EntityItem['item.tile.torch'/226, l='MpServer', x=-70.03, y=28.00, z=-49.75], EntityMinecartChest['container.minecart'/227, l='MpServer', x=-79.50, y=28.06, z=-47.50], EntityMinecartChest['container.minecart'/228, l='MpServer', x=-68.50, y=28.06, z=-42.50], EntityMinecartChest['container.minecart'/229, l='MpServer', x=-77.50, y=28.06, z=-28.50], EntityBat['Bat'/230, l='MpServer', x=-71.48, y=27.81, z=-8.81], EntityBat['Bat'/231, l='MpServer', x=-76.58, y=22.34, z=-13.99], EntityZombie['Zombie'/232, l='MpServer', x=-76.44, y=24.00, z=-6.97], EntitySkeleton['Skeleton'/233, l='MpServer', x=-67.16, y=29.00, z=5.25], EntityBat['Bat'/234, l='MpServer', x=-71.97, y=22.07, z=7.42], EntityItem['item.tile.torch'/235, l='MpServer', x=-78.78, y=22.00, z=6.25], EntityBat['Bat'/236, l='MpServer', x=-78.25, y=27.10, z=3.72], EntityMinecartChest['container.minecart'/237, l='MpServer', x=-77.50, y=22.06, z=8.50], EntitySquid['Squid'/238, l='MpServer', x=-72.38, y=47.13, z=30.72], EntityCreeper['Creeper'/246, l='MpServer', x=-48.09, y=19.00, z=-72.69], EntityZombie['Zombie'/247, l='MpServer', x=-58.56, y=29.00, z=3.84], EntitySquid['Squid'/248, l='MpServer', x=-60.53, y=46.00, z=26.44], EntitySkeleton['Skeleton'/251, l='MpServer', x=-43.50, y=20.00, z=-85.50], EntityItem['item.tile.rail'/252, l='MpServer', x=-41.53, y=26.00, z=-43.34], EntityItem['item.tile.rail'/253, l='MpServer', x=-40.47, y=26.00, z=-43.25], EntityItem['item.tile.rail'/254, l='MpServer', x=-42.88, y=26.00, z=-33.75], EntityItem['item.tile.rail'/255, l='MpServer', x=-42.88, y=26.00, z=-42.25]]
Retry entities: 0 total; []
Server brand: fml,forge
Server type: Integrated singleplayer server
Stacktrace:
at net.minecraft.client.multiplayer.WorldClient.addWorldInfoToCrashReport(WorldClient.java:350)
at net.minecraft.client.Minecraft.addGraphicsAndWorldToCrashReport(Minecraft.java:2488)
at net.minecraft.client.Minecraft.run(Minecraft.java:367)
at net.minecraft.client.main.Main.main(Main.java:117)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
at java.lang.reflect.Method.invoke(Unknown Source)
at net.minecraft.launchwrapper.Launch.launch(Launch.java:135)
at net.minecraft.launchwrapper.Launch.main(Launch.java:28)
at net.minecraftforge.gradle.GradleStartCommon.launch(GradleStartCommon.java:78)
at GradleStart.main(GradleStart.java:45)

 

And here is the modified code:

 

Block

public class BlockNileWorkbench extends BlockContainer{


public BlockNileWorkbench() {
	super(Material.wood);
	this.setCreativeTab(ZeroQuest.ZeroTab);
	this.setHardness(2F);
	this.setResistance(12.5F);
	this.setStepSound(soundTypeWood);
}
    private Random rand = new Random();

    @Override
public TileEntity createNewTileEntity(World world, int par1) {
	return new TileEntityNileWorkbench();
}

    @Override
public int getRenderType(){ //RenderBlocks for Render type//
	return -1;		
}
    
    @Override
public boolean isOpaqueCube(){
	return false;		
}
    
    @Override
    public boolean onBlockActivated(World worldIn, BlockPos pos, IBlockState state, EntityPlayer playerIn, EnumFacing side, float hitX, float hitY, float hitZ)
    {
    	if (playerIn.isSneaking())
    		return false;
    		else {
    			if (!worldIn.isRemote) {
    				TileEntityNileWorkbench tileNileTable = (TileEntityNileWorkbench) worldIn.getTileEntity(new BlockPos(pos.getX(), pos.getY(), pos.getZ()));
    				if (tileNileTable != null) {
    					playerIn.openGui(ZeroQuest.instance, CommonProxy.NileTable, worldIn, pos.getX(), pos.getY() , pos.getZ());
    				}
    			}
    			return true;
    		}
    }
    
    public void breakBlock(World worldIn, BlockPos pos, IBlockState state)
    {
        dropInventory(worldIn, pos.getX(), pos.getY(), pos.getZ());
    	super.breakBlock(worldIn, pos, state);
    }
    
    private void dropInventory(World world, int x, int y, int z) {
        TileEntity tileEntity = world.getTileEntity(new BlockPos(x, y, z));
        if (!(tileEntity instanceof IInventory))
            return;
        IInventory inventory = (IInventory) tileEntity;
        for (int i = 0; i < inventory.getSizeInventory(); i++) {
            ItemStack itemStack = inventory.getStackInSlot(i);
            if (itemStack != null && itemStack.stackSize > 0) {
                float dX = rand.nextFloat() * 0.8F + 0.1F;
                float dY = rand.nextFloat() * 0.8F + 0.1F;
                float dZ = rand.nextFloat() * 0.8F + 0.1F;
                EntityItem entityItem = new EntityItem(world, x + dX, y + dY, z + dZ, new ItemStack(itemStack.getItem(), itemStack.stackSize, itemStack.getItemDamage()));
                if (itemStack.hasTagCompound()) {
                    entityItem.getEntityItem().setTagCompound((NBTTagCompound) itemStack.getTagCompound().copy());
                }
                float factor = 0.05F;
                entityItem.motionX = rand.nextGaussian() * factor;
                entityItem.motionY = rand.nextGaussian() * factor + 0.2F;
                entityItem.motionZ = rand.nextGaussian() * factor;
                world.spawnEntityInWorld(entityItem);
                itemStack.stackSize = 0;
            }
        }
    }
}

 

Container

public class ContainerNileWorkbench extends Container
{
    public InventoryCrafting craftMatrix = new InventoryCrafting(this, 3, 3);
    //public IInventory craftResult = new InventoryCraftResult();
    private World worldObj;
    private BlockPos field_178145_h;
public TileEntityNileWorkbench tileEntity;
    private static final String __OBFID = "CL_00001744";

    public ContainerNileWorkbench(TileEntityNileWorkbench tileTable, InventoryPlayer playerInventory, World worldIn, BlockPos p_i45800_3_)
    {
        this.worldObj = worldIn;
        this.field_178145_h = p_i45800_3_;
    	tileEntity = tileTable;
        this.addSlotToContainer(new SlotNileCrafting(playerInventory.player, this.craftMatrix, tileTable.craftResult, 0, 124, 35));
        int i;
        int j;

        updateCraftingMatrix();
        
        for (i = 0; i < 3; ++i)
        {
            for (j = 0; j < 3; ++j)
            {
                this.addSlotToContainer(new Slot(this.craftMatrix, j + i * 3, 30 + j * 18, 17 + i * 18));
            }
        }

        for (i = 0; i < 3; ++i)
        {
            for (j = 0; j < 9; ++j)
            {
                this.addSlotToContainer(new Slot(playerInventory, j + i * 9 + 9, 8 + j * 18, 84 + i * 18));
            }
        }

        for (i = 0; i < 9; ++i)
        {
            this.addSlotToContainer(new Slot(playerInventory, i, 8 + i * 18, 142));
        }

        this.onCraftMatrixChanged(this.craftMatrix);
    }
    
    private void updateCraftingMatrix() {
    	for (int i = 0; i < craftMatrix.getSizeInventory(); i++) {
    	craftMatrix.setInventorySlotContents(i, tileEntity.craftMatrixInventory[i]);
    	}
    	}

    public void onCraftMatrixChanged(IInventory inventoryIn)
    {
    	tileEntity.craftResult.setInventorySlotContents(0, CraftingManager.getInstance().findMatchingRecipe(this.craftMatrix, this.worldObj));
    }
    
    @Override
    public void onContainerClosed(EntityPlayer par1EntityPlayer)
    {
    	super.onContainerClosed(par1EntityPlayer);
    	saveCraftingMatrix();
    }
    
    private void saveCraftingMatrix() {
    	for (int i = 0; i < craftMatrix.getSizeInventory(); i++) {
    		tileEntity.craftMatrixInventory[i] = craftMatrix.getStackInSlot(i);
    	}
    }

@Override
public boolean canInteractWith(EntityPlayer entityPlayer)
{
	return tileEntity.isUseableByPlayer(entityPlayer);
}

    public ItemStack transferStackInSlot(EntityPlayer playerIn, int index)
    {
        ItemStack itemstack = null;
        Slot slot = (Slot)this.inventorySlots.get(index);

        if (slot != null && slot.getHasStack())
        {
            ItemStack itemstack1 = slot.getStack();
            itemstack = itemstack1.copy();

            if (index == 0)
            {
                if (!this.mergeItemStack(itemstack1, 10, 46, true))
                {
                    return null;
                }

                slot.onSlotChange(itemstack1, itemstack);
            }
            else if (index >= 10 && index < 37)
            {
                if (!this.mergeItemStack(itemstack1, 37, 46, false))
                {
                    return null;
                }
            }
            else if (index >= 37 && index < 46)
            {
                if (!this.mergeItemStack(itemstack1, 10, 37, false))
                {
                    return null;
                }
            }
            else if (!this.mergeItemStack(itemstack1, 10, 46, false))
            {
                return null;
            }

            if (itemstack1.stackSize == 0)
            {
                slot.putStack((ItemStack)null);
            }
            else
            {
                slot.onSlotChanged();
            }

            if (itemstack1.stackSize == itemstack.stackSize)
            {
                return null;
            }

            slot.onPickupFromSlot(playerIn, itemstack1);
        }

        return itemstack;
    }

    public boolean canMergeSlot(ItemStack p_94530_1_, Slot p_94530_2_)
    {
        return p_94530_2_.inventory != tileEntity.craftResult && super.canMergeSlot(p_94530_1_, p_94530_2_);
    }
}

 

Crafting Slot

public class SlotNileCrafting extends SlotCrafting{

    private final IInventory craftMatrix;
    private final EntityPlayer thePlayer;
    private int amountCrafted;
    private static final String __OBFID = "CL_00001761";


    public SlotNileCrafting(EntityPlayer player, InventoryCrafting craftingInventory, IInventory p_i45790_3_, int slotIndex, int xPosition, int yPosition)
    {
        super(player, craftingInventory, p_i45790_3_, slotIndex, xPosition, yPosition);
        this.thePlayer = player;
        this.craftMatrix = craftingInventory;
    }
/**
         * Check if the stack is a valid item for this slot. Always true beside for the armor slots.
         */
@Override
public boolean isItemValid(ItemStack par1ItemStack)
{
         return false;
}
/**
         * Decrease the size of the stack in slot (first int arg) by the amount of the second int arg. Returns the new
         * stack.
         */
@Override
public ItemStack decrStackSize(int par1)
{
         if (this.getHasStack())
         {
                 this.amountCrafted += Math.min(par1, this.getStack().stackSize);
         }
         return super.decrStackSize(par1);
}
/**
         * the itemStack passed in is the output - ie, iron ingots, and pickaxes, not ore and wood. Typically increases an
         * internal count then calls onCrafting(item).
         */
@Override
protected void onCrafting(ItemStack par1ItemStack, int par2)
{
         this.amountCrafted += par2;
         this.onCrafting(par1ItemStack);
}
/**
         * the itemStack passed in is the output - ie, iron ingots, and pickaxes, not ore and wood.
         */
@Override
protected void onCrafting(ItemStack stack)
{
	 stack.onCrafting(this.thePlayer.worldObj, this.thePlayer, this.amountCrafted);
	 this.amountCrafted = 0;

	 if (stack.getItem() == Item.getItemFromBlock(Blocks.crafting_table))
	 {
		 this.thePlayer.addStat(AchievementList.buildWorkBench, 1);
	 }

        if (stack.getItem() instanceof ItemPickaxe)
        {
            this.thePlayer.triggerAchievement(AchievementList.buildPickaxe);
        }

        if (stack.getItem() == Item.getItemFromBlock(Blocks.furnace))
        {
            this.thePlayer.triggerAchievement(AchievementList.buildFurnace);
        }

        if (stack.getItem() instanceof ItemHoe)
        {
            this.thePlayer.triggerAchievement(AchievementList.buildHoe);
        }

        if (stack.getItem() == Items.bread)
        {
            this.thePlayer.triggerAchievement(AchievementList.makeBread);
        }

        if (stack.getItem() == Items.cake)
        {
            this.thePlayer.triggerAchievement(AchievementList.bakeCake);
        }

        if (stack.getItem() instanceof ItemPickaxe && ((ItemPickaxe)stack.getItem()).getToolMaterial() != Item.ToolMaterial.WOOD)
        {
            this.thePlayer.triggerAchievement(AchievementList.buildBetterPickaxe);
        }

        if (stack.getItem() instanceof ItemSword)
        {
            this.thePlayer.triggerAchievement(AchievementList.buildSword);
        }

        if (stack.getItem() == Item.getItemFromBlock(Blocks.enchanting_table))
        {
            this.thePlayer.triggerAchievement(AchievementList.enchantments);
        }

        if (stack.getItem() == Item.getItemFromBlock(Blocks.bookshelf))
        {
            this.thePlayer.triggerAchievement(AchievementList.bookcase);
        }

        if (stack.getItem() == Items.golden_apple && stack.getMetadata() == 1)
        {
            this.thePlayer.triggerAchievement(AchievementList.overpowered);
        }
    }

@Override
public void onPickupFromSlot(EntityPlayer playerIn, ItemStack stack)
{
	{
		 FMLCommonHandler.instance().firePlayerCraftingEvent(playerIn, stack, craftMatrix);
         this.onCrafting(stack);
         for (int i = 0; i < this.craftMatrix.getSizeInventory(); ++i)
         {
                 ItemStack itemstack1 = this.craftMatrix.getStackInSlot(i);
                 if (itemstack1 != null)
                 {
                         this.craftMatrix.decrStackSize(i, 1);
                         if (itemstack1.getItem().hasContainerItem(itemstack1))
                         {
                                 ItemStack itemstack2 = itemstack1.getItem().getContainerItem(itemstack1);
                                 if (itemstack2.isItemStackDamageable() && itemstack2.getItemDamage() > itemstack2.getMaxDamage())
                                 {
                                         MinecraftForge.EVENT_BUS.post(new PlayerDestroyItemEvent(thePlayer, itemstack2));
                                         itemstack2 = null;
                                 }
                                 if (!this.thePlayer.inventory.addItemStackToInventory(itemstack2))
                                 {
                                         if (this.craftMatrix.getStackInSlot(i) == null)
                                         {
                                                 this.craftMatrix.setInventorySlotContents(i, itemstack2);
                                         }
                                         else
                                         {
                                                 this.thePlayer.dropPlayerItemWithRandomChoice(itemstack2, false);
                                         }
                                 }
                         }
                 }
         }
}
}
}

 

CommonProxy

public class CommonProxy implements IGuiHandler{

public static final int NileTable = 0;
public static final int PetPack = 1;


@Override
public Object getServerGuiElement(int ID, EntityPlayer player, World world, int x, int y, int z) {
	 if(ID == NileTable) {
		TileEntity target = world.getTileEntity(new BlockPos(x, y, z));
		if(!(target instanceof TileEntityNileWorkbench)) 
			return null;

		TileEntityNileWorkbench tileNileTable = (TileEntityNileWorkbench)target;
		ContainerNileWorkbench tableContainer = new ContainerNileWorkbench(tileNileTable, player.inventory, world, new BlockPos(x, y, z));
		return tableContainer;
	}
	else if(ID == PetPack) {
		Entity target = player.worldObj.getEntityByID(x);
            if(!(target instanceof EntityCustomTameable)) {
            	return null;
            }
            EntityCustomTameable entity = (EntityCustomTameable)target;
		ContainerPack packContainer = new ContainerPack(player.inventory, entity);
		return packContainer;
	} 
	return null;
}


@Override
public Object getClientGuiElement(int ID, EntityPlayer player, World world, int x, int y, int z) { 
	if(ID == NileTable) {
		TileEntity target = world.getTileEntity(new BlockPos(x, y, z));
		if(!(target instanceof TileEntityNileWorkbench)) 
			return null;

		TileEntityNileWorkbench tileNileTable = (TileEntityNileWorkbench)target;
		GuiNileWorkbench tableGui = new GuiNileWorkbench(player.inventory, tileNileTable, world, new BlockPos(x, y, z));
		return tableGui;
	}
	else if(ID == PetPack) {
				Entity target = player.worldObj.getEntityByID(x);
	           if(!(target instanceof EntityCustomTameable)) {
	           	return null;
	           }
	           EntityCustomTameable dog = (EntityCustomTameable)target;
				GuiPack packGui = new GuiPack(player.inventory, dog);
				return packGui;
		 	}
	return null;
}

 

Tile Entity

public class TileEntityNileWorkbench extends TileEntity implements IInventory
{
private ItemStack[] inventory;
    public IInventory craftResult = new InventoryCraftResult();
public ItemStack[] craftMatrixInventory;
    
    public TileEntityNileWorkbench() {
        super();
        inventory = new ItemStack[32];
        craftMatrixInventory = new ItemStack[9]; //TODO: magic number
    }

@Override
public int getSizeInventory() {
	return inventory.length;
}


@Override
public ItemStack getStackInSlot(int i) {
	return this.inventory[i];
}

@Override
public IChatComponent getDisplayName() {
	return ChatHelper.getChatComponent(getName());
}	

@Override
public String getName() {
	return "Nile Table";
}


@Override
public boolean hasCustomName() {
	return false;
}


@Override
public int getInventoryStackLimit() {
	return 64;
}

    @Override
    public ItemStack decrStackSize(int slot, int amount) {

        ItemStack itemStack = getStackInSlot(slot);
        if (itemStack != null) {
            if (itemStack.stackSize <= amount) {
                setInventorySlotContents(slot, null);
            }
            else {
                itemStack = itemStack.splitStack(amount);
                if (itemStack.stackSize == 0) {
                    setInventorySlotContents(slot, null);
                }
            }
        }
        return itemStack;
    }

    @Override
    public ItemStack getStackInSlotOnClosing(int slot) {

        if (inventory[slot] != null) {
            ItemStack itemStack = inventory[slot];
            inventory[slot] = null;
            return itemStack;
        }
        else
            return null;
    }

@Override
public void setInventorySlotContents(int i, ItemStack itemstack) {
	inventory[i] = itemstack;


	if (itemstack != null && itemstack.stackSize > getInventoryStackLimit()) {
		itemstack.stackSize = getInventoryStackLimit();
	}
	markDirty();
}

@Override
public boolean isUseableByPlayer(EntityPlayer entityplayer) {
	return entityplayer.getDistanceSq(this.pos.getX() + 0.5, this.pos.getY() + 0.5, this.pos.getZ() + 0.5) <= 64;
}

@Override
public void openInventory(EntityPlayer playerIn) {}


@Override
public void closeInventory(EntityPlayer playerIn) {}

@Override
public boolean isItemValidForSlot(int i, ItemStack itemstack) {
	return true;
}

    @Override
    public void readFromNBT(NBTTagCompound nbtTagCompound) {


        super.readFromNBT(nbtTagCompound);


        // Read in the ItemStacks in the inventory from NBT
        NBTTagList tagList = nbtTagCompound.getTagList("Items", 10);
        inventory = new ItemStack[this.getSizeInventory()];
        for (int i = 0; i < tagList.tagCount(); ++i) {
            NBTTagCompound tagCompound = (NBTTagCompound) tagList.getCompoundTagAt(i);
            byte slot = tagCompound.getByte("Slot");
            if (slot >= 0 && slot < inventory.length) {
                inventory[slot] = ItemStack.loadItemStackFromNBT(tagCompound);
            }
        }
        
     // Read in the Crafting Matrix from NBT
        NBTTagList craftingTag = nbtTagCompound.getTagList("CraftingMatrix", 10);
        craftMatrixInventory = new ItemStack[9]; //TODO: magic number
        for (int i = 0; i < craftingTag.tagCount(); ++i) {
            NBTTagCompound tagCompound = (NBTTagCompound) craftingTag.getCompoundTagAt(i);
            byte slot = tagCompound.getByte("Slot");
            if (slot >= 0 && slot < craftMatrixInventory.length) {
                craftMatrixInventory[slot] = ItemStack.loadItemStackFromNBT(tagCompound);
            }
        }


        // Read craftingResult from NBT
        NBTTagCompound tagCraftResult = nbtTagCompound.getCompoundTag("CraftingResult");
        craftResult.setInventorySlotContents(0, ItemStack.loadItemStackFromNBT(tagCraftResult));
    }


    @Override
    public void writeToNBT(NBTTagCompound nbtTagCompound) {


        super.writeToNBT(nbtTagCompound);


        // Write the ItemStacks in the inventory to NBT
        NBTTagList tagList = new NBTTagList();
        for (int currentIndex = 0; currentIndex < inventory.length; ++currentIndex) {
            if (inventory[currentIndex] != null) {
                NBTTagCompound tagCompound = new NBTTagCompound();
                tagCompound.setByte("Slot", (byte) currentIndex);
                inventory[currentIndex].writeToNBT(tagCompound);
                tagList.appendTag(tagCompound);
            }
        }
        nbtTagCompound.setTag("Items", tagList);
        
        // Write Crafting Matrix to NBT
        NBTTagList craftingTag = new NBTTagList();
        for (int currentIndex = 0; currentIndex < craftMatrixInventory.length; ++currentIndex) {
            if (craftMatrixInventory[currentIndex] != null) {
                NBTTagCompound tagCompound = new NBTTagCompound();
                tagCompound.setByte("Slot", (byte) currentIndex);
                craftMatrixInventory[currentIndex].writeToNBT(tagCompound);
                craftingTag.appendTag(tagCompound);
            }
        }
        nbtTagCompound.setTag("CraftingMatrix", craftingTag);
        
        // Write craftingResult to NBT
        if (craftResult.getStackInSlot(0) != null)
            nbtTagCompound.setTag("CraftingResult", craftResult.getStackInSlot(0).writeToNBT(new NBTTagCompound()));
    }
    
    public Container createContainer(InventoryPlayer playerInventory, EntityPlayer playerIn)
    {
        return new ContainerNileWorkbench(this, playerInventory, this.worldObj, pos);
    }

    public int getField(int id)
    {
        return 0;
    }

    public void setField(int id, int value) {}

    public int getFieldCount()
    {
        return 0;
    }

    public void clear()
    {
        for (int i = 0; i < this.inventory.length; ++i)
        {
            this.inventory[i] = null;
        }
    }
}

 

GUI

@SideOnly(Side.CLIENT)
public class GuiNileWorkbench extends GuiContainer{

private static final ResourceLocation field_110422_t = new ResourceLocation(ZeroQuest.modid + ":" + "textures/gui/niletable.png");
    
    public GuiNileWorkbench(InventoryPlayer playerInv, TileEntityNileWorkbench tileTable, World worldIn, BlockPos blockPosition)
    {
        super(new ContainerNileWorkbench(tileTable, playerInv, worldIn, blockPosition));
    }

/**
         * Draw the foreground layer for the GuiContainer (everything in front of the items)
         */
@Override
protected void drawGuiContainerForegroundLayer(int x, int z)	
{
         this.fontRendererObj.drawString(StatCollector.translateToLocal("Crafting"), 30, 6, 4210752);
         this.fontRendererObj.drawString(I18n.format("container.inventory", new Object[0]), 8, this.ySize - 96 + 2, 4210752);
}
/**
         * Draw the background layer for the GuiContainer (everything behind the items)
         */
@Override
protected void drawGuiContainerBackgroundLayer(float f, int x, int y)
{
         GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F);
         this.mc.getTextureManager().bindTexture(field_110422_t);
         int k = (this.width - this.xSize) / 2;
         int l = (this.height - this.ySize) / 2;
         this.drawTexturedModalRect(k, l, 0, 0, this.xSize, this.ySize);
}
}

Main Developer and Owner of Zero Quest

Visit the Wiki for more information

If I helped anyone, please give me a applaud and a thank you!

Posted

I removed the slot stuff and changed something in my achievement events and it now works. Thanks for your help guys!

Main Developer and Owner of Zero Quest

Visit the Wiki for more information

If I helped anyone, please give me a applaud and a thank you!

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Unfortunately, your content contains terms that we do not allow. Please edit your content to remove the highlighted words below.
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Announcements



×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use.