Jump to content

[1.7.2] ItemStack of "head"


NomNuggetNom

Recommended Posts

So, here's what I'm trying:

new ItemStack(Blocks.skull, 1, 3)

Blocks.skull is the skull, and metadata 3 is the "Head" (the steve head). This crashes my game though.

 

java.lang.NullPointerException: Rendering item
at net.minecraft.item.ItemStack.getItemDamage(ItemStack.java:266)

 

So how do I create an ItemStack of "head"?

Link to comment
Share on other sites

At which point do you create that ItemStack? The crash suggests that the Item instance of the ItemStack is null, which shouldn't happen.

 

EntityJoinWorldEvent. I've extended the achievement class to make custom notifications, and I was trying to call one.

 

@SubscribeEvent
public void onJoin(EntityJoinWorldEvent event) {
	if (event.entity instanceof EntityPlayer && !mc.isSingleplayer()) {
		EntityPlayer player = (EntityPlayer) event.entity;
		if (Main.membersList.contains(player.getDisplayName()) 
				&& !player.getDisplayName().equals(mc.thePlayer.getDisplayName())) {
			alert.sendAlertWithItem("A clan member joined!", player.getDisplayName() + " is now online.", -1, new ItemStack(Blocks.skull, 1, 1));
		}
	}
}

Link to comment
Share on other sites

Huh, that is really weird. I doubt that is the issue though. Does the error go away if you remove that particular method? If not, post it.

 

I changed it to a different block and it works fine.

 

new ItemStack(Blocks.wool, 1, 1));

 

Sorry, which method did you need?

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