Jump to content

Recommended Posts

Posted

Hi guys, I have a problem that I can't figure out.  ???

 

2013-08-13 18:58:44 [iNFO] [sTDOUT] java.lang.NullPointerException
2013-08-13 18:58:44 [iNFO] [sTDOUT] 	at wikilink.utility.ItemInfoHandler.getInfo(ItemInfoHandler.java:74)
2013-08-13 18:58:44 [iNFO] [sTDOUT] 	at wikilink.handlers.PlayerTickHandler.playerTick(PlayerTickHandler.java:46)
2013-08-13 18:58:44 [iNFO] [sTDOUT] 	at wikilink.handlers.PlayerTickHandler.tickStart(PlayerTickHandler.java:24)
2013-08-13 18:58:44 [iNFO] [sTDOUT] 	at cpw.mods.fml.common.SingleIntervalHandler.tickStart(SingleIntervalHandler.java:28)
2013-08-13 18:58:44 [iNFO] [sTDOUT] 	at cpw.mods.fml.common.FMLCommonHandler.tickStart(FMLCommonHandler.java:122)
2013-08-13 18:58:44 [iNFO] [sTDOUT] 	at cpw.mods.fml.common.FMLCommonHandler.onPlayerPreTick(FMLCommonHandler.java:383)
2013-08-13 18:58:44 [iNFO] [sTDOUT] 	at net.minecraft.entity.player.EntityPlayer.onUpdate(EntityPlayer.java:281)
2013-08-13 18:58:44 [iNFO] [sTDOUT] 	at net.minecraft.entity.player.EntityPlayerMP.onUpdateEntity(EntityPlayerMP.java:324)
2013-08-13 18:58:44 [iNFO] [sTDOUT] 	at net.minecraft.network.NetServerHandler.handleFlying(NetServerHandler.java:304)
2013-08-13 18:58:44 [iNFO] [sTDOUT] 	at net.minecraft.network.packet.Packet10Flying.processPacket(Packet10Flying.java:51)
2013-08-13 18:58:44 [iNFO] [sTDOUT] 	at net.minecraft.network.MemoryConnection.processReadPackets(MemoryConnection.java:89)
2013-08-13 18:58:44 [iNFO] [sTDOUT] 	at net.minecraft.network.NetServerHandler.networkTick(NetServerHandler.java:141)
2013-08-13 18:58:44 [iNFO] [sTDOUT] 	at net.minecraft.network.NetworkListenThread.networkTick(NetworkListenThread.java:54)
2013-08-13 18:58:44 [iNFO] [sTDOUT] 	at net.minecraft.server.integrated.IntegratedServerListenThread.networkTick(IntegratedServerListenThread.java:109)
2013-08-13 18:58:44 [iNFO] [sTDOUT] 	at net.minecraft.server.MinecraftServer.updateTimeLightAndEntities(MinecraftServer.java:689)
2013-08-13 18:58:44 [iNFO] [sTDOUT] 	at net.minecraft.server.MinecraftServer.tick(MinecraftServer.java:585)
2013-08-13 18:58:44 [iNFO] [sTDOUT] 	at net.minecraft.server.integrated.IntegratedServer.tick(IntegratedServer.java:129)
2013-08-13 18:58:44 [iNFO] [sTDOUT] 	at net.minecraft.server.MinecraftServer.run(MinecraftServer.java:482)
2013-08-13 18:58:44 [iNFO] [sTDOUT] 	at net.minecraft.server.ThreadMinecraftServer.run(ThreadMinecraftServer.java:16)
2013-08-13 18:58:44 [iNFO] [sTDOUT] 
2013-08-13 18:58:44 [iNFO] [sTDOUT] 
2013-08-13 18:58:44 [iNFO] [sTDOUT] A detailed walkthrough of the error, its code path and all known details is as follows:
2013-08-13 18:58:44 [iNFO] [sTDOUT] ---------------------------------------------------------------------------------------
2013-08-13 18:58:44 [iNFO] [sTDOUT] 
2013-08-13 18:58:44 [iNFO] [sTDOUT] -- Head --
2013-08-13 18:58:44 [iNFO] [sTDOUT] Stacktrace:
2013-08-13 18:58:44 [iNFO] [sTDOUT] 	at wikilink.utility.ItemInfoHandler.getInfo(ItemInfoHandler.java:74)
2013-08-13 18:58:44 [iNFO] [sTDOUT] 	at wikilink.handlers.PlayerTickHandler.playerTick(PlayerTickHandler.java:46)
2013-08-13 18:58:44 [iNFO] [sTDOUT] 	at wikilink.handlers.PlayerTickHandler.tickStart(PlayerTickHandler.java:24)
2013-08-13 18:58:44 [iNFO] [sTDOUT] 	at cpw.mods.fml.common.SingleIntervalHandler.tickStart(SingleIntervalHandler.java:28)
2013-08-13 18:58:44 [iNFO] [sTDOUT] 	at cpw.mods.fml.common.FMLCommonHandler.tickStart(FMLCommonHandler.java:122)
2013-08-13 18:58:44 [iNFO] [sTDOUT] 	at cpw.mods.fml.common.FMLCommonHandler.onPlayerPreTick(FMLCommonHandler.java:383)
2013-08-13 18:58:44 [iNFO] [sTDOUT] 	at net.minecraft.entity.player.EntityPlayer.onUpdate(EntityPlayer.java:281)
2013-08-13 18:58:44 [iNFO] [sTDOUT] 
2013-08-13 18:58:44 [iNFO] [sTDOUT] -- Player being ticked --
2013-08-13 18:58:44 [iNFO] [sTDOUT] Details:
2013-08-13 18:58:44 [iNFO] [sTDOUT] 	Entity Type: null (net.minecraft.entity.player.EntityPlayerMP)
2013-08-13 18:58:44 [iNFO] [sTDOUT] 	Entity ID: 22
2013-08-13 18:58:44 [iNFO] [sTDOUT] 	Entity Name: Player854
2013-08-13 18:58:44 [iNFO] [sTDOUT] 	Entity's Exact location: -522.75, 4.00, -522.36
2013-08-13 18:58:44 [iNFO] [sTDOUT] 	Entity's Block location: World: (-523,4,-523), Chunk: (at 5,0,5 in -33,-33; contains blocks -528,0,-528 to -513,255,-513), Region: (-2,-2; contains chunks -64,-64 to -33,-33, blocks -1024,0,-1024 to -513,255,-513)
2013-08-13 18:58:44 [iNFO] [sTDOUT] 	Entity's Momentum: 0.00, -0.08, 0.00
2013-08-13 18:58:44 [iNFO] [sTDOUT] Stacktrace:
2013-08-13 18:58:44 [iNFO] [sTDOUT] 	at net.minecraft.entity.player.EntityPlayerMP.onUpdateEntity(EntityPlayerMP.java:324)
2013-08-13 18:58:44 [iNFO] [sTDOUT] 	at net.minecraft.network.NetServerHandler.handleFlying(NetServerHandler.java:304)
2013-08-13 18:58:44 [iNFO] [sTDOUT] 	at net.minecraft.network.packet.Packet10Flying.processPacket(Packet10Flying.java:51)
2013-08-13 18:58:44 [iNFO] [sTDOUT] 	at net.minecraft.network.MemoryConnection.processReadPackets(MemoryConnection.java:89)
2013-08-13 18:58:44 [iNFO] [sTDOUT] 	at net.minecraft.network.NetServerHandler.networkTick(NetServerHandler.java:141)
2013-08-13 18:58:44 [iNFO] [sTDOUT] 
2013-08-13 18:58:44 [iNFO] [sTDOUT] -- Ticking connection --
2013-08-13 18:58:44 [iNFO] [sTDOUT] Details:
2013-08-13 18:58:44 [iNFO] [sTDOUT] 	Connection: net.minecraft.network.NetServerHandler@252b63c7
2013-08-13 18:58:44 [iNFO] [sTDOUT] Stacktrace:
2013-08-13 18:58:44 [iNFO] [sTDOUT] 	at net.minecraft.network.NetworkListenThread.networkTick(NetworkListenThread.java:54)
2013-08-13 18:58:44 [iNFO] [sTDOUT] 	at net.minecraft.server.integrated.IntegratedServerListenThread.networkTick(IntegratedServerListenThread.java:109)
2013-08-13 18:58:44 [iNFO] [sTDOUT] 	at net.minecraft.server.MinecraftServer.updateTimeLightAndEntities(MinecraftServer.java:689)
2013-08-13 18:58:44 [iNFO] [sTDOUT] 	at net.minecraft.server.MinecraftServer.tick(MinecraftServer.java:585)
2013-08-13 18:58:44 [iNFO] [sTDOUT] 	at net.minecraft.server.integrated.IntegratedServer.tick(IntegratedServer.java:129)
2013-08-13 18:58:44 [iNFO] [sTDOUT] 	at net.minecraft.server.MinecraftServer.run(MinecraftServer.java:482)
2013-08-13 18:58:44 [iNFO] [sTDOUT] 	at net.minecraft.server.ThreadMinecraftServer.run(ThreadMinecraftServer.java:16)
2013-08-13 18:58:44 [iNFO] [sTDOUT] 

 

Here is my code.

public class ItemInfoHandler 
{

public static boolean found;
public static int matchedId;
public static String matchedName;
public static String matchedModId;

// This matches the held item with an ID.	
public static void idMatcher(EntityPlayer player)
{	
		matchedId = (player.getHeldItem().itemID);
		matchedName = (player.getHeldItem().getDisplayName());
}

private static ItemData itemList(NBTBase base) 
{
	//Auto-generated method stub
	return null;
}

// This gets the NBT info

public static void getInfo(EntityPlayer player)
{	


	NBTTagList itemList = new NBTTagList();

	GameData.writeItemData(itemList);

	ArrayList<ItemData> data = new ArrayList();

	NBTBase base;

	NBTFinder:
	for(int i = 0; i < itemList.tagCount(); i++)
	{

		base = itemList.tagAt(i);

		if(base instanceof NBTTagCompound)
		{
			found = false;
			data.add(itemList(base));

					for (int x = 0; x < WikiLinkableHandler.modIdList.size(); x++)
					{
						// Does this item correspond with a registered mod ID?
						if((base).toString().contains("ModId:" + ((WikiLinkableHandler.modIdList).get(x))) && (base).toString().contains("ItemId:" + matchedId))
						{
							String currentLanguage = Minecraft.getMinecraft().gameSettings.language;
							System.out.println(WikiLinkableHandler.localizationList.get(x));

							if((WikiLinkableHandler.localizationList.get(x)).toString().equals(currentLanguage))
							{				
								String hyperlink = "http://" + WikiLinkableHandler.domainList.get(x) + WikiLinkableHandler.getSearchQuery(x) + matchedName.replace(" ", "+");

								//This needs to be localized.
								//player.addChatMessage("Searching for " + matchedName + " on the " + WikiLinkableHandler.nameList.get(x));

								BrowserHandler.browserInit(hyperlink, player);

								found = true;
								break NBTFinder;
							}
							else if(WikiLinkableHandler.localizationList.get(x).toString().equals(null) && found == false)
							{
								player.addChatMessage("Could not find wiki translation for your language: " + (Minecraft.getMinecraft().gameSettings.language));
								String hyperlink = "http://" + WikiLinkableHandler.domainList.get(0) + WikiLinkableHandler.getSearchQuery(0) + matchedName.replace(" ", "+");

								player.addChatMessage("Searching for " + matchedName + " on the " + WikiLinkableHandler.nameList.get(0));

								  BrowserHandler.browserInit(hyperlink, player);			  

								  found = true;
								  break NBTFinder;
							}
							else{continue;}
						}
						else{continue;}		
					}
		}

	}			
	if(found == false)
		{
			player.addChatMessage("Cannot find mod-related wiki to search! Searching default wiki.");

			player.addChatMessage("Could not find an accurate translation for your language: " + (Minecraft.getMinecraft().gameSettings.language));

			String hyperlink = "http://" + WikiLinkableHandler.domainList.get(0) + WikiLinkableHandler.getSearchQuery(0) + matchedName.replace(" ", "+");

			player.addChatMessage("Searching for " + matchedName + " on the " + WikiLinkableHandler.nameList.get(0));

			  BrowserHandler.browserInit(hyperlink, player);			  
		}
}	
}	

 

and I'm getting the error on this line.

if((WikiLinkableHandler.localizationList.get(x)).toString().equals(currentLanguage))

 

I honestly have no explanation. The code worked earlier, but now it doesn't and I have no clue why. Anyone have any clues?

Follow me on twitter! @keepablock

Read up on whats new! www.catacombs.co

width=700 height=60http://electronic-chronic.com/assets/keep-a-block/wikilink/wikilink_logo.png[/img]

Posted

Why don't you do a null check before hand? That would fix that.

if ((WikiLinkableHandler.localizationList.get(x)).toString() != null)

// or was it?
if (!(WikiLinkableHandler.localizationList.get(x)).toString().equals(null))

 

Aside from that... I don't know.

 

 

 

What does the sysout print to the console??

I am Mew. The Legendary Psychic. I behave oddly and am always playing practical jokes.

 

I have also found that I really love making extremely long and extremely but sometimes not so descriptive variables. Sort of like what I just did there xD

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.