Posted July 6, 201411 yr 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"?
July 6, 201411 yr Author 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)); } } }
July 6, 201411 yr Author 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?
July 6, 201411 yr Author Oh right, I forgot. In 1.7 some stuff about Blocks and Items changes, so some Blocks which are "technical" blocks (you never get them in your inventory) don't have an ItemBlock anymore, hence the NPE. Use Items.skull. Exactly right, thanks!
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.