Jump to content

[ help ] - Can't call ItemStack methods from RenderGameOverlayEvent.


Recommended Posts



I can't seem to call any ItemStack methods inside a RenderGameOverlayEvent. It always gives a NullPointerException and it points at the line where the ItemStack method is, but it doesn't exactly explain why. Could any of you guys help?



public class ArmourOverlay extends Gui{

private Minecraft mc = Minecraft.getMinecraft();

private EntityPlayer p = mc.thePlayer;

public ArmourOverlay(Minecraft mc){
	this.mc = mc;

@ForgeSubscribe(priority = EventPriority.NORMAL)
public void onArmourChange(RenderGameOverlayEvent e){
	if (e.type == ElementType.ARMOR){
		if (p.getCurrentArmor(1).itemID == 310){




	at ws.mods.wsessentials.overlay.ArmourOverlay.onArmourChange(ArmourOverlay.java:31)
	at net.minecraftforge.event.ASMEventHandler_5_ArmourOverlay_onArmourChange_RenderGameOverlayEvent.invoke(.dynamic)
	at net.minecraftforge.event.ASMEventHandler.invoke(ASMEventHandler.java:39)
	at net.minecraftforge.event.EventBus.post(EventBus.java:108)
at net.minecraftforge.client.GuiIngameForge.pre(GuiIngameForge.java:861)
	at net.minecraftforge.client.GuiIngameForge.renderArmor(GuiIngameForge.java:259)
	at net.minecraftforge.client.GuiIngameForge.renderGameOverlay(GuiIngameForge.java:136)
	at net.minecraft.client.renderer.EntityRenderer.updateCameraAndRender(EntityRenderer.java:1014)
	at net.minecraft.client.Minecraft.runGameLoop(Minecraft.java:934)
	at net.minecraft.client.Minecraft.func_99999_d(Minecraft.java:826)
	at net.minecraft.client.main.Main.main(Main.java:93)
	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
	at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
	at java.lang.reflect.Method.invoke(Unknown Source)
at net.minecraft.launchwrapper.Launch.launch(Launch.java:57)
	at net.minecraft.launchwrapper.Launch.main(Launch.java:18)

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.

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.


  • Create New...

Important Information

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