Jump to content

[1.15.2] Make server summon entity based on client


TallYate

Recommended Posts

public class key {
	private final int key;

	public key(int keyIn) {
		this.key = keyIn;
	}

	public static void encode(key msg, PacketBuffer buf) {
		buf.writeInt(msg.key);
	}

	public static key decode(PacketBuffer buf) {
		return new key(buf.readInt());
	}

	public static void handle(key msg, Supplier<NetworkEvent.Context> ctx) {
		if(msg.key==0 && ctx.get().getSender().getItemStackFromSlot(EquipmentSlotType.FEET).getItem()==ModItems.KABOOTS.get()) {
		    ctx.get().enqueueWork(() -> {
		        ServerPlayerEntity sender = ctx.get().getSender();
		        Vec3d pos = sender.getPositionVec();
		        sender.world.addEntity(new TNTEntity(sender.world, pos.getX(), pos.getY(), pos.getZ(), sender));
		    });
		}
	    ctx.get().setPacketHandled(true);
	}
}
@Mod.EventBusSubscriber(modid = CrudeTechMod.MOD_ID, bus = Bus.FORGE)
public class KeyBinds {
	
	static KeyBinding[] keyBindings = new KeyBinding[1]; 
	
	public static final KeyBinding keyExplosiveJump = new KeyBinding("Explosive Jump", GLFW.GLFW_KEY_Y, "Crude Tech");
		static Boolean keyExplosiveJumpPress = false;
	
	public static void registerKeyBindings() {
		for(int i=0; i<keyBindings.length; i++) {
			ClientRegistry.registerKeyBinding(keyBindings[i]);
		}
	}
	
	private static final String PROTOCOL_VERSION = "1";
	public static final SimpleChannel INSTANCE = NetworkRegistry.newSimpleChannel(
	    new ResourceLocation(CrudeTechMod.MOD_ID, "explosivejump"),
	    () -> PROTOCOL_VERSION,
	    PROTOCOL_VERSION::equals,
	    PROTOCOL_VERSION::equals
	);
	
	@SubscribeEvent
	public static void onInput (InputEvent.KeyInputEvent event) {
		if(event.getKey()==keyExplosiveJump.getKey().getKeyCode() && !keyExplosiveJumpPress) {
			CrudeTechMod.log("pressed");
			INSTANCE.sendToServer(new key(0));
			keyExplosiveJumpPress=true;
		}
	}
	
	
	@SubscribeEvent
	public static void onTick (ClientTickEvent event) {
		if(keyExplosiveJumpPress) {
			if(!keyExplosiveJump.isKeyDown()) {
				keyExplosiveJumpPress=false;
			}
		}
	}
	
}

This crashes the game when y is pressed

Link to comment
Share on other sites

[m[1;31m[21:31:27] [Render thread/ERROR] [ne.mi.fm.ne.si.IndexedMessageCodec/SIMPLENET]: Received invalid message me.joshua.crudetechmod.key on channel crudetech:explosivejump
[m[1;31m[21:31:27] [Render thread/ERROR] [ne.mi.ev.EventBus/EVENTBUS]: Exception caught during firing event: Invalid message me.joshua.crudetechmod.key
	Index: 1
	Listeners:
		0: NORMAL
		1: ASM: class me.joshua.crudetechmod.KeyBinds onInput(Lnet/minecraftforge/client/event/InputEvent$KeyInputEvent;)V
java.lang.IllegalArgumentException: Invalid message me.joshua.crudetechmod.key
	at net.minecraftforge.fml.network.simple.IndexedMessageCodec.build(IndexedMessageCodec.java:145)
	at net.minecraftforge.fml.network.simple.SimpleChannel.encodeMessage(SimpleChannel.java:85)
	at net.minecraftforge.fml.network.simple.SimpleChannel.toBuffer(SimpleChannel.java:98)
	at net.minecraftforge.fml.network.simple.SimpleChannel.toVanillaPacket(SimpleChannel.java:129)
	at net.minecraftforge.fml.network.simple.SimpleChannel.sendTo(SimpleChannel.java:109)
	at net.minecraftforge.fml.network.simple.SimpleChannel.sendToServer(SimpleChannel.java:104)
	at me.joshua.crudetechmod.KeyBinds.onInput(KeyBinds.java:53)
	at net.minecraftforge.eventbus.ASMEventHandler_2_KeyBinds_onInput_KeyInputEvent.invoke(.dynamic)
	at net.minecraftforge.eventbus.ASMEventHandler.invoke(ASMEventHandler.java:80)
	at net.minecraftforge.eventbus.EventBus.post(EventBus.java:258)
	at net.minecraftforge.client.ForgeHooksClient.fireKeyInput(ForgeHooksClient.java:798)
	at net.minecraft.client.KeyboardListener.onKeyEvent(KeyboardListener.java:364)
	at net.minecraft.client.KeyboardListener.lambda$null$7(KeyboardListener.java:399)
	at net.minecraft.util.concurrent.ThreadTaskExecutor.execute(ThreadTaskExecutor.java:86)
	at net.minecraft.client.KeyboardListener.lambda$setupCallbacks$8(KeyboardListener.java:398)
	at org.lwjgl.glfw.GLFWKeyCallbackI.callback(GLFWKeyCallbackI.java:37)
	at org.lwjgl.system.JNI.invokeV(Native Method)
	at org.lwjgl.glfw.GLFW.glfwPollEvents(GLFW.java:3101)
	at com.mojang.blaze3d.systems.RenderSystem.flipFrame(RenderSystem.java:85)
	at net.minecraft.client.MainWindow.flipFrame(MainWindow.java:296)
	at net.minecraft.client.Minecraft.runGameLoop(Minecraft.java:983)
	at net.minecraft.client.Minecraft.run(Minecraft.java:558)
	at net.minecraft.client.main.Main.main(Main.java:177)
	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.minecraftforge.userdev.FMLUserdevClientLaunchProvider.lambda$launchService$0(FMLUserdevClientLaunchProvider.java:55)
	at cpw.mods.modlauncher.LaunchServiceHandlerDecorator.launch(LaunchServiceHandlerDecorator.java:37)
	at cpw.mods.modlauncher.LaunchServiceHandler.launch(LaunchServiceHandler.java:54)
	at cpw.mods.modlauncher.LaunchServiceHandler.launch(LaunchServiceHandler.java:72)
	at cpw.mods.modlauncher.Launcher.run(Launcher.java:81)
	at cpw.mods.modlauncher.Launcher.main(Launcher.java:65)
	at net.minecraftforge.userdev.LaunchTesting.main(LaunchTesting.java:102)

[m[1;31m[21:31:27] [Render thread/FATAL] [minecraft/Minecraft]: Unreported exception thrown!
java.lang.IllegalArgumentException: Invalid message me.joshua.crudetechmod.key
	at net.minecraftforge.fml.network.simple.IndexedMessageCodec.build(IndexedMessageCodec.java:145) ~[forge-1.15.2-31.2.0_mapped_snapshot_20200514-1.15.1-recomp.jar:?] {re:classloading}
	at net.minecraftforge.fml.network.simple.SimpleChannel.encodeMessage(SimpleChannel.java:85) ~[forge-1.15.2-31.2.0_mapped_snapshot_20200514-1.15.1-recomp.jar:?] {re:classloading}
	at net.minecraftforge.fml.network.simple.SimpleChannel.toBuffer(SimpleChannel.java:98) ~[forge-1.15.2-31.2.0_mapped_snapshot_20200514-1.15.1-recomp.jar:?] {re:classloading}
	at net.minecraftforge.fml.network.simple.SimpleChannel.toVanillaPacket(SimpleChannel.java:129) ~[forge-1.15.2-31.2.0_mapped_snapshot_20200514-1.15.1-recomp.jar:?] {re:classloading}
	at net.minecraftforge.fml.network.simple.SimpleChannel.sendTo(SimpleChannel.java:109) ~[forge-1.15.2-31.2.0_mapped_snapshot_20200514-1.15.1-recomp.jar:?] {re:classloading}
	at net.minecraftforge.fml.network.simple.SimpleChannel.sendToServer(SimpleChannel.java:104) ~[forge-1.15.2-31.2.0_mapped_snapshot_20200514-1.15.1-recomp.jar:?] {re:classloading}
	at me.joshua.crudetechmod.KeyBinds.onInput(KeyBinds.java:53) ~[main/:?] {re:classloading}
	at net.minecraftforge.eventbus.ASMEventHandler_2_KeyBinds_onInput_KeyInputEvent.invoke(.dynamic) ~[?:?] {}
	at net.minecraftforge.eventbus.ASMEventHandler.invoke(ASMEventHandler.java:80) ~[eventbus-2.2.0-service.jar:?] {}
	at net.minecraftforge.eventbus.EventBus.post(EventBus.java:258) ~[eventbus-2.2.0-service.jar:?] {}
	at net.minecraftforge.client.ForgeHooksClient.fireKeyInput(ForgeHooksClient.java:798) ~[forge-1.15.2-31.2.0_mapped_snapshot_20200514-1.15.1-recomp.jar:?] {re:classloading}
	at net.minecraft.client.KeyboardListener.onKeyEvent(KeyboardListener.java:364) ~[forge-1.15.2-31.2.0_mapped_snapshot_20200514-1.15.1-recomp.jar:?] {re:classloading,pl:runtimedistcleaner:A}
	at net.minecraft.client.KeyboardListener.lambda$null$7(KeyboardListener.java:399) ~[forge-1.15.2-31.2.0_mapped_snapshot_20200514-1.15.1-recomp.jar:?] {re:classloading,pl:runtimedistcleaner:A}
	at net.minecraft.util.concurrent.ThreadTaskExecutor.execute(ThreadTaskExecutor.java:86) ~[forge-1.15.2-31.2.0_mapped_snapshot_20200514-1.15.1-recomp.jar:?] {re:classloading,pl:accesstransformer:B}
	at net.minecraft.client.KeyboardListener.lambda$setupCallbacks$8(KeyboardListener.java:398) ~[forge-1.15.2-31.2.0_mapped_snapshot_20200514-1.15.1-recomp.jar:?] {re:classloading,pl:runtimedistcleaner:A}
	at org.lwjgl.glfw.GLFWKeyCallbackI.callback(GLFWKeyCallbackI.java:37) ~[lwjgl-glfw-3.2.2.jar:build 10] {}
	at org.lwjgl.system.JNI.invokeV(Native Method) ~[lwjgl-3.2.2.jar:build 10] {}
	at org.lwjgl.glfw.GLFW.glfwPollEvents(GLFW.java:3101) ~[lwjgl-glfw-3.2.2.jar:build 10] {}
	at com.mojang.blaze3d.systems.RenderSystem.flipFrame(RenderSystem.java:85) ~[forge-1.15.2-31.2.0_mapped_snapshot_20200514-1.15.1-recomp.jar:?] {re:classloading,pl:runtimedistcleaner:A}
	at net.minecraft.client.MainWindow.flipFrame(MainWindow.java:296) ~[forge-1.15.2-31.2.0_mapped_snapshot_20200514-1.15.1-recomp.jar:?] {re:classloading,pl:runtimedistcleaner:A}
	at net.minecraft.client.Minecraft.runGameLoop(Minecraft.java:983) ~[forge-1.15.2-31.2.0_mapped_snapshot_20200514-1.15.1-recomp.jar:?] {re:classloading,pl:accesstransformer:B,pl:runtimedistcleaner:A}
	at net.minecraft.client.Minecraft.run(Minecraft.java:558) ~[forge-1.15.2-31.2.0_mapped_snapshot_20200514-1.15.1-recomp.jar:?] {re:classloading,pl:accesstransformer:B,pl:runtimedistcleaner:A}
	at net.minecraft.client.main.Main.main(Main.java:177) ~[forge-1.15.2-31.2.0_mapped_snapshot_20200514-1.15.1-recomp.jar:?] {re:classloading,pl:runtimedistcleaner:A}
	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) ~[?:1.8.0_231] {}
	at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source) ~[?:1.8.0_231] {}
	at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source) ~[?:1.8.0_231] {}
	at java.lang.reflect.Method.invoke(Unknown Source) ~[?:1.8.0_231] {}
	at net.minecraftforge.userdev.FMLUserdevClientLaunchProvider.lambda$launchService$0(FMLUserdevClientLaunchProvider.java:55) ~[forge-1.15.2-31.2.0_mapped_snapshot_20200514-1.15.1-recomp.jar:?] {}
	at cpw.mods.modlauncher.LaunchServiceHandlerDecorator.launch(LaunchServiceHandlerDecorator.java:37) [modlauncher-5.1.0.jar:?] {}
	at cpw.mods.modlauncher.LaunchServiceHandler.launch(LaunchServiceHandler.java:54) [modlauncher-5.1.0.jar:?] {}
	at cpw.mods.modlauncher.LaunchServiceHandler.launch(LaunchServiceHandler.java:72) [modlauncher-5.1.0.jar:?] {}
	at cpw.mods.modlauncher.Launcher.run(Launcher.java:81) [modlauncher-5.1.0.jar:?] {}
	at cpw.mods.modlauncher.Launcher.main(Launcher.java:65) [modlauncher-5.1.0.jar:?] {}
	at net.minecraftforge.userdev.LaunchTesting.main(LaunchTesting.java:102) [forge-1.15.2-31.2.0_mapped_snapshot_20200514-1.15.1-recomp.jar:?] {}
[m[32m[21:31:28] [Server thread/INFO] [minecraft/MinecraftServer]: Stopping server

What do you mean by register the packet?
 

7 hours ago, [NoOneButNo] said:

Never trust the client. Just send a packet (like what you are doing) and do the check in the packet itself.

I thought the handle was server side. How do you check in the packet itself?

Link to comment
Share on other sites

It works now

private static final String PROTOCOL_VERSION = "1";
	public static final SimpleChannel INSTANCE = NetworkRegistry.newSimpleChannel(
	    new ResourceLocation(CrudeTechMod.MOD_ID, "explosivejump"),
	    () -> PROTOCOL_VERSION,
	    PROTOCOL_VERSION::equals,
	    PROTOCOL_VERSION::equals
	);
	static int i=0;
	
	
	@SubscribeEvent
	public static void onInput (InputEvent.KeyInputEvent event) {
		if(event.getKey()==keyExplosiveJump.getKey().getKeyCode() && !keyExplosiveJumpPress && Minecraft.getInstance().player.getItemStackFromSlot(EquipmentSlotType.FEET).getItem()==ModItems.KABOOTS.get()) {
			CrudeTechMod.log("pressed");
			INSTANCE.registerMessage(i++, key.class, key::encode, key::decode, key::handle);
			INSTANCE.sendToServer(new key(0));
			keyExplosiveJumpPress=true;
		}
	}

 

Edited by TallYate
forgot eula
Link to comment
Share on other sites

The runServer is crashing
 

[m[1;31m[10:58:30] [Server thread/FATAL] [ne.mi.fm.ModLoader/LOADING]: Failed to complete lifecycle event CONSTRUCT, 1 errors found
[m[1;31m[10:58:30] [Server thread/ERROR] [minecraft/MinecraftServer]: Encountered an unexpected exception
net.minecraftforge.fml.LoadingFailedException: Loading errors encountered: [
	Crude Tech Mod (crudetech) has failed to load correctly
§7null
]
	at net.minecraftforge.fml.ModLoader.dispatchAndHandleError(ModLoader.java:218) ~[?:?] {re:classloading}
	at net.minecraftforge.fml.ModLoader.gatherAndInitializeMods(ModLoader.java:200) ~[?:?] {re:classloading}
	at net.minecraftforge.fml.server.ServerModLoader.begin(ServerModLoader.java:45) ~[?:?] {re:classloading}
	at net.minecraft.server.dedicated.DedicatedServer.init(DedicatedServer.java:125) ~[?:?] {re:classloading,pl:accesstransformer:B}
	at net.minecraft.server.MinecraftServer.run(MinecraftServer.java:638) [?:?] {re:classloading,pl:accesstransformer:B,pl:runtimedistcleaner:A}
	at java.lang.Thread.run(Unknown Source) [?:1.8.0_231] {}
[m[1;31m[10:58:30] [Server thread/ERROR] [minecraft/MinecraftServer]: This crash report has been saved to: C:\Users\shijo\eclipse-workspace\CrudeTechMod\run\.\crash-reports\crash-2020-06-17_10.58.30-server.txt
[m[32m[10:58:30] [Server thread/INFO] [minecraft/MinecraftServer]: Stopping server
[m[32m[10:58:30] [Server thread/INFO] [minecraft/MinecraftServer]: Saving worlds
[m[1;31m[10:58:30] [Server thread/ERROR] [minecraft/MinecraftServer]: Exception stopping the server
java.lang.RuntimeException: The server has failed to initialize correctly due to mod loading errors. Examine the crash report for more details.
	at net.minecraftforge.common.DimensionManager.getWorld(DimensionManager.java:185) ~[?:?] {re:classloading}
	at net.minecraft.server.MinecraftServer.getWorld(MinecraftServer.java:1053) ~[?:?] {re:classloading,pl:accesstransformer:B,pl:runtimedistcleaner:A}
	at net.minecraft.server.MinecraftServer.save(MinecraftServer.java:552) ~[?:?] {re:classloading,pl:accesstransformer:B,pl:runtimedistcleaner:A}
	at net.minecraft.server.MinecraftServer.stopServer(MinecraftServer.java:587) ~[?:?] {re:classloading,pl:accesstransformer:B,pl:runtimedistcleaner:A}
	at net.minecraft.server.dedicated.DedicatedServer.stopServer(DedicatedServer.java:602) ~[?:?] {re:classloading,pl:accesstransformer:B}
	at net.minecraft.server.MinecraftServer.run(MinecraftServer.java:701) [?:?] {re:classloading,pl:accesstransformer:B,pl:runtimedistcleaner:A}
	at java.lang.Thread.run(Unknown Source) [?:1.8.0_231] {}
[m[36m[10:58:30] [Server thread/DEBUG] [ne.mi.fm.lo.FileUtils/CORE]: Found existing serverconfig directory : .\world\serverconfig
[m[36m[10:58:30] [Server thread/DEBUG] [ne.mi.fm.co.ConfigTracker/CONFIG]: Unloading configs type SERVER

 

Link to comment
Share on other sites

37 minutes ago, TallYate said:

It seems you tried to use KeyBind on the Server, keybinds are client side, also why are you registering your packet on a key press? You should register it somewhere else, I've always done it in my main constructor.

Edited by Novârch
Noticed weird packet registration

It's sad how much time mods spend saying "x is no longer supported on this forum. Please update to a modern version of Minecraft to receive support".

Link to comment
Share on other sites

private void doClientStuff(final FMLClientSetupEvent event) {
		KeyBinds.registerKeyBindings();
	}

this is my main

 

@Mod.EventBusSubscriber(modid = CrudeTechMod.MOD_ID, bus = Bus.FORGE)
public class KeyBinds {
	
	static KeyBinding[] keyBindings = new KeyBinding[1]; 
	
	public static final KeyBinding keyExplosiveJump = new KeyBinding("Explosive Jump", GLFW.GLFW_KEY_Y, "Crude Tech");
		static Boolean keyExplosiveJumpPress = false;
	
	public static void registerKeyBindings() {
		for(int i=0; i<keyBindings.length; i++) {
			ClientRegistry.registerKeyBinding(keyBindings[i]);
		}
		
	}
	
	private static final String PROTOCOL_VERSION = "1";
	public static final SimpleChannel INSTANCE = NetworkRegistry.newSimpleChannel(
	    new ResourceLocation(CrudeTechMod.MOD_ID, "explosivejump"),
	    () -> PROTOCOL_VERSION,
	    PROTOCOL_VERSION::equals,
	    PROTOCOL_VERSION::equals
	);
	static int i=0;
	
	
	@SubscribeEvent
	public static void onInput (InputEvent.KeyInputEvent event) {
		if(event.getKey()==keyExplosiveJump.getKey().getKeyCode() && !keyExplosiveJumpPress && Minecraft.getInstance().player.getItemStackFromSlot(EquipmentSlotType.FEET).getItem()==ModItems.KABOOTS.get()) {
			CrudeTechMod.log("pressed");
			INSTANCE.registerMessage(i++, key.class, key::encode, key::decode, key::handle);
			INSTANCE.sendToServer(new key(0));
			keyExplosiveJumpPress=true;
		}
	}
	
	
	@SubscribeEvent
	public static void onTick (ClientTickEvent event) {
		if(keyExplosiveJumpPress && !keyExplosiveJump.isKeyDown()) {
			keyExplosiveJumpPress=false;
		}
	}
	
}

This is KeyBinds.java

Should I move INSTANCE.registerMessage(i++, key.class, key::encode, key::decode, key::handle);
to registerKeyBindings?

Link to comment
Share on other sites

@Mod.EventBusSubscriber(modid = CrudeTechMod.MOD_ID, bus = Bus.FORGE)
public class KeyBinds {
	
	static KeyBinding[] keyBindings = new KeyBinding[1]; 
	
	public static final KeyBinding keyExplosiveJump = new KeyBinding("Explosive Jump", GLFW.GLFW_KEY_Y, "Crude Tech");
		static Boolean keyExplosiveJumpPress = false;
	
	@OnlyIn(Dist.CLIENT)
	public static void registerKeyBindings() {
		for(int i=0; i<keyBindings.length; i++) {
			ClientRegistry.registerKeyBinding(keyBindings[i]);
		}
	}
	
	private static final String PROTOCOL_VERSION = "1";
	public static final SimpleChannel INSTANCE = NetworkRegistry.newSimpleChannel(
	    new ResourceLocation(CrudeTechMod.MOD_ID, "explosivejump"),
	    () -> PROTOCOL_VERSION,
	    PROTOCOL_VERSION::equals,
	    PROTOCOL_VERSION::equals
	);
	static int i=0;
	
	
	@OnlyIn(Dist.CLIENT)
	@SubscribeEvent
	public static void onInput (InputEvent.KeyInputEvent event) {
		if(event.getKey()==keyExplosiveJump.getKey().getKeyCode() && !keyExplosiveJumpPress && Minecraft.getInstance().player.getItemStackFromSlot(EquipmentSlotType.FEET).getItem()==ModItems.KABOOTS.get()) {
			CrudeTechMod.log("pressed");
			INSTANCE.registerMessage(i++, key.class, key::encode, key::decode, key::handle);
			INSTANCE.sendToServer(new key(0));
			keyExplosiveJumpPress=true;
		}
	}
	
	@OnlyIn(Dist.CLIENT)
	@SubscribeEvent
	public static void onTick (ClientTickEvent event) {
		if(keyExplosiveJumpPress && !keyExplosiveJump.isKeyDown()) {
			keyExplosiveJumpPress=false;
		}
	}
	
}

I heard you weren't supposed to use @OnlyIn

Link to comment
Share on other sites

@Mod.EventBusSubscriber(modid = CrudeTechMod.MOD_ID, bus = Bus.FORGE, value = Dist.CLIENT)
public class KeyBinds {
	
static KeyBinding[] keyBindings = new KeyBinding[1]; 
	
	public static final KeyBinding keyExplosiveJump = new KeyBinding("Explosive Jump", GLFW.GLFW_KEY_Y, "Crude Tech");
		static Boolean keyExplosiveJumpPress = false;
	
	
	@SubscribeEvent
	public static void onTick (ClientTickEvent event) {
		if(keyExplosiveJumpPress && !keyExplosiveJump.isKeyDown()) {
			keyExplosiveJumpPress=false;
		}
	}
	
	@SubscribeEvent
	public static void onInput (InputEvent.KeyInputEvent event) {
		if(event.getKey()==keyExplosiveJump.getKey().getKeyCode() && !keyExplosiveJumpPress && Minecraft.getInstance().player.getItemStackFromSlot(EquipmentSlotType.FEET).getItem()==ModItems.KABOOTS.get()) {
			CrudeTechMod.log("pressed");
			Packets.INSTANCE.registerMessage(Packets.i++, key.class, key::encode, key::decode, key::handle);
			Packets.INSTANCE.sendToServer(new key(0));
			keyExplosiveJumpPress=true;
		}
	}
	
	public static void registerKeyBindings() {
		for(int i=0; i<keyBindings.length; i++) {
			ClientRegistry.registerKeyBinding(keyBindings[i]);
		}
	}
}
public class Packets {
	private static final String PROTOCOL_VERSION = "1";
	public static final SimpleChannel INSTANCE = NetworkRegistry.newSimpleChannel(
	    new ResourceLocation(CrudeTechMod.MOD_ID, "explosivejump"),
	    () -> PROTOCOL_VERSION,
	    PROTOCOL_VERSION::equals,
	    PROTOCOL_VERSION::equals
	);
	public static int i=0;
}

so where do I put the registerMessage

Link to comment
Share on other sites

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

-- Head --
Thread: Render thread
Stacktrace:
	at java.util.ComparableTimSort.binarySort(Unknown Source)
	at java.util.ComparableTimSort.sort(Unknown Source)
	at java.util.Arrays.sort(Unknown Source)
	at net.minecraft.client.gui.widget.list.KeyBindingList.<init>(KeyBindingList.java:27)
	at net.minecraft.client.gui.screen.ControlsScreen.init(ControlsScreen.java:32)
	at net.minecraft.client.gui.screen.Screen.init(Screen.java:339)
	at net.minecraft.client.Minecraft.displayGuiScreen(Minecraft.java:833)
	at net.minecraft.client.gui.screen.OptionsScreen.lambda$init$6(OptionsScreen.java:79)
	at net.minecraft.client.gui.widget.button.Button.onPress(Button.java:16)
	at net.minecraft.client.gui.widget.button.AbstractButton.onClick(AbstractButton.java:17)
	at net.minecraft.client.gui.widget.Widget.mouseClicked(Widget.java:136)
	at net.minecraft.client.gui.INestedGuiEventHandler.mouseClicked(INestedGuiEventHandler.java:31)
	at net.minecraft.client.MouseHelper.lambda$mouseButtonCallback$0(MouseHelper.java:87)

-- Affected screen --
Details:
	Screen name: net.minecraft.client.gui.screen.OptionsScreen
Stacktrace:
	at net.minecraft.client.gui.screen.Screen.wrapScreenError(Screen.java:446)
	at net.minecraft.client.MouseHelper.mouseButtonCallback(MouseHelper.java:85)
	at net.minecraft.client.MouseHelper.lambda$null$4(MouseHelper.java:173)
	at net.minecraft.util.concurrent.ThreadTaskExecutor.execute(ThreadTaskExecutor.java:86)
	at net.minecraft.client.MouseHelper.lambda$registerCallbacks$5(MouseHelper.java:172)
	at org.lwjgl.glfw.GLFWMouseButtonCallbackI.callback(GLFWMouseButtonCallbackI.java:36)
	at org.lwjgl.system.JNI.invokeV(Native Method)
	at org.lwjgl.glfw.GLFW.glfwPollEvents(GLFW.java:3101)
	at com.mojang.blaze3d.systems.RenderSystem.flipFrame(RenderSystem.java:89)

-- Affected level --
Details:
	All players: 1 total; [ClientPlayerEntity['Dev'/281, l='MpServer', x=-250.08, y=66.00, z=75.47]]
	Chunk stats: Client Chunk Cache: 729, 462
	Level dimension: DimensionType{minecraft:overworld}
	Level name: MpServer
	Level seed: -7738337295078555559
	Level generator: ID 00 - default, ver 1. Features enabled: false
	Level generator options: {}
	Level spawn location: World: (-256,64,65), Chunk: (at 0,4,1 in -16,4; contains blocks -256,0,64 to -241,255,79), Region: (-1,0; contains chunks -32,0 to -1,31, blocks -512,0,0 to -1,255,511)
	Level time: 13819 game time, 13819 day time
	Known server brands: 
	Level was modded: false
	Level storage version: 0x00000 - Unknown?
	Level weather: Rain time: 0 (now: false), thunder time: 0 (now: false)
	Level game mode: Game mode: survival (ID 0). Hardcore: false. Cheats: false
	Server brand: forge
	Server type: Non-integrated multiplayer server
Stacktrace:
	at net.minecraft.client.world.ClientWorld.fillCrashReport(ClientWorld.java:457)
	at net.minecraft.client.Minecraft.addGraphicsAndWorldToCrashReport(Minecraft.java:1839)
	at net.minecraft.client.Minecraft.run(Minecraft.java:572)
	at net.minecraft.client.main.Main.main(Main.java:177)
	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.minecraftforge.userdev.FMLUserdevClientLaunchProvider.lambda$launchService$0(FMLUserdevClientLaunchProvider.java:55)
	at cpw.mods.modlauncher.LaunchServiceHandlerDecorator.launch(LaunchServiceHandlerDecorator.java:37)
	at cpw.mods.modlauncher.LaunchServiceHandler.launch(LaunchServiceHandler.java:54)
	at cpw.mods.modlauncher.LaunchServiceHandler.launch(LaunchServiceHandler.java:72)
	at cpw.mods.modlauncher.Launcher.run(Launcher.java:81)
	at cpw.mods.modlauncher.Launcher.main(Launcher.java:65)
	at net.minecraftforge.userdev.LaunchTesting.main(LaunchTesting.java:102)

-- System Details --
Details:
	Minecraft Version: 1.15.2
	Minecraft Version ID: 1.15.2
	Operating System: Windows 10 (amd64) version 10.0
	Java Version: 1.8.0_231, Oracle Corporation
	Java VM Version: Java HotSpot(TM) 64-Bit Server VM (mixed mode), Oracle Corporation
	Memory: 1070229488 bytes (1020 MB) / 3440377856 bytes (3281 MB) up to 7621050368 bytes (7268 MB)
	CPUs: 6
	JVM Flags: 1 total; -XX:HeapDumpPath=MojangTricksIntelDriversForPerformance_javaw.exe_minecraft.exe.heapdump
	ModLauncher: 5.1.0+69+master.79f13f7
	ModLauncher launch target: fmluserdevclient
	ModLauncher naming: mcp
	ModLauncher services: 
		/eventbus-2.2.0-service.jar eventbus PLUGINSERVICE 
		/forge-1.15.2-31.2.0_mapped_snapshot_20200514-1.15.1-launcher.jar object_holder_definalize PLUGINSERVICE 
		/forge-1.15.2-31.2.0_mapped_snapshot_20200514-1.15.1-launcher.jar runtime_enum_extender PLUGINSERVICE 
		/accesstransformers-2.1.1-shadowed.jar accesstransformer PLUGINSERVICE 
		/forge-1.15.2-31.2.0_mapped_snapshot_20200514-1.15.1-launcher.jar capability_inject_definalize PLUGINSERVICE 
		/forge-1.15.2-31.2.0_mapped_snapshot_20200514-1.15.1-launcher.jar runtimedistcleaner PLUGINSERVICE 
		/forge-1.15.2-31.2.0_mapped_snapshot_20200514-1.15.1-launcher.jar fml TRANSFORMATIONSERVICE 
	FML: 31.2
	Forge: net.minecraftforge:31.2.0
	FML Language Providers: 
		javafml@31.2
		minecraft@1
	Mod List: 
		client-extra.jar Minecraft {minecraft@1.15.2 DONE}
		forge-1.15.2-31.2.0_mapped_snapshot_20200514-1.15.1-recomp.jar Forge {forge@31.2.0 DONE}
		main Crude Tech Mod {crudetech@NONE DONE}
	Launched Version: MOD_DEV
	Backend library: LWJGL version 3.2.2 build 10
	Backend API: GeForce GTX 1060 6GB/PCIe/SSE2 GL version 4.6.0 NVIDIA 432.00, NVIDIA Corporation
	GL Caps: Using framebuffer using OpenGL 3.0
	Using VBOs: Yes
	Is Modded: Definitely; Client brand changed to 'forge'
	Type: Client (map_client.txt)
	Resource Packs: 
	Current Language: English (US)
	CPU: 6x Intel(R) Core(TM) i5-9600K CPU @ 3.70GHz
[17Jun2020 13:11:17.796] [Render thread/INFO] [STDOUT/]: [net.minecraft.util.registry.Bootstrap:printToSYSOUT:110]: #@!@# Game crashed! Crash report saved to: #@!@# C:\Users\shijo\eclipse-workspace\CrudeTechMod\run\.\crash-reports\crash-2020-06-17_13.11.17-client.txt

I moved the registerMessage to FMLCommonSetupEvent. Now,
pressing the keybind causes lag
Going to options crashed the client

Link to comment
Share on other sites

[m[32m[13:36:29] [Realms Notification Availability checker #1/INFO] [mojang/RealmsClient]: Could not authorize you against Realms server: Invalid session id
[m[1;31m[13:36:33] [Render thread/ERROR] [minecraft/GameSettings]: Failed to save options
java.lang.NullPointerException: null
	at net.minecraft.client.GameSettings.saveOptions(GameSettings.java:633) ~[forge-1.15.2-31.2.0_mapped_snapshot_20200514-1.15.1-recomp.jar:?] {re:classloading,pl:accesstransformer:B,pl:runtimedistcleaner:A}
	at net.minecraft.client.gui.screen.OptionsScreen.removed(OptionsScreen.java:114) ~[forge-1.15.2-31.2.0_mapped_snapshot_20200514-1.15.1-recomp.jar:?] {re:classloading,pl:runtimedistcleaner:A}
	at net.minecraft.client.Minecraft.displayGuiScreen(Minecraft.java:822) ~[forge-1.15.2-31.2.0_mapped_snapshot_20200514-1.15.1-recomp.jar:?] {re:classloading,pl:accesstransformer:B,pl:runtimedistcleaner:A}
	at net.minecraft.client.gui.screen.OptionsScreen.lambda$init$6(OptionsScreen.java:79) ~[forge-1.15.2-31.2.0_mapped_snapshot_20200514-1.15.1-recomp.jar:?] {re:classloading,pl:runtimedistcleaner:A}
	at net.minecraft.client.gui.widget.button.Button.onPress(Button.java:16) ~[forge-1.15.2-31.2.0_mapped_snapshot_20200514-1.15.1-recomp.jar:?] {re:classloading,pl:runtimedistcleaner:A}
	at net.minecraft.client.gui.widget.button.AbstractButton.onClick(AbstractButton.java:17) ~[forge-1.15.2-31.2.0_mapped_snapshot_20200514-1.15.1-recomp.jar:?] {re:classloading,pl:runtimedistcleaner:A}
	at net.minecraft.client.gui.widget.Widget.mouseClicked(Widget.java:136) ~[forge-1.15.2-31.2.0_mapped_snapshot_20200514-1.15.1-recomp.jar:?] {re:classloading,pl:runtimedistcleaner:A}
	at net.minecraft.client.gui.INestedGuiEventHandler.mouseClicked(INestedGuiEventHandler.java:31) ~[forge-1.15.2-31.2.0_mapped_snapshot_20200514-1.15.1-recomp.jar:?] {re:classloading,pl:runtimedistcleaner:A}
	at net.minecraft.client.MouseHelper.lambda$mouseButtonCallback$0(MouseHelper.java:87) ~[forge-1.15.2-31.2.0_mapped_snapshot_20200514-1.15.1-recomp.jar:?] {re:classloading,pl:runtimedistcleaner:A}
	at net.minecraft.client.gui.screen.Screen.wrapScreenError(Screen.java:446) ~[forge-1.15.2-31.2.0_mapped_snapshot_20200514-1.15.1-recomp.jar:?] {re:classloading,pl:runtimedistcleaner:A}
	at net.minecraft.client.MouseHelper.mouseButtonCallback(MouseHelper.java:85) ~[forge-1.15.2-31.2.0_mapped_snapshot_20200514-1.15.1-recomp.jar:?] {re:classloading,pl:runtimedistcleaner:A}
	at net.minecraft.client.MouseHelper.lambda$null$4(MouseHelper.java:173) ~[forge-1.15.2-31.2.0_mapped_snapshot_20200514-1.15.1-recomp.jar:?] {re:classloading,pl:runtimedistcleaner:A}
	at net.minecraft.util.concurrent.ThreadTaskExecutor.execute(ThreadTaskExecutor.java:86) ~[forge-1.15.2-31.2.0_mapped_snapshot_20200514-1.15.1-recomp.jar:?] {re:classloading,pl:accesstransformer:B}
	at net.minecraft.client.MouseHelper.lambda$registerCallbacks$5(MouseHelper.java:172) ~[forge-1.15.2-31.2.0_mapped_snapshot_20200514-1.15.1-recomp.jar:?] {re:classloading,pl:runtimedistcleaner:A}
	at org.lwjgl.glfw.GLFWMouseButtonCallbackI.callback(GLFWMouseButtonCallbackI.java:36) ~[lwjgl-glfw-3.2.2.jar:build 10] {}
	at org.lwjgl.system.JNI.invokeV(Native Method) ~[lwjgl-3.2.2.jar:build 10] {}
	at org.lwjgl.glfw.GLFW.glfwPollEvents(GLFW.java:3101) ~[lwjgl-glfw-3.2.2.jar:build 10] {}
	at com.mojang.blaze3d.systems.RenderSystem.flipFrame(RenderSystem.java:89) ~[forge-1.15.2-31.2.0_mapped_snapshot_20200514-1.15.1-recomp.jar:?] {re:classloading,pl:runtimedistcleaner:A}
	at net.minecraft.client.MainWindow.flipFrame(MainWindow.java:296) ~[forge-1.15.2-31.2.0_mapped_snapshot_20200514-1.15.1-recomp.jar:?] {re:classloading,pl:runtimedistcleaner:A}
	at net.minecraft.client.Minecraft.runGameLoop(Minecraft.java:983) ~[forge-1.15.2-31.2.0_mapped_snapshot_20200514-1.15.1-recomp.jar:?] {re:classloading,pl:accesstransformer:B,pl:runtimedistcleaner:A}
	at net.minecraft.client.Minecraft.run(Minecraft.java:558) ~[forge-1.15.2-31.2.0_mapped_snapshot_20200514-1.15.1-recomp.jar:?] {re:classloading,pl:accesstransformer:B,pl:runtimedistcleaner:A}
	at net.minecraft.client.main.Main.main(Main.java:177) ~[forge-1.15.2-31.2.0_mapped_snapshot_20200514-1.15.1-recomp.jar:?] {re:classloading,pl:runtimedistcleaner:A}
	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) ~[?:1.8.0_231] {}
	at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source) ~[?:1.8.0_231] {}
	at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source) ~[?:1.8.0_231] {}
	at java.lang.reflect.Method.invoke(Unknown Source) ~[?:1.8.0_231] {}
	at net.minecraftforge.userdev.FMLUserdevClientLaunchProvider.lambda$launchService$0(FMLUserdevClientLaunchProvider.java:55) ~[forge-1.15.2-31.2.0_mapped_snapshot_20200514-1.15.1-recomp.jar:?] {}
	at cpw.mods.modlauncher.LaunchServiceHandlerDecorator.launch(LaunchServiceHandlerDecorator.java:37) [modlauncher-5.1.0.jar:?] {}
	at cpw.mods.modlauncher.LaunchServiceHandler.launch(LaunchServiceHandler.java:54) [modlauncher-5.1.0.jar:?] {}
	at cpw.mods.modlauncher.LaunchServiceHandler.launch(LaunchServiceHandler.java:72) [modlauncher-5.1.0.jar:?] {}
	at cpw.mods.modlauncher.Launcher.run(Launcher.java:81) [modlauncher-5.1.0.jar:?] {}
	at cpw.mods.modlauncher.Launcher.main(Launcher.java:65) [modlauncher-5.1.0.jar:?] {}
	at net.minecraftforge.userdev.LaunchTesting.main(LaunchTesting.java:102) [forge-1.15.2-31.2.0_mapped_snapshot_20200514-1.15.1-recomp.jar:?] {}
[m[1;31m[13:36:34] [Render thread/ERROR] [minecraft/GameSettings]: Failed to save options
java.lang.NullPointerException: null
	at net.minecraft.client.GameSettings.saveOptions(GameSettings.java:633) ~[forge-1.15.2-31.2.0_mapped_snapshot_20200514-1.15.1-recomp.jar:?] {re:classloading,pl:accesstransformer:B,pl:runtimedistcleaner:A}
	at net.minecraft.client.gui.screen.SettingsScreen.removed(SettingsScreen.java:20) ~[forge-1.15.2-31.2.0_mapped_snapshot_20200514-1.15.1-recomp.jar:?] {re:classloading,pl:runtimedistcleaner:A}
	at net.minecraft.client.Minecraft.displayGuiScreen(Minecraft.java:822) ~[forge-1.15.2-31.2.0_mapped_snapshot_20200514-1.15.1-recomp.jar:?] {re:classloading,pl:accesstransformer:B,pl:runtimedistcleaner:A}
	at net.minecraft.client.Minecraft.updateScreenTick(Minecraft.java:1766) ~[forge-1.15.2-31.2.0_mapped_snapshot_20200514-1.15.1-recomp.jar:?] {re:classloading,pl:accesstransformer:B,pl:runtimedistcleaner:A}
	at net.minecraft.client.Minecraft.unloadWorld(Minecraft.java:1739) ~[forge-1.15.2-31.2.0_mapped_snapshot_20200514-1.15.1-recomp.jar:?] {re:classloading,pl:accesstransformer:B,pl:runtimedistcleaner:A}
	at net.minecraft.client.Minecraft.freeMemory(Minecraft.java:1057) ~[forge-1.15.2-31.2.0_mapped_snapshot_20200514-1.15.1-recomp.jar:?] {re:classloading,pl:accesstransformer:B,pl:runtimedistcleaner:A}
	at net.minecraft.client.Minecraft.run(Minecraft.java:573) ~[forge-1.15.2-31.2.0_mapped_snapshot_20200514-1.15.1-recomp.jar:?] {re:classloading,pl:accesstransformer:B,pl:runtimedistcleaner:A}
	at net.minecraft.client.main.Main.main(Main.java:177) ~[forge-1.15.2-31.2.0_mapped_snapshot_20200514-1.15.1-recomp.jar:?] {re:classloading,pl:runtimedistcleaner:A}
	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) ~[?:1.8.0_231] {}
	at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source) ~[?:1.8.0_231] {}
	at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source) ~[?:1.8.0_231] {}
	at java.lang.reflect.Method.invoke(Unknown Source) ~[?:1.8.0_231] {}
	at net.minecraftforge.userdev.FMLUserdevClientLaunchProvider.lambda$launchService$0(FMLUserdevClientLaunchProvider.java:55) ~[forge-1.15.2-31.2.0_mapped_snapshot_20200514-1.15.1-recomp.jar:?] {}
	at cpw.mods.modlauncher.LaunchServiceHandlerDecorator.launch(LaunchServiceHandlerDecorator.java:37) [modlauncher-5.1.0.jar:?] {}
	at cpw.mods.modlauncher.LaunchServiceHandler.launch(LaunchServiceHandler.java:54) [modlauncher-5.1.0.jar:?] {}
	at cpw.mods.modlauncher.LaunchServiceHandler.launch(LaunchServiceHandler.java:72) [modlauncher-5.1.0.jar:?] {}
	at cpw.mods.modlauncher.Launcher.run(Launcher.java:81) [modlauncher-5.1.0.jar:?] {}
	at cpw.mods.modlauncher.Launcher.main(Launcher.java:65) [modlauncher-5.1.0.jar:?] {}
	at net.minecraftforge.userdev.LaunchTesting.main(LaunchTesting.java:102) [forge-1.15.2-31.2.0_mapped_snapshot_20200514-1.15.1-recomp.jar:?] {}
[m[1;31m[13:36:34] [Render thread/FATAL] [minecraft/Minecraft]: Reported exception thrown!
net.minecraft.crash.ReportedException: mouseClicked event handler
	at net.minecraft.client.gui.screen.Screen.wrapScreenError(Screen.java:453) ~[forge-1.15.2-31.2.0_mapped_snapshot_20200514-1.15.1-recomp.jar:?] {re:classloading,pl:runtimedistcleaner:A}
	at net.minecraft.client.MouseHelper.mouseButtonCallback(MouseHelper.java:85) ~[forge-1.15.2-31.2.0_mapped_snapshot_20200514-1.15.1-recomp.jar:?] {re:classloading,pl:runtimedistcleaner:A}
	at net.minecraft.client.MouseHelper.lambda$null$4(MouseHelper.java:173) ~[forge-1.15.2-31.2.0_mapped_snapshot_20200514-1.15.1-recomp.jar:?] {re:classloading,pl:runtimedistcleaner:A}
	at net.minecraft.util.concurrent.ThreadTaskExecutor.execute(ThreadTaskExecutor.java:86) ~[forge-1.15.2-31.2.0_mapped_snapshot_20200514-1.15.1-recomp.jar:?] {re:classloading,pl:accesstransformer:B}
	at net.minecraft.client.MouseHelper.lambda$registerCallbacks$5(MouseHelper.java:172) ~[forge-1.15.2-31.2.0_mapped_snapshot_20200514-1.15.1-recomp.jar:?] {re:classloading,pl:runtimedistcleaner:A}
	at org.lwjgl.glfw.GLFWMouseButtonCallbackI.callback(GLFWMouseButtonCallbackI.java:36) ~[lwjgl-glfw-3.2.2.jar:build 10] {}
	at org.lwjgl.system.JNI.invokeV(Native Method) ~[lwjgl-3.2.2.jar:build 10] {}
	at org.lwjgl.glfw.GLFW.glfwPollEvents(GLFW.java:3101) ~[lwjgl-glfw-3.2.2.jar:build 10] {}
	at com.mojang.blaze3d.systems.RenderSystem.flipFrame(RenderSystem.java:89) ~[forge-1.15.2-31.2.0_mapped_snapshot_20200514-1.15.1-recomp.jar:?] {re:classloading,pl:runtimedistcleaner:A}
	at net.minecraft.client.MainWindow.flipFrame(MainWindow.java:296) ~[forge-1.15.2-31.2.0_mapped_snapshot_20200514-1.15.1-recomp.jar:?] {re:classloading,pl:runtimedistcleaner:A}
	at net.minecraft.client.Minecraft.runGameLoop(Minecraft.java:983) ~[forge-1.15.2-31.2.0_mapped_snapshot_20200514-1.15.1-recomp.jar:?] {re:classloading,pl:accesstransformer:B,pl:runtimedistcleaner:A}
	at net.minecraft.client.Minecraft.run(Minecraft.java:558) ~[forge-1.15.2-31.2.0_mapped_snapshot_20200514-1.15.1-recomp.jar:?] {re:classloading,pl:accesstransformer:B,pl:runtimedistcleaner:A}
	at net.minecraft.client.main.Main.main(Main.java:177) ~[forge-1.15.2-31.2.0_mapped_snapshot_20200514-1.15.1-recomp.jar:?] {re:classloading,pl:runtimedistcleaner:A}
	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) ~[?:1.8.0_231] {}
	at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source) ~[?:1.8.0_231] {}
	at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source) ~[?:1.8.0_231] {}
	at java.lang.reflect.Method.invoke(Unknown Source) ~[?:1.8.0_231] {}
	at net.minecraftforge.userdev.FMLUserdevClientLaunchProvider.lambda$launchService$0(FMLUserdevClientLaunchProvider.java:55) ~[forge-1.15.2-31.2.0_mapped_snapshot_20200514-1.15.1-recomp.jar:?] {}
	at cpw.mods.modlauncher.LaunchServiceHandlerDecorator.launch(LaunchServiceHandlerDecorator.java:37) [modlauncher-5.1.0.jar:?] {}
	at cpw.mods.modlauncher.LaunchServiceHandler.launch(LaunchServiceHandler.java:54) [modlauncher-5.1.0.jar:?] {}
	at cpw.mods.modlauncher.LaunchServiceHandler.launch(LaunchServiceHandler.java:72) [modlauncher-5.1.0.jar:?] {}
	at cpw.mods.modlauncher.Launcher.run(Launcher.java:81) [modlauncher-5.1.0.jar:?] {}
	at cpw.mods.modlauncher.Launcher.main(Launcher.java:65) [modlauncher-5.1.0.jar:?] {}
	at net.minecraftforge.userdev.LaunchTesting.main(LaunchTesting.java:102) [forge-1.15.2-31.2.0_mapped_snapshot_20200514-1.15.1-recomp.jar:?] {}
Caused by: java.lang.NullPointerException
	at java.util.ComparableTimSort.binarySort(Unknown Source) ~[?:1.8.0_231] {}
	at java.util.ComparableTimSort.sort(Unknown Source) ~[?:1.8.0_231] {}
	at java.util.Arrays.sort(Unknown Source) ~[?:1.8.0_231] {}
	at net.minecraft.client.gui.widget.list.KeyBindingList.<init>(KeyBindingList.java:27) ~[forge-1.15.2-31.2.0_mapped_snapshot_20200514-1.15.1-recomp.jar:?] {re:classloading,pl:runtimedistcleaner:A}
	at net.minecraft.client.gui.screen.ControlsScreen.init(ControlsScreen.java:32) ~[forge-1.15.2-31.2.0_mapped_snapshot_20200514-1.15.1-recomp.jar:?] {re:classloading,pl:runtimedistcleaner:A}
	at net.minecraft.client.gui.screen.Screen.init(Screen.java:339) ~[forge-1.15.2-31.2.0_mapped_snapshot_20200514-1.15.1-recomp.jar:?] {re:classloading,pl:runtimedistcleaner:A}
	at net.minecraft.client.Minecraft.displayGuiScreen(Minecraft.java:833) ~[forge-1.15.2-31.2.0_mapped_snapshot_20200514-1.15.1-recomp.jar:?] {re:classloading,pl:accesstransformer:B,pl:runtimedistcleaner:A}
	at net.minecraft.client.gui.screen.OptionsScreen.lambda$init$6(OptionsScreen.java:79) ~[forge-1.15.2-31.2.0_mapped_snapshot_20200514-1.15.1-recomp.jar:?] {re:classloading,pl:runtimedistcleaner:A}
	at net.minecraft.client.gui.widget.button.Button.onPress(Button.java:16) ~[forge-1.15.2-31.2.0_mapped_snapshot_20200514-1.15.1-recomp.jar:?] {re:classloading,pl:runtimedistcleaner:A}
	at net.minecraft.client.gui.widget.button.AbstractButton.onClick(AbstractButton.java:17) ~[forge-1.15.2-31.2.0_mapped_snapshot_20200514-1.15.1-recomp.jar:?] {re:classloading,pl:runtimedistcleaner:A}
	at net.minecraft.client.gui.widget.Widget.mouseClicked(Widget.java:136) ~[forge-1.15.2-31.2.0_mapped_snapshot_20200514-1.15.1-recomp.jar:?] {re:classloading,pl:runtimedistcleaner:A}
	at net.minecraft.client.gui.INestedGuiEventHandler.mouseClicked(INestedGuiEventHandler.java:31) ~[forge-1.15.2-31.2.0_mapped_snapshot_20200514-1.15.1-recomp.jar:?] {re:classloading,pl:runtimedistcleaner:A}
	at net.minecraft.client.MouseHelper.lambda$mouseButtonCallback$0(MouseHelper.java:87) ~[forge-1.15.2-31.2.0_mapped_snapshot_20200514-1.15.1-recomp.jar:?] {re:classloading,pl:runtimedistcleaner:A}
	at net.minecraft.client.gui.screen.Screen.wrapScreenError(Screen.java:446) ~[forge-1.15.2-31.2.0_mapped_snapshot_20200514-1.15.1-recomp.jar:?] {re:classloading,pl:runtimedistcleaner:A}
	... 23 more
[m[32m[13:36:34] [Render thread/INFO] [STDOUT/]: [net.minecraft.util.registry.Bootstrap:printToSYSOUT:110]: ---- Minecraft Crash Report ----
// You're mean.

Time: 17/06/20 1:36 PM
Description: mouseClicked event handler

java.lang.NullPointerException: mouseClicked event handler
	at java.util.ComparableTimSort.binarySort(Unknown Source) ~[?:1.8.0_231] {}
	at java.util.ComparableTimSort.sort(Unknown Source) ~[?:1.8.0_231] {}
	at java.util.Arrays.sort(Unknown Source) ~[?:1.8.0_231] {}
	at net.minecraft.client.gui.widget.list.KeyBindingList.<init>(KeyBindingList.java:27) ~[forge-1.15.2-31.2.0_mapped_snapshot_20200514-1.15.1-recomp.jar:?] {re:classloading,pl:runtimedistcleaner:A}
	at net.minecraft.client.gui.screen.ControlsScreen.init(ControlsScreen.java:32) ~[forge-1.15.2-31.2.0_mapped_snapshot_20200514-1.15.1-recomp.jar:?] {re:classloading,pl:runtimedistcleaner:A}
	at net.minecraft.client.gui.screen.Screen.init(Screen.java:339) ~[forge-1.15.2-31.2.0_mapped_snapshot_20200514-1.15.1-recomp.jar:?] {re:classloading,pl:runtimedistcleaner:A}
	at net.minecraft.client.Minecraft.displayGuiScreen(Minecraft.java:833) ~[forge-1.15.2-31.2.0_mapped_snapshot_20200514-1.15.1-recomp.jar:?] {re:classloading,pl:accesstransformer:B,pl:runtimedistcleaner:A}
	at net.minecraft.client.gui.screen.OptionsScreen.lambda$init$6(OptionsScreen.java:79) ~[forge-1.15.2-31.2.0_mapped_snapshot_20200514-1.15.1-recomp.jar:?] {re:classloading,pl:runtimedistcleaner:A}
	at net.minecraft.client.gui.widget.button.Button.onPress(Button.java:16) ~[forge-1.15.2-31.2.0_mapped_snapshot_20200514-1.15.1-recomp.jar:?] {re:classloading,pl:runtimedistcleaner:A}
	at net.minecraft.client.gui.widget.button.AbstractButton.onClick(AbstractButton.java:17) ~[forge-1.15.2-31.2.0_mapped_snapshot_20200514-1.15.1-recomp.jar:?] {re:classloading,pl:runtimedistcleaner:A}
	at net.minecraft.client.gui.widget.Widget.mouseClicked(Widget.java:136) ~[forge-1.15.2-31.2.0_mapped_snapshot_20200514-1.15.1-recomp.jar:?] {re:classloading,pl:runtimedistcleaner:A}
	at net.minecraft.client.gui.INestedGuiEventHandler.mouseClicked(INestedGuiEventHandler.java:31) ~[forge-1.15.2-31.2.0_mapped_snapshot_20200514-1.15.1-recomp.jar:?] {re:classloading,pl:runtimedistcleaner:A}
	at net.minecraft.client.MouseHelper.lambda$mouseButtonCallback$0(MouseHelper.java:87) ~[forge-1.15.2-31.2.0_mapped_snapshot_20200514-1.15.1-recomp.jar:?] {re:classloading,pl:runtimedistcleaner:A}
	at net.minecraft.client.gui.screen.Screen.wrapScreenError(Screen.java:446) ~[forge-1.15.2-31.2.0_mapped_snapshot_20200514-1.15.1-recomp.jar:?] {re:classloading,pl:runtimedistcleaner:A}
	at net.minecraft.client.MouseHelper.mouseButtonCallback(MouseHelper.java:85) ~[forge-1.15.2-31.2.0_mapped_snapshot_20200514-1.15.1-recomp.jar:?] {re:classloading,pl:runtimedistcleaner:A}
	at net.minecraft.client.MouseHelper.lambda$null$4(MouseHelper.java:173) ~[forge-1.15.2-31.2.0_mapped_snapshot_20200514-1.15.1-recomp.jar:?] {re:classloading,pl:runtimedistcleaner:A}
	at net.minecraft.util.concurrent.ThreadTaskExecutor.execute(ThreadTaskExecutor.java:86) ~[forge-1.15.2-31.2.0_mapped_snapshot_20200514-1.15.1-recomp.jar:?] {re:classloading,pl:accesstransformer:B}
	at net.minecraft.client.MouseHelper.lambda$registerCallbacks$5(MouseHelper.java:172) ~[forge-1.15.2-31.2.0_mapped_snapshot_20200514-1.15.1-recomp.jar:?] {re:classloading,pl:runtimedistcleaner:A}
	at org.lwjgl.glfw.GLFWMouseButtonCallbackI.callback(GLFWMouseButtonCallbackI.java:36) ~[lwjgl-glfw-3.2.2.jar:build 10] {}
	at org.lwjgl.system.JNI.invokeV(Native Method) ~[lwjgl-3.2.2.jar:build 10] {}
	at org.lwjgl.glfw.GLFW.glfwPollEvents(GLFW.java:3101) ~[lwjgl-glfw-3.2.2.jar:build 10] {}
	at com.mojang.blaze3d.systems.RenderSystem.flipFrame(RenderSystem.java:89) ~[forge-1.15.2-31.2.0_mapped_snapshot_20200514-1.15.1-recomp.jar:?] {re:classloading,pl:runtimedistcleaner:A}
	at net.minecraft.client.MainWindow.flipFrame(MainWindow.java:296) ~[forge-1.15.2-31.2.0_mapped_snapshot_20200514-1.15.1-recomp.jar:?] {re:classloading,pl:runtimedistcleaner:A}
	at net.minecraft.client.Minecraft.runGameLoop(Minecraft.java:983) ~[forge-1.15.2-31.2.0_mapped_snapshot_20200514-1.15.1-recomp.jar:?] {re:classloading,pl:accesstransformer:B,pl:runtimedistcleaner:A}
	at net.minecraft.client.Minecraft.run(Minecraft.java:558) ~[forge-1.15.2-31.2.0_mapped_snapshot_20200514-1.15.1-recomp.jar:?] {re:classloading,pl:accesstransformer:B,pl:runtimedistcleaner:A}
	at net.minecraft.client.main.Main.main(Main.java:177) ~[forge-1.15.2-31.2.0_mapped_snapshot_20200514-1.15.1-recomp.jar:?] {re:classloading,pl:runtimedistcleaner:A}
	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) ~[?:1.8.0_231] {}
	at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source) ~[?:1.8.0_231] {}
	at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source) ~[?:1.8.0_231] {}
	at java.lang.reflect.Method.invoke(Unknown Source) ~[?:1.8.0_231] {}
	at net.minecraftforge.userdev.FMLUserdevClientLaunchProvider.lambda$launchService$0(FMLUserdevClientLaunchProvider.java:55) ~[forge-1.15.2-31.2.0_mapped_snapshot_20200514-1.15.1-recomp.jar:?] {}
	at cpw.mods.modlauncher.LaunchServiceHandlerDecorator.launch(LaunchServiceHandlerDecorator.java:37) [modlauncher-5.1.0.jar:?] {}
	at cpw.mods.modlauncher.LaunchServiceHandler.launch(LaunchServiceHandler.java:54) [modlauncher-5.1.0.jar:?] {}
	at cpw.mods.modlauncher.LaunchServiceHandler.launch(LaunchServiceHandler.java:72) [modlauncher-5.1.0.jar:?] {}
	at cpw.mods.modlauncher.Launcher.run(Launcher.java:81) [modlauncher-5.1.0.jar:?] {}
	at cpw.mods.modlauncher.Launcher.main(Launcher.java:65) [modlauncher-5.1.0.jar:?] {}
	at net.minecraftforge.userdev.LaunchTesting.main(LaunchTesting.java:102) [forge-1.15.2-31.2.0_mapped_snapshot_20200514-1.15.1-recomp.jar:?] {}

 

Edited by TallYate
added the stuff above
Link to comment
Share on other sites

@Mod.EventBusSubscriber(modid = CrudeTechMod.MOD_ID, bus = Bus.FORGE, value = Dist.CLIENT)
public class KeyBinds {

	static KeyBinding[] keyBindings = new KeyBinding[1];

	public static final KeyBinding keyExplosiveJump = new KeyBinding("description", GLFW.GLFW_KEY_Y, "tech");
		static Boolean keyExplosiveJumpPress = false;

	@SubscribeEvent
	public static void onTick(ClientTickEvent event) {
		if (keyExplosiveJumpPress && !keyExplosiveJump.isKeyDown()) {
			keyExplosiveJumpPress = false;
		}
	}

	@SubscribeEvent
	public static void onInput(InputEvent.KeyInputEvent event) {
		if (event.getKey() == keyExplosiveJump.getKey().getKeyCode() && !keyExplosiveJumpPress
				&& Minecraft.getInstance().player.getItemStackFromSlot(EquipmentSlotType.FEET)
						.getItem() == ModItems.KABOOTS.get()) {
			CrudeTechMod.log("pressed");
			Packets.INSTANCE.sendToServer(new key(0));
			keyExplosiveJumpPress = true;
		}
	}

	public static void registerKeyBindings() {
		for (int i = 0; i < keyBindings.length; i++) {
			ClientRegistry.registerKeyBinding(keyBindings[i]);
		}
	}
}
public class Packets {
		private static final String PROTOCOL_VERSION = "1";
		public static final SimpleChannel INSTANCE = NetworkRegistry.newSimpleChannel(
		    new ResourceLocation(CrudeTechMod.MOD_ID, "main"),
		    () -> PROTOCOL_VERSION,
		    PROTOCOL_VERSION::equals,
		    PROTOCOL_VERSION::equals
		);
		public static int i=0;
}
private void setup(final FMLCommonSetupEvent event) {
		Packets.INSTANCE.registerMessage(Packets.i++, key.class, key::encode, key::decode, key::handle);
	}
	
	private void doClientStuff(final FMLClientSetupEvent event) {
		KeyBinds.registerKeyBindings();
	}

If you happen to find what I did wrong, please tell me!

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.