Jump to content

Recommended Posts

Posted

First off, this mod does not use packets, the mod it extends does, but this one does not. Also, the class that is erroring is in no way connected to packets of my creation.

 

I have this code:

@Override
    public boolean onBlockActivated(World world, int x, int y, int z, EntityPlayer player, int par6, float par7, float par8, float par9)
    {
    	if(!world.isRemote)
    	{
    		if(!player.isSneaking())
        	{
        		TileEntityDLLaptop te = (TileEntityDLLaptop)world.getTileEntity(x, y, z);
        		if(!te.noTablet)
        		{
        			player.inventory.addItemStackToInventory(te.tabletItem);
        			te.noTablet = true;
        			te.setTabletItem(null);
        			world.markBlockForUpdate(x, y, z);
        		}
        		else if(player.inventory.getCurrentItem() != null && player.inventory.getCurrentItem().isItemEqual(new ItemStack(DLStuff.itemUnProgrammedDPad)))
        		{
        			player.inventory.decrStackSize(player.inventory.currentItem, 1);
        			te.setTabletItem(new ItemStack(DLStuff.itemUnProgrammedDPad));
            		te.noTablet = false;
            		world.markBlockForUpdate(x, y, z);
        		}
        		player.openGui(DLStuff.instance, 0, world, x, y, z);
            	return true;
    		}
    	}
    	return false;
    }

 

As long as

if(!te.noTablet)
        		{
        			player.inventory.addItemStackToInventory(te.tabletItem);
        			te.noTablet = true;
        			te.setTabletItem(null);
        			world.markBlockForUpdate(x, y, z);
        		}
        		else if(player.inventory.getCurrentItem() != null && player.inventory.getCurrentItem().isItemEqual(new ItemStack(DLStuff.itemUnProgrammedDPad)))
        		{
        			player.inventory.decrStackSize(player.inventory.currentItem, 1);
        			te.setTabletItem(new ItemStack(DLStuff.itemUnProgrammedDPad));
            		te.noTablet = false;
            		world.markBlockForUpdate(x, y, z);
        		}

comes before the gui call, when I right click, the game crashes.

Here's that:

---- Minecraft Crash Report ----
// I let you down. Sorry 

Time: 12/12/14 5:03 PM
Description: Ticking memory connection

java.lang.NullPointerException: Ticking memory connection
at net.minecraft.network.NetHandlerPlayServer.processPlayerBlockPlacement(NetHandlerPlayServer.java:657)
at net.minecraft.network.play.client.C08PacketPlayerBlockPlacement.processPacket(C08PacketPlayerBlockPlacement.java:74)
at net.minecraft.network.play.client.C08PacketPlayerBlockPlacement.processPacket(C08PacketPlayerBlockPlacement.java:122)
at net.minecraft.network.NetworkManager.processReceivedPackets(NetworkManager.java:241)
at net.minecraft.network.NetworkSystem.networkTick(NetworkSystem.java:182)
at net.minecraft.server.MinecraftServer.updateTimeLightAndEntities(MinecraftServer.java:726)
at net.minecraft.server.MinecraftServer.tick(MinecraftServer.java:614)
at net.minecraft.server.integrated.IntegratedServer.tick(IntegratedServer.java:118)
at net.minecraft.server.MinecraftServer.run(MinecraftServer.java:485)
at net.minecraft.server.MinecraftServer$2.run(MinecraftServer.java:752)


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

-- Head --
Stacktrace:
at net.minecraft.network.NetHandlerPlayServer.processPlayerBlockPlacement(NetHandlerPlayServer.java:657)
at net.minecraft.network.play.client.C08PacketPlayerBlockPlacement.processPacket(C08PacketPlayerBlockPlacement.java:74)
at net.minecraft.network.play.client.C08PacketPlayerBlockPlacement.processPacket(C08PacketPlayerBlockPlacement.java:122)
at net.minecraft.network.NetworkManager.processReceivedPackets(NetworkManager.java:241)

-- Ticking connection --
Details:
Connection: net.minecraft.network.NetworkManager@709a4d14
Stacktrace:
at net.minecraft.network.NetworkSystem.networkTick(NetworkSystem.java:182)
at net.minecraft.server.MinecraftServer.updateTimeLightAndEntities(MinecraftServer.java:726)
at net.minecraft.server.MinecraftServer.tick(MinecraftServer.java:614)
at net.minecraft.server.integrated.IntegratedServer.tick(IntegratedServer.java:118)
at net.minecraft.server.MinecraftServer.run(MinecraftServer.java:485)
at net.minecraft.server.MinecraftServer$2.run(MinecraftServer.java:752)

-- System Details --
Details:
Minecraft Version: 1.7.10
Operating System: Windows 7 (amd64) version 6.1
Java Version: 1.7.0_67, Oracle Corporation
Java VM Version: Java HotSpot(TM) 64-Bit Server VM (mixed mode), Oracle Corporation
Memory: 864862712 bytes (824 MB) / 1056309248 bytes (1007 MB) up to 1056309248 bytes (1007 MB)
JVM Flags: 3 total; -Xincgc -Xmx1024M -Xms1024M
AABB Pool Size: 0 (0 bytes; 0 MB) allocated, 0 (0 bytes; 0 MB) used
IntCache: cache: 0, tcache: 0, allocated: 0, tallocated: 0
FML: MCP v9.05 FML v7.10.85.1240 Minecraft Forge 10.13.2.1240 5 mods loaded, 5 mods active
mcp{9.05} [Minecraft Coder Pack] (minecraft.jar) Unloaded->Constructed->Pre-initialized->Initialized->Post-initialized->Available->Available->Available->Available
FML{7.10.85.1240} [Forge Mod Loader] (forgeSrc-1.7.10-10.13.2.1240.jar) Unloaded->Constructed->Pre-initialized->Initialized->Post-initialized->Available->Available->Available->Available
Forge{10.13.2.1240} [Minecraft Forge] (forgeSrc-1.7.10-10.13.2.1240.jar) Unloaded->Constructed->Pre-initialized->Initialized->Post-initialized->Available->Available->Available->Available
labstuff{2.2} [LabStuff] (bin) Unloaded->Constructed->Pre-initialized->Initialized->Post-initialized->Available->Available->Available->Available
dlstuff{1.0} [DeathmanLabsStuff] (bin) Unloaded->Constructed->Pre-initialized->Initialized->Post-initialized->Available->Available->Available->Available
Profiler Position: N/A (disabled)
Vec3 Pool Size: 0 (0 bytes; 0 MB) allocated, 0 (0 bytes; 0 MB) used
Player Count: 1 / 8; [EntityPlayerMP['KeeganDeathman'/0, l='DLStuff', x=1292.30, y=56.00, z=892.40]]
Type: Integrated Server (map_client.txt)
Is Modded: Definitely; Client brand changed to 'fml,forge'

[shadow=gray,left][glow=red,2,300]KEEGAN[/glow][/shadow]

Posted

If my version of Forge is the same as yours, the error is here

                this.sendPacket(new S2FPacketSetSlot(this.playerEntity.openContainer.windowId, slot.slotNumber, this.playerEntity.inventory.getCurrentItem()));

 

Given that you're using a custom gui, I'm guessing that your container does something wrong here, i.e. returns a null slot.

 

            Slot slot = this.playerEntity.openContainer.getSlotFromInventory(this.playerEntity.inventory, this.playerEntity.inventory.currentItem);

 

You could test this by putting a breakpoint on the this.sendPacket line.

 

-TGG

Posted

Well, the container doesn't do much with slots, it simply acts as a medium between which the server and client TEs can interface.

I'll try that, and report back what happens

[shadow=gray,left][glow=red,2,300]KEEGAN[/glow][/shadow]

Posted

Here's an update to the code

@Override
    public boolean onBlockActivated(World world, int x, int y, int z, EntityPlayer player, int par6, float par7, float par8, float par9)
    {
    	if(world.isRemote == false)
    	{
    		TileEntityDLLaptop te = (TileEntityDLLaptop)world.getTileEntity(x, y, z);
    		if(!player.isSneaking() && te != null)
        	{
    			player.openGui(DLStuff.instance, 0, world, x, y, z);
        		if(player.inventory.getCurrentItem() != null && player.inventory.getCurrentItem().isItemEqual(new ItemStack(DLStuff.itemUnProgrammedDPad)) && te.noTablet)
        		{
        			player.inventory.decrStackSize(player.inventory.currentItem, 1);
        			te.setTabletItem(new ItemStack(DLStuff.itemUnProgrammedDPad));
            		te.noTablet = false;
            		world.markBlockForUpdate(x, y, z);
                	return true;
        		}
        		else if(!te.noTablet)
        		{
        			player.inventory.addItemStackToInventory(te.tabletItem);
        			te.noTablet = true;
        			te.setTabletItem(null);
        			world.markBlockForUpdate(x, y, z);
                	return true;
        		}
    		}
    	}
    	return false;
    }

 

Still can't figure it out.

[shadow=gray,left][glow=red,2,300]KEEGAN[/glow][/shadow]

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.