Jump to content

[SOLVED]Custom Gui Error


Busti
 Share

Recommended Posts

Hello,

i've tried to make a custom Gui with a Container and I followed the Tutorial in the Tutorials section of the MCForgeWiki (http://www.minecraftforge.net/wiki/Containers_and_GUIs)

I've made everything as in the Tutorial and didn't changed anything but the Names to get started.

 

But when I try to activate the Block I'm getting this Error:

 

2013-06-30 20:19:20 [iNFO] [sTDERR] net.minecraft.util.ReportedException: Ticking memory connection
2013-06-30 20:19:20 [iNFO] [sTDERR] 	at net.minecraft.network.NetworkListenThread.networkTick(NetworkListenThread.java:60)
2013-06-30 20:19:20 [iNFO] [sTDERR] 	at net.minecraft.server.integrated.IntegratedServerListenThread.networkTick(IntegratedServerListenThread.java:109)
2013-06-30 20:19:20 [iNFO] [sTDERR] 	at net.minecraft.server.MinecraftServer.updateTimeLightAndEntities(MinecraftServer.java:674)
2013-06-30 20:19:20 [iNFO] [sTDERR] 	at net.minecraft.server.MinecraftServer.tick(MinecraftServer.java:570)
2013-06-30 20:19:20 [iNFO] [sTDERR] 	at net.minecraft.server.integrated.IntegratedServer.tick(IntegratedServer.java:127)
2013-06-30 20:19:20 [iNFO] [sTDERR] 	at net.minecraft.server.MinecraftServer.run(MinecraftServer.java:468)
2013-06-30 20:19:20 [iNFO] [sTDERR] 	at net.minecraft.server.ThreadMinecraftServer.run(ThreadMinecraftServer.java:16)
2013-06-30 20:19:20 [iNFO] [sTDERR] Caused by: java.lang.NullPointerException
2013-06-30 20:19:20 [iNFO] [sTDERR] 	at net.minecraft.inventory.Slot.getStack(Slot.java:88)
2013-06-30 20:19:20 [iNFO] [sTDERR] 	at net.minecraft.inventory.Container.getInventory(Container.java:68)
2013-06-30 20:19:20 [iNFO] [sTDERR] 	at net.minecraft.inventory.Container.addCraftingToCrafters(Container.java:54)
2013-06-30 20:19:20 [iNFO] [sTDERR] 	at cpw.mods.fml.common.network.NetworkRegistry.openRemoteGui(NetworkRegistry.java:321)
2013-06-30 20:19:20 [iNFO] [sTDERR] 	at cpw.mods.fml.common.network.FMLNetworkHandler.openGui(FMLNetworkHandler.java:347)
2013-06-30 20:19:20 [iNFO] [sTDERR] 	at net.minecraft.entity.player.EntityPlayer.openGui(EntityPlayer.java:2388)
2013-06-30 20:19:20 [iNFO] [sTDERR] 	at busti2000.technica.block.SoulTableBlock.onBlockActivated(SoulTableBlock.java:85)
2013-06-30 20:19:20 [iNFO] [sTDERR] 	at net.minecraft.item.ItemInWorldManager.activateBlockOrUseItem(ItemInWorldManager.java:412)
2013-06-30 20:19:20 [iNFO] [sTDERR] 	at net.minecraft.network.NetServerHandler.handlePlace(NetServerHandler.java:553)
2013-06-30 20:19:20 [iNFO] [sTDERR] 	at net.minecraft.network.packet.Packet15Place.processPacket(Packet15Place.java:79)
2013-06-30 20:19:20 [iNFO] [sTDERR] 	at net.minecraft.network.MemoryConnection.processReadPackets(MemoryConnection.java:89)
2013-06-30 20:19:20 [iNFO] [sTDERR] 	at net.minecraft.network.NetServerHandler.networkTick(NetServerHandler.java:134)
2013-06-30 20:19:20 [iNFO] [sTDERR] 	at net.minecraft.network.NetworkListenThread.networkTick(NetworkListenThread.java:53)
2013-06-30 20:19:20 [iNFO] [sTDERR] 	... 6 more
2013-06-30 20:19:20 [sEVERE] [Minecraft-Server] Encountered an unexpected exception ReportedException
net.minecraft.util.ReportedException: Ticking memory connection
at net.minecraft.network.NetworkListenThread.networkTick(NetworkListenThread.java:60)
at net.minecraft.server.integrated.IntegratedServerListenThread.networkTick(IntegratedServerListenThread.java:109)
at net.minecraft.server.MinecraftServer.updateTimeLightAndEntities(MinecraftServer.java:674)
at net.minecraft.server.MinecraftServer.tick(MinecraftServer.java:570)
at net.minecraft.server.integrated.IntegratedServer.tick(IntegratedServer.java:127)
at net.minecraft.server.MinecraftServer.run(MinecraftServer.java:468)
at net.minecraft.server.ThreadMinecraftServer.run(ThreadMinecraftServer.java:16)
Caused by: java.lang.NullPointerException
at net.minecraft.inventory.Slot.getStack(Slot.java:88)
at net.minecraft.inventory.Container.getInventory(Container.java:68)
at net.minecraft.inventory.Container.addCraftingToCrafters(Container.java:54)
at cpw.mods.fml.common.network.NetworkRegistry.openRemoteGui(NetworkRegistry.java:321)
at cpw.mods.fml.common.network.FMLNetworkHandler.openGui(FMLNetworkHandler.java:347)
at net.minecraft.entity.player.EntityPlayer.openGui(EntityPlayer.java:2388)
at busti2000.technica.block.SoulTableBlock.onBlockActivated(SoulTableBlock.java:85)
at net.minecraft.item.ItemInWorldManager.activateBlockOrUseItem(ItemInWorldManager.java:412)
at net.minecraft.network.NetServerHandler.handlePlace(NetServerHandler.java:553)
at net.minecraft.network.packet.Packet15Place.processPacket(Packet15Place.java:79)
at net.minecraft.network.MemoryConnection.processReadPackets(MemoryConnection.java:89)
at net.minecraft.network.NetServerHandler.networkTick(NetServerHandler.java:134)
at net.minecraft.network.NetworkListenThread.networkTick(NetworkListenThread.java:53)
... 6 more
2013-06-30 20:19:20 [sEVERE] [Minecraft-Server] This crash report has been saved to: C:\Users\Moritz\Desktop\mcp744\jars\.\crash-reports\crash-2013-06-30_20.19.20-server.txt
2013-06-30 20:19:20 [iNFO] [Minecraft-Server] Stopping server
2013-06-30 20:19:20 [iNFO] [Minecraft-Server] Saving players
2013-06-30 20:19:20 [iNFO] [Minecraft-Server] Saving worlds
2013-06-30 20:19:20 [iNFO] [Minecraft-Server] Saving chunks for level 'New World'/Overworld
2013-06-30 20:19:20 [iNFO] [Minecraft-Server] Saving chunks for level 'New World'/Nether
2013-06-30 20:19:20 [iNFO] [Minecraft-Server] Saving chunks for level 'New World'/The End
2013-06-30 20:19:20 [iNFO] [ForgeModLoader] Unloading dimension 0
2013-06-30 20:19:20 [iNFO] [ForgeModLoader] Unloading dimension -1
2013-06-30 20:19:20 [iNFO] [ForgeModLoader] Unloading dimension 1
2013-06-30 20:19:20 [sEVERE] [ForgeModLoader] Fatal errors were detected during the transition from SERVER_STARTED to SERVER_STOPPED. Loading cannot continue
2013-06-30 20:19:20 [sEVERE] [ForgeModLoader] 
mcp [Minecraft Coder Pack] (minecraft.jar) Unloaded->Constructed->Pre-initialized->Initialized->Post-initialized->Available->Available->Available->Available->Available
FML [Forge Mod Loader] (coremods) Unloaded->Constructed->Pre-initialized->Initialized->Post-initialized->Available->Available->Available->Available->Available
Forge [Minecraft Forge] (coremods) Unloaded->Constructed->Pre-initialized->Initialized->Post-initialized->Available->Available->Available->Available->Available
Technica [Technica] (bin) Unloaded->Constructed->Pre-initialized->Initialized->Post-initialized->Available->Available->Available->Available->Available
2013-06-30 20:19:20 [sEVERE] [ForgeModLoader] The ForgeModLoader state engine has become corrupted. Probably, a state was missed by and invalid modification to a base classForgeModLoader depends on. This is a critical error and not recoverable. Investigate any modifications to base classes outside ofForgeModLoader, especially Optifine, to see if there are fixes available.
2013-06-30 20:19:20 [iNFO] [sTDERR] Exception in thread "Server thread" java.lang.RuntimeException: The ForgeModLoader state engine is invalid
2013-06-30 20:19:20 [iNFO] [sTDERR] 	at cpw.mods.fml.common.LoadController.transition(LoadController.java:134)
2013-06-30 20:19:20 [iNFO] [sTDERR] 	at cpw.mods.fml.common.Loader.serverStopped(Loader.java:799)
2013-06-30 20:19:20 [iNFO] [sTDERR] 	at cpw.mods.fml.common.FMLCommonHandler.handleServerStopped(FMLCommonHandler.java:470)
2013-06-30 20:19:20 [iNFO] [sTDERR] 	at net.minecraft.server.MinecraftServer.run(MinecraftServer.java:530)
2013-06-30 20:19:20 [iNFO] [sTDERR] 	at net.minecraft.server.ThreadMinecraftServer.run(ThreadMinecraftServer.java:16)
2013-06-30 20:19:21 [iNFO] [sTDERR] net.minecraft.util.ReportedException: Rendering screen
2013-06-30 20:19:21 [iNFO] [sTDERR] 	at net.minecraft.client.renderer.EntityRenderer.updateCameraAndRender(EntityRenderer.java:1030)
2013-06-30 20:19:21 [iNFO] [sTDERR] 	at net.minecraft.client.Minecraft.runGameLoop(Minecraft.java:867)
2013-06-30 20:19:21 [iNFO] [sTDERR] 	at net.minecraft.client.Minecraft.run(Minecraft.java:756)
2013-06-30 20:19:21 [iNFO] [sTDERR] 	at java.lang.Thread.run(Unknown Source)
2013-06-30 20:19:21 [iNFO] [sTDERR] Caused by: java.lang.NullPointerException
2013-06-30 20:19:21 [iNFO] [sTDERR] 	at net.minecraft.inventory.Slot.getStack(Slot.java:88)
2013-06-30 20:19:21 [iNFO] [sTDERR] 	at net.minecraft.client.gui.inventory.GuiContainer.drawSlotInventory(GuiContainer.java:335)
2013-06-30 20:19:21 [iNFO] [sTDERR] 	at net.minecraft.client.gui.inventory.GuiContainer.drawScreen(GuiContainer.java:127)
2013-06-30 20:19:21 [iNFO] [sTDERR] 	at net.minecraft.client.renderer.EntityRenderer.updateCameraAndRender(EntityRenderer.java:1021)
2013-06-30 20:19:21 [iNFO] [sTDERR] 	... 3 more

 

 

What did I do wrong? The only line of this Error that belongs to my mod is this:

2013-06-30 20:19:20 [iNFO] [sTDERR] at busti2000.technica.block.SoulTableBlock.onBlockActivated(SoulTableBlock.java:85)

but my Code is the Same as in the Tutorial just with the Name of my mod:

entityplayer.openGui(Technica.instance, 1, world, x, y, z);

 

What can I do to fix this Error?

Thanks for any Help

 

Busti

PM's regarding modding questions should belong in the Modder Support sub-forum and won't be answered.

Link to comment
Share on other sites

IGuiHandler code, please.

The GuiHandler is probably correct since it's erroring in the container, which only gets opened after GuiHandler. (Conclusion: Post your Container, but it doesn't hurt to post the GuiHandler as well).

Well, my only guess is that he had his GUI IDs wrong. Ah well.

BEWARE OF GOD

---

Co-author of Pentachoron Labs' SBFP Tech.

Link to comment
Share on other sites

Here is the Code:

it should be as in the Tutorial.

 

 

Container:

package busti2000.technica.gui;

import busti2000.technica.tileentity.TileEntitySoulTable;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.entity.player.InventoryPlayer;
import net.minecraft.inventory.Container;
import net.minecraft.inventory.Slot;
import net.minecraft.item.ItemStack;

public class ContainerSoulTable extends Container {

protected TileEntitySoulTable tileentity;

public ContainerSoulTable(EntityPlayer entityplayer, TileEntitySoulTable te) {

        for (int i = 0; i < 3; i++) {
            for (int j = 0; j < 3; j++) {
                    this.addSlotToContainer(new Slot(tileentity, j + i * 3, 62 + j * 18, 17 + i * 18));
            }
            
        }
        this.bindPlayerInventory(entityplayer.inventory);
}

    protected void bindPlayerInventory(InventoryPlayer inventoryPlayer) {
        for (int i = 0; i < 3; i++) {
            for (int j = 0; j < 9; j++) {
                addSlotToContainer(new Slot(inventoryPlayer, j + i * 9 + 9,
                    8 + j * 18, 84 + i * 18));
            }
            
        }
        
        for (int i = 0; i < 9; i++) {
            addSlotToContainer(new Slot(inventoryPlayer, i, 8 + i * 18, 142));
        }
        
    }

@Override
public boolean canInteractWith(EntityPlayer entityplayer) {
	return tileentity.isUseableByPlayer(entityplayer);
}

 @Override
     public ItemStack transferStackInSlot(EntityPlayer entityplayer, int slot) {
	 ItemStack stack = null;
	 Slot slotObject = (Slot) inventorySlots.get(slot);

	 if (slotObject != null && slotObject.getHasStack()) {
		 ItemStack stackInSlot = slotObject.getStack();
		 stack = stackInSlot.copy();

		 if (slot < 9) {
                 if (!this.mergeItemStack(stackInSlot, 0, 35, true)) {
                     return null;
                 }
                 
		 }

             else if (!this.mergeItemStack(stackInSlot, 0, 9, false)) {
                 return null;
             }

             if (stackInSlot.stackSize == 0) {
                 slotObject.putStack(null);
             } else {
                 slotObject.onSlotChanged();
             }

             if (stackInSlot.stackSize == stack.stackSize) {
                 return null;
             }
             slotObject.onPickupFromSlot(entityplayer, stackInSlot);

	 }
	 return stack;
 }

}

Gui Handler:

package busti2000.technica.gui;

import busti2000.technica.tileentity.TileEntitySoulTable;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.tileentity.TileEntity;
import net.minecraft.world.World;
import cpw.mods.fml.common.network.IGuiHandler;

public class GuiHandler implements IGuiHandler {

public GuiHandler() {
	// TODO Auto-generated constructor stub
}

@Override
public Object getServerGuiElement(int ID, EntityPlayer entityplayer, World world, int x, int y, int z) {
	TileEntity tileEntity = world.getBlockTileEntity(x, y, z);
	if(tileEntity instanceof TileEntitySoulTable){
            return new ContainerSoulTable(entityplayer, (TileEntitySoulTable) tileEntity);
        }
	return null;
}

@Override
public Object getClientGuiElement(int ID, EntityPlayer entityplayer, World world, int x, int y, int z) {
	TileEntity tileEntity = world.getBlockTileEntity(x, y, z);
        if(tileEntity instanceof TileEntitySoulTable){
            return new GuiSoulTable(entityplayer, (TileEntitySoulTable) tileEntity);
        }
	return null;
}

}

 

PM's regarding modding questions should belong in the Modder Support sub-forum and won't be answered.

Link to comment
Share on other sites

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
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.

 Share



×
×
  • Create New...

Important Information

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