Jump to content

Errors :(


NathanLeadill

Recommended Posts

I don't understand this error can anyone explain it to me? I get it when i press the key that should in theory, open up a gui.

[17:31:04] [Client thread/FATAL]: Unreported exception thrown!

java.lang.NullPointerException

at net.minecraft.crash.CrashReportCategory.firstTwoElementsOfStackTraceMatch(Unknown Source) ~[CrashReportCategory.class:?]

at net.minecraft.crash.CrashReport.makeCategoryDepth(Unknown Source) ~[CrashReport.class:?]

at net.minecraft.crash.CrashReport.makeCategory(Unknown Source) ~[CrashReport.class:?]

at net.minecraft.client.renderer.EntityRenderer.updateCameraAndRender(Unknown Source) ~[EntityRenderer.class:?]

at net.minecraft.client.Minecraft.runGameLoop(Unknown Source) ~[Minecraft.class:?]

at net.minecraft.client.Minecraft.run(Unknown Source) [Minecraft.class:?]

at net.minecraft.client.main.Main.main(Unknown Source) [Main.class:?]

at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) ~[?:1.8.0_51]

at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) ~[?:1.8.0_51]

at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) ~[?:1.8.0_51]

at java.lang.reflect.Method.invoke(Method.java:497) ~[?:1.8.0_51]

at net.minecraft.launchwrapper.Launch.launch(Launch.java:135) [launchwrapper-1.12.jar:?]

at net.minecraft.launchwrapper.Launch.main(Launch.java:28) [launchwrapper-1.12.jar:?]

at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) ~[?:1.8.0_51]

at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) ~[?:1.8.0_51]

at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) ~[?:1.8.0_51]

at java.lang.reflect.Method.invoke(Method.java:497) ~[?:1.8.0_51]

at net.minecraftforge.gradle.GradleStartCommon.launch(Unknown Source) [start/:?]

at GradleStart.main(Unknown Source) [start/:?]

[17:31:04] [Client thread/INFO] [sTDOUT]: [net.minecraft.init.Bootstrap:printToSYSOUT:-1]: ---- Minecraft Crash Report ----

// Don't do that.

 

Time: 16/09/15 17:31

Description: Unexpected error

 

java.lang.NullPointerException: Unexpected error

at net.minecraft.crash.CrashReportCategory.firstTwoElementsOfStackTraceMatch(Unknown Source)

at net.minecraft.crash.CrashReport.makeCategoryDepth(Unknown Source)

at net.minecraft.crash.CrashReport.makeCategory(Unknown Source)

at net.minecraft.client.renderer.EntityRenderer.updateCameraAndRender(Unknown Source)

at net.minecraft.client.Minecraft.runGameLoop(Unknown Source)

at net.minecraft.client.Minecraft.run(Unknown Source)

at net.minecraft.client.main.Main.main(Unknown Source)

at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)

at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)

at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)

at java.lang.reflect.Method.invoke(Method.java:497)

at net.minecraft.launchwrapper.Launch.launch(Launch.java:135)

at net.minecraft.launchwrapper.Launch.main(Launch.java:28)

at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)

at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)

at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)

at java.lang.reflect.Method.invoke(Method.java:497)

at net.minecraftforge.gradle.GradleStartCommon.launch(Unknown Source)

at GradleStart.main(Unknown Source)

 

 

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

---------------------------------------------------------------------------------------

 

Link to comment
Share on other sites

Show your code.

 

package com.zombiesurvival.client.utils;

import org.lwjgl.input.Keyboard;

import net.minecraft.client.settings.KeyBinding;
import net.minecraftforge.fml.client.registry.ClientRegistry;

public class KeyBindings {
    public static KeyBinding openGUI;
    public static KeyBinding shoot;
    public static KeyBinding aim;
    public static KeyBinding chat;
    public static KeyBinding reload;
    public static void init() {
    openGUI = new KeyBinding("key.openGUI", Keyboard.KEY_Z, "key.test.zombiesurvival");
    ClientRegistry.registerKeyBinding(openGUI);
    
    }
}

package com.zombiesurvival.client.utils;


import com.zombiesurvival.Main;

import com.zombiesurvival.client.gui.inventory.GuiZS_PlayerInventory;
import com.zombiesurvival.common.handlers.ModGuiHandler;

import net.minecraft.client.Minecraft;
import net.minecraft.client.entity.EntityPlayerSP;
import net.minecraft.world.World;
import net.minecraftforge.fml.common.eventhandler.SubscribeEvent;
import net.minecraftforge.fml.common.gameevent.InputEvent;
public class KeyInputHandler {
@SubscribeEvent
public void onKeyInput(InputEvent.KeyInputEvent event) 
{
  if(KeyBindings.openGUI.isPressed())
  {
  EntityPlayerSP player = Minecraft.getMinecraft().thePlayer;
  World world = Minecraft.getMinecraft().theWorld;
  Object MainLol = Main.instance;
  int x = (int)player.posX;
  int y = (int)player.posY;
  int z = (int)player.posZ;
  player.openGui(MainLol, ModGuiHandler.PLAYERIVENTORY, world, x, y, z);
  }
}
}

package com.zombiesurvival.common.handlers;

import com.zombiesurvival.client.gui.inventory.GuiZS_PlayerInventory;

import com.zombiesurvival.client.gui.inventory.ContainerZS_PlayerInventory;

import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.world.World;
import net.minecraftforge.fml.common.network.IGuiHandler;

public class ModGuiHandler implements IGuiHandler
{
public static final int PLAYERIVENTORY = 0;
@Override
public Object getServerGuiElement(int ID, EntityPlayer player, World world, int x, int y, int z) 
{
        switch(ID)
        {
        case 0: return new ContainerZS_PlayerInventory(player);
        }
	return null;
}

@Override
public Object getClientGuiElement(int ID, EntityPlayer player, World world, int x, int y, int z)
{
	  switch(ID)
        {
        case 0: return new GuiZS_PlayerInventory(player);
        }
	return null;
}

}

 

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.