Jump to content

Recommended Posts

Posted

Hello, my minecraft crashes when I try it in the real launcher, crash:

[17:33:41] [Client thread/ERROR] [FML]: Exception caught during firing event net.minecraftforge.client.event.GuiScreenEvent$InitGuiEvent$Post@df6cc57:
java.lang.NullPointerException
at com.Egietje.degeweldigemod.handler.CheeseClientHandler.onGuiPostInit(CheeseClientHandler.java:101) ~[CheeseClientHandler.class:?]
at net.minecraftforge.fml.common.eventhandler.ASMEventHandler_11_CheeseClientHandler_onGuiPostInit_Post.invoke(.dynamic) ~[?:?]
at net.minecraftforge.fml.common.eventhandler.ASMEventHandler.invoke(ASMEventHandler.java:90) ~[ASMEventHandler.class:?]
at net.minecraftforge.fml.common.eventhandler.EventBus.post(EventBus.java:185) [EventBus.class:?]
at net.minecraft.client.gui.GuiScreen.func_146280_a(GuiScreen.java:489) [bho.class:?]
at net.minecraft.client.Minecraft.func_147108_a(Minecraft.java:966) [bes.class:?]
at net.minecraft.client.gui.GuiWorldSelection.func_146284_a(SourceFile:85) [bka.class:?]
at net.minecraft.client.gui.GuiScreen.func_73864_a(GuiScreen.java:452) [bho.class:?]
at net.minecraft.client.gui.GuiWorldSelection.func_73864_a(SourceFile:116) [bka.class:?]
at net.minecraft.client.gui.GuiScreen.func_146274_d(GuiScreen.java:542) [bho.class:?]
at net.minecraft.client.gui.GuiWorldSelection.func_146274_d(SourceFile:49) [bka.class:?]
at net.minecraft.client.gui.GuiScreen.func_146269_k(GuiScreen.java:510) [bho.class:?]
at net.minecraft.client.Minecraft.func_71407_l(Minecraft.java:1695) [bes.class:?]
at net.minecraft.client.Minecraft.func_71411_J(Minecraft.java:1056) [bes.class:?]
at net.minecraft.client.Minecraft.func_99999_d(Minecraft.java:372) [bes.class:?]
at net.minecraft.client.main.Main.main(SourceFile:124) [Main.class:?]
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) ~[?:1.8.0_25]
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) ~[?:1.8.0_25]
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) ~[?:1.8.0_25]
at java.lang.reflect.Method.invoke(Method.java:483) ~[?:1.8.0_25]
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:?]

Client handler:

	@SubscribeEvent
public void onGuiPostInit(GuiScreenEvent.InitGuiEvent.Post event) {
	GuiScreen gui = event.getGui();
	if (gui instanceof GuiCreateWorld) {
		List<GuiButton> buttonList = event.getButtonList();
		GuiButton giveItem;
		giveItem = addButton(new GuiButton(11, gui.width / 2 + 5, 187, 150, 20, "Give Items: OFF"), buttonList); LINE 101
		giveItem.visible = (Boolean) CheeseUtils.getField(GuiCreateWorld.class, gui, "inMoreWorldOptionsDisplay");
		for (int i = 0; i < buttonList.size(); i++) {
			GuiButton button = event.getButtonList().get(i);
			if (button.id == 3) {
				if ((Boolean) CheeseUtils.getField(GuiCreateWorld.class, gui, "inMoreWorldOptionsDisplay")) {
					button.xPosition = gui.width / 2 - 155;
				} else {
					button.xPosition = gui.width / 2 - 75;
				}
			}
		}
	}
}

protected <T extends GuiButton> T addButton(T button, List<GuiButton> list) {
	list.add(button);
	return button;
}

Classes: 94

Lines of code: 12173

Other files: 206

Github repo: https://github.com/KokkieBeer/DeGeweldigeMod

Posted
	@SubscribeEvent
public void onGuiPostInit(GuiScreenEvent.InitGuiEvent.Post event) {
	GuiScreen gui = event.getGui();
	if (gui instanceof GuiCreateWorld) {
	List<GuiButton> buttonList = event.getButtonList();
		GuiButton giveItem;
		giveItem = addButton(new GuiButton(11, gui.width / 2 + 5, 187, 150, 20, "Give Items: OFF"), buttonList); LINE 101
		giveItem.visible = (Boolean) CheeseUtils.getField(GuiCreateWorld.class, gui, "inMoreWorldOptionsDisplay");
		for (int i = 0; i < buttonList.size(); i++) {
			GuiButton button = event.getButtonList().get(i);
			if (button.id == 3) {
				if ((Boolean) CheeseUtils.getField(GuiCreateWorld.class, gui, "inMoreWorldOptionsDisplay")) {
					button.xPosition = gui.width / 2 - 155;
				} else {
					button.xPosition = gui.width / 2 - 75;
				}
			}
		}
	}
}

protected <T extends GuiButton> T addButton(T button, List<GuiButton> list) {
	list.add(button);
	return button;
}

If you would just take a look....

Classes: 94

Lines of code: 12173

Other files: 206

Github repo: https://github.com/KokkieBeer/DeGeweldigeMod

Posted

What is line 101?

 

He'd marked it in his OP.

giveItem = addButton(new GuiButton(11, gui.width / 2 + 5, 187, 150, 20, "Give Items: OFF"), buttonList); LINE 101

But I don't see what could be null on that line.

Apparently I'm a complete and utter jerk and come to this forum just like to make fun of people, be confrontational, and make your personal life miserable.  If you think this is the case, JUST REPORT ME.  Otherwise you're just going to get reported when you reply to my posts and point it out, because odds are, I was trying to be nice.

 

Exception: If you do not understand Java, I WILL NOT HELP YOU and your thread will get locked.

 

DO NOT PM ME WITH PROBLEMS. No help will be given.

Posted
	private static final Field inMoreWorldOptionsDisplay = ReflectionHelper.findField(GuiCreateWorld.class, "field_146344_y", "inMoreWorldOptionsDisplay");

@SubscribeEvent
public void onGuiPostInit(GuiScreenEvent.InitGuiEvent.Post event) {
	GuiScreen gui = event.getGui();
	if (gui instanceof GuiCreateWorld) {
		List<GuiButton> buttonList = event.getButtonList();
		GuiButton giveItem;
		giveItem = addButton(new GuiButton(11, gui.width / 2 + 5, 187, 150, 20, "Give Items: OFF"), buttonList);
		giveItem.visible = inMoreWorldOptionsDisplay.getBoolean(gui);
		ShouldGiveItems.worldCreateGive = false;
		for (int i = 0; i < buttonList.size(); i++) {
			GuiButton button = event.getButtonList().get(i);
			if (button.id == 3) {
				if (inMoreWorldOptionsDisplay.getBoolean(gui)) {
					button.xPosition = gui.width / 2 - 155;
				} else {
					button.xPosition = gui.width / 2 - 75;
				}
			}
		}
	}
}

What should I do exceptions?

Classes: 94

Lines of code: 12173

Other files: 206

Github repo: https://github.com/KokkieBeer/DeGeweldigeMod

Guest
This topic is now closed to further replies.

Announcements



×
×
  • Create New...

Important Information

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