Jump to content

Recommended Posts

Posted (edited)

Hey folks!

So I have been working on a port of the classic mod Minecraft Comes Alive into modern forge versions as it hasn't been updated since 1.12.

Anyways, I am attempting to send a SimpleChannel message when a button is clicked in the GUI, in order to alert the server that the baby's name is being changed. Here's the error I am getting whenever I press the button:

---- Minecraft Crash Report ----
// Don't be sad, have a hug! <3

Time: 10/12/21 9:54 PM
Description: mouseClicked event handler

java.lang.ExceptionInInitializerError: null
	at com.reyzerbit.mca_reborn.client.gui.NameBabyScreen.lambda$init$0(NameBabyScreen.java:76) ~[main/:?] {re:classloading,pl:runtimedistcleaner:A}
	at net.minecraft.client.gui.widget.button.Button.onPress(Button.java:26) ~[forge-1.16.5-36.2.0_mapped_official_1.16.5-recomp.jar:?] {re:classloading,pl:runtimedistcleaner:A}
	at net.minecraft.client.gui.widget.button.AbstractButton.onClick(AbstractButton.java:18) ~[forge-1.16.5-36.2.0_mapped_official_1.16.5-recomp.jar:?] {re:classloading,pl:runtimedistcleaner:A}
	at net.minecraft.client.gui.widget.Widget.mouseClicked(Widget.java:136) ~[forge-1.16.5-36.2.0_mapped_official_1.16.5-recomp.jar:?] {re:classloading,pl:runtimedistcleaner:A}
	at net.minecraft.client.gui.INestedGuiEventHandler.mouseClicked(INestedGuiEventHandler.java:28) ~[forge-1.16.5-36.2.0_mapped_official_1.16.5-recomp.jar:?] {re:classloading,pl:runtimedistcleaner:A}
	at net.minecraft.client.MouseHelper.lambda$onPress$0(MouseHelper.java:87) ~[forge-1.16.5-36.2.0_mapped_official_1.16.5-recomp.jar:?] {re:classloading,pl:runtimedistcleaner:A}
	at net.minecraft.client.gui.screen.Screen.wrapScreenError(Screen.java:427) ~[forge-1.16.5-36.2.0_mapped_official_1.16.5-recomp.jar:?] {re:classloading,pl:runtimedistcleaner:A}
	at net.minecraft.client.MouseHelper.onPress(MouseHelper.java:85) ~[forge-1.16.5-36.2.0_mapped_official_1.16.5-recomp.jar:?] {re:classloading,pl:runtimedistcleaner:A}
	at net.minecraft.client.MouseHelper.lambda$null$4(MouseHelper.java:181) ~[forge-1.16.5-36.2.0_mapped_official_1.16.5-recomp.jar:?] {re:classloading,pl:runtimedistcleaner:A}
	at net.minecraft.util.concurrent.ThreadTaskExecutor.execute(ThreadTaskExecutor.java:86) ~[forge-1.16.5-36.2.0_mapped_official_1.16.5-recomp.jar:?] {re:classloading,pl:accesstransformer:B}
	at net.minecraft.client.MouseHelper.lambda$setup$5(MouseHelper.java:180) ~[forge-1.16.5-36.2.0_mapped_official_1.16.5-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.16.5-36.2.0_mapped_official_1.16.5-recomp.jar:?] {re:classloading,pl:runtimedistcleaner:A}
	at net.minecraft.client.MainWindow.updateDisplay(MainWindow.java:305) ~[forge-1.16.5-36.2.0_mapped_official_1.16.5-recomp.jar:?] {re:classloading,pl:runtimedistcleaner:A}
	at net.minecraft.client.Minecraft.runTick(Minecraft.java:996) ~[forge-1.16.5-36.2.0_mapped_official_1.16.5-recomp.jar:?] {re:classloading,pl:accesstransformer:B,pl:runtimedistcleaner:A}
	at net.minecraft.client.Minecraft.run(Minecraft.java:607) ~[forge-1.16.5-36.2.0_mapped_official_1.16.5-recomp.jar:?] {re:classloading,pl:accesstransformer:B,pl:runtimedistcleaner:A}
	at net.minecraft.client.main.Main.main(Main.java:184) ~[forge-1.16.5-36.2.0_mapped_official_1.16.5-recomp.jar:?] {re:classloading,pl:runtimedistcleaner:A}
	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) ~[?:1.8.0_291] {}
	at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) ~[?:1.8.0_291] {}
	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) ~[?:1.8.0_291] {}
	at java.lang.reflect.Method.invoke(Method.java:498) ~[?:1.8.0_291] {}
	at net.minecraftforge.userdev.FMLUserdevClientLaunchProvider.lambda$launchService$0(FMLUserdevClientLaunchProvider.java:52) ~[forge-1.16.5-36.2.0_mapped_official_1.16.5-recomp.jar:?] {}
	at cpw.mods.modlauncher.LaunchServiceHandlerDecorator.launch(LaunchServiceHandlerDecorator.java:37) [modlauncher-8.0.9.jar:?] {}
	at cpw.mods.modlauncher.LaunchServiceHandler.launch(LaunchServiceHandler.java:54) [modlauncher-8.0.9.jar:?] {}
	at cpw.mods.modlauncher.LaunchServiceHandler.launch(LaunchServiceHandler.java:72) [modlauncher-8.0.9.jar:?] {}
	at cpw.mods.modlauncher.Launcher.run(Launcher.java:82) [modlauncher-8.0.9.jar:?] {}
	at cpw.mods.modlauncher.Launcher.main(Launcher.java:66) [modlauncher-8.0.9.jar:?] {}
	at net.minecraftforge.userdev.LaunchTesting.main(LaunchTesting.java:108) [forge-1.16.5-36.2.0_mapped_official_1.16.5-recomp.jar:?] {}
Caused by: java.lang.IllegalArgumentException: Registration of network channels is locked
	at net.minecraftforge.fml.network.NetworkRegistry.createInstance(NetworkRegistry.java:150) ~[forge:?] {re:classloading}
	at net.minecraftforge.fml.network.NetworkRegistry.newSimpleChannel(NetworkRegistry.java:117) ~[forge:?] {re:classloading}
	at com.reyzerbit.mca_reborn.network.Network.<clinit>(Network.java:41) ~[?:?] {re:classloading}
	... 30 more


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

-- Head --
Thread: Render thread
Stacktrace:
	at com.reyzerbit.mca_reborn.client.gui.NameBabyScreen.lambda$init$0(NameBabyScreen.java:76) ~[?:?] {re:classloading,pl:runtimedistcleaner:A}
	at net.minecraft.client.gui.widget.button.Button.onPress(Button.java:26) ~[forge:?] {re:classloading,pl:runtimedistcleaner:A}
	at net.minecraft.client.gui.widget.button.AbstractButton.onClick(AbstractButton.java:18) ~[forge:?] {re:classloading,pl:runtimedistcleaner:A}
	at net.minecraft.client.gui.widget.Widget.mouseClicked(Widget.java:136) ~[forge:?] {re:classloading,pl:runtimedistcleaner:A}
	at net.minecraft.client.gui.INestedGuiEventHandler.mouseClicked(INestedGuiEventHandler.java:28) ~[forge:?] {re:classloading,pl:runtimedistcleaner:A}
	at net.minecraft.client.MouseHelper.lambda$onPress$0(MouseHelper.java:87) ~[forge:?] {re:classloading,pl:runtimedistcleaner:A}
-- Affected screen --
Details:
	Screen name: com.reyzerbit.mca_reborn.client.gui.NameBabyScreen
Stacktrace:
	at net.minecraft.client.gui.screen.Screen.wrapScreenError(Screen.java:427) ~[forge-1.16.5-36.2.0_mapped_official_1.16.5-recomp.jar:?] {re:classloading,pl:runtimedistcleaner:A}
	at net.minecraft.client.MouseHelper.onPress(MouseHelper.java:85) ~[forge-1.16.5-36.2.0_mapped_official_1.16.5-recomp.jar:?] {re:classloading,pl:runtimedistcleaner:A}
	at net.minecraft.client.MouseHelper.lambda$null$4(MouseHelper.java:181) ~[forge-1.16.5-36.2.0_mapped_official_1.16.5-recomp.jar:?] {re:classloading,pl:runtimedistcleaner:A}
	at net.minecraft.util.concurrent.ThreadTaskExecutor.execute(ThreadTaskExecutor.java:86) ~[forge-1.16.5-36.2.0_mapped_official_1.16.5-recomp.jar:?] {re:classloading,pl:accesstransformer:B}
	at net.minecraft.client.MouseHelper.lambda$setup$5(MouseHelper.java:180) ~[forge-1.16.5-36.2.0_mapped_official_1.16.5-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:?] {re:classloading,pl:runtimedistcleaner:A}


-- Affected level --
Details:
	All players: 1 total; [ClientPlayerEntity['Dev'/217, l='ClientLevel', x=159.15, y=82.16, z=-288.81]]
	Chunk stats: Client Chunk Cache: 841, 550
	Level dimension: minecraft:overworld
	Level spawn location: World: (144,67,-160), Chunk: (at 0,4,0 in 9,-10; contains blocks 144,0,-160 to 159,255,-145), Region: (0,-1; contains chunks 0,-32 to 31,-1, blocks 0,0,-512 to 511,255,-1)
	Level time: 8909 game time, 8909 day time
	Server brand: forge
	Server type: Integrated singleplayer server
Stacktrace:
	at net.minecraft.client.world.ClientWorld.fillReportDetails(ClientWorld.java:447) ~[forge-1.16.5-36.2.0_mapped_official_1.16.5-recomp.jar:?] {re:classloading,pl:runtimedistcleaner:A}
	at net.minecraft.client.Minecraft.fillReport(Minecraft.java:2029) ~[forge-1.16.5-36.2.0_mapped_official_1.16.5-recomp.jar:?] {re:classloading,pl:accesstransformer:B,pl:runtimedistcleaner:A}
	at net.minecraft.client.Minecraft.run(Minecraft.java:623) ~[forge-1.16.5-36.2.0_mapped_official_1.16.5-recomp.jar:?] {re:classloading,pl:accesstransformer:B,pl:runtimedistcleaner:A}
	at net.minecraft.client.main.Main.main(Main.java:184) ~[forge-1.16.5-36.2.0_mapped_official_1.16.5-recomp.jar:?] {re:classloading,pl:runtimedistcleaner:A}
	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) ~[?:1.8.0_291] {}
	at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) ~[?:1.8.0_291] {}
	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) ~[?:1.8.0_291] {}
	at java.lang.reflect.Method.invoke(Method.java:498) ~[?:1.8.0_291] {}
	at net.minecraftforge.userdev.FMLUserdevClientLaunchProvider.lambda$launchService$0(FMLUserdevClientLaunchProvider.java:52) ~[forge-1.16.5-36.2.0_mapped_official_1.16.5-recomp.jar:?] {}
	at cpw.mods.modlauncher.LaunchServiceHandlerDecorator.launch(LaunchServiceHandlerDecorator.java:37) [modlauncher-8.0.9.jar:?] {}
	at cpw.mods.modlauncher.LaunchServiceHandler.launch(LaunchServiceHandler.java:54) [modlauncher-8.0.9.jar:?] {}
	at cpw.mods.modlauncher.LaunchServiceHandler.launch(LaunchServiceHandler.java:72) [modlauncher-8.0.9.jar:?] {}
	at cpw.mods.modlauncher.Launcher.run(Launcher.java:82) [modlauncher-8.0.9.jar:?] {}
	at cpw.mods.modlauncher.Launcher.main(Launcher.java:66) [modlauncher-8.0.9.jar:?] {}
	at net.minecraftforge.userdev.LaunchTesting.main(LaunchTesting.java:108) [forge-1.16.5-36.2.0_mapped_official_1.16.5-recomp.jar:?] {}


-- System Details --
Details:
	Minecraft Version: 1.16.5
	Minecraft Version ID: 1.16.5
	Operating System: Windows 10 (amd64) version 10.0
	Java Version: 1.8.0_291, Oracle Corporation
	Java VM Version: Java HotSpot(TM) 64-Bit Server VM (mixed mode), Oracle Corporation
	Memory: 1116041032 bytes (1064 MB) / 1884815360 bytes (1797 MB) up to 3803185152 bytes (3627 MB)
	CPUs: 6
	JVM Flags: 1 total; -XX:HeapDumpPath=MojangTricksIntelDriversForPerformance_javaw.exe_minecraft.exe.heapdump
	ModLauncher: 8.0.9+86+master.3cf110c
	ModLauncher launch target: fmluserdevclient
	ModLauncher naming: mcp
	ModLauncher services: 
		/mixin-0.8.2.jar mixin PLUGINSERVICE 
		/eventbus-4.0.0.jar eventbus PLUGINSERVICE 
		/forge-1.16.5-36.2.0_mapped_official_1.16.5-launcher.jar object_holder_definalize PLUGINSERVICE 
		/forge-1.16.5-36.2.0_mapped_official_1.16.5-launcher.jar runtime_enum_extender PLUGINSERVICE 
		/accesstransformers-3.0.1.jar accesstransformer PLUGINSERVICE 
		/forge-1.16.5-36.2.0_mapped_official_1.16.5-launcher.jar capability_inject_definalize PLUGINSERVICE 
		/forge-1.16.5-36.2.0_mapped_official_1.16.5-launcher.jar runtimedistcleaner PLUGINSERVICE 
		/mixin-0.8.2.jar mixin TRANSFORMATIONSERVICE 
		/forge-1.16.5-36.2.0_mapped_official_1.16.5-launcher.jar fml TRANSFORMATIONSERVICE 
	FML: 36.2
	Forge: net.minecraftforge:36.2.0
	FML Language Providers: 
		javafml@36.2
		minecraft@1
	Mod List: 
		client-extra.jar                                  |Minecraft                     |minecraft                     |1.16.5              |DONE      |Manifest: a1:d4:5e:04:4f:d3:d6:e0:7b:37:97:cf:77:b0:de:ad:4a:47:ce:8c:96:49:5f:0a:cf:8c:ae:b2:6d:4b:8a:3f
		main                                              |Minecraft Comes Alive Reborn  |mca_reborn                    |1.0.0.0             |DONE      |Manifest: NOSIGNATURE
		forge-1.16.5-36.2.0_mapped_official_1.16.5-recomp.|Forge                         |forge                         |36.2.0              |DONE      |Manifest: NOSIGNATURE
	Crash Report UUID: c9300d70-fa23-423d-b75a-ae876bdd96ed
	Launched Version: MOD_DEV
	Backend library: LWJGL version 3.2.2 build 10
	Backend API: NVIDIA GeForce RTX 3060/PCIe/SSE2 GL version 4.6.0 NVIDIA 466.77, 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)
	Graphics mode: fancy
	Resource Packs: 
	Current Language: English (US)
	CPU: 6x Intel(R) Core(TM) i5-9400F CPU @ 2.90GHz

The GUI's init Override looks like this:

@Override
    public void init() {

        if (this.baby == null) this.onClose();
    	
    	this.minecraft.keyboardHandler.setSendRepeatsToGui(true);
        
        // Text Field
        babyNameTextField = new TextFieldWidget(font, width / 2 - 100, height / 2 - 60, 200, 20, new StringTextComponent("Enter name"));
        babyNameTextField.setMaxLength(32);
        babyNameTextField.setEditable(true);
        babyNameTextField.setFocus(true);
        children.add(babyNameTextField);
    	
    	// Done button
    	doneButton = addButton(new Button(width / 2 - 40, height / 2 - 10, 80, 20, new StringTextComponent(MCA.getLocalizer().localize("gui.button.done")), button -> {

			// This is the line throwing the error
            Network.INSTANCE.sendToServer(new BabyName(babyNameTextField.getValue().trim()));
            onClose();
        	
        }));
    	
    	// Random button
    	randomButton = addButton(new Button(width / 2 + 105, height / 2 - 60, 60, 20, new StringTextComponent(MCA.getLocalizer().localize("gui.button.random")), button -> {
    		
    		babyNameTextField.setValue(API.getRandomName(baby.getGender()));
    	
    	}));
        
    }

The message in question:

@AllArgsConstructor
    @Getter
    public static class BabyName {
    	
    	private String babyName;
		
		public static BabyName decode(PacketBuffer buffer) {
			
			return new BabyName(buffer.readUtf());
			
		}
		
		public static void encode(BabyName msg, PacketBuffer buffer) {
			
			buffer.writeUtf(msg.getBabyName());
			
		}
    	
    }

The Network class:

package com.reyzerbit.mca_reborn.network;

import static net.minecraftforge.fml.network.NetworkDirection.PLAY_TO_CLIENT;
import static net.minecraftforge.fml.network.NetworkDirection.PLAY_TO_SERVER;

import java.util.Optional;

import com.reyzerbit.mca_reborn.common.MCA;
import com.reyzerbit.mca_reborn.network.MCAMessages.BabyName;
import com.reyzerbit.mca_reborn.network.MCAMessages.ButtonAction;
import com.reyzerbit.mca_reborn.network.MCAMessages.CallToPlayer;
import com.reyzerbit.mca_reborn.network.MCAMessages.CareerRequest;
import com.reyzerbit.mca_reborn.network.MCAMessages.CareerResponse;
import com.reyzerbit.mca_reborn.network.MCAMessages.GetFamily;
import com.reyzerbit.mca_reborn.network.MCAMessages.GetFamilyResponse;
import com.reyzerbit.mca_reborn.network.MCAMessages.InventoryRequest;
import com.reyzerbit.mca_reborn.network.MCAMessages.InventoryResponse;
import com.reyzerbit.mca_reborn.network.MCAMessages.ReviveVillager;
import com.reyzerbit.mca_reborn.network.MCAMessages.SavedVillagersRequest;
import com.reyzerbit.mca_reborn.network.MCAMessages.SavedVillagersResponse;
import com.reyzerbit.mca_reborn.network.MCAMessages.Say;
import com.reyzerbit.mca_reborn.network.MCAMessages.SetName;
import com.reyzerbit.mca_reborn.network.MCAMessages.SetProfession;
import com.reyzerbit.mca_reborn.network.MCAMessages.SetTexture;
import com.reyzerbit.mca_reborn.network.MCAMessages.SpawnParticles;

import net.minecraft.util.ResourceLocation;
import net.minecraftforge.eventbus.api.SubscribeEvent;
import net.minecraftforge.fml.event.lifecycle.FMLCommonSetupEvent;
import net.minecraftforge.fml.network.NetworkRegistry;
import net.minecraftforge.fml.network.simple.SimpleChannel;

public class Network {

    private static int NETWORK_INDEX = 0;
	
	private static final String PROTOCOL_VERSION = "1";
    public static final SimpleChannel INSTANCE;
    static {
    	
    	INSTANCE = NetworkRegistry.newSimpleChannel(new ResourceLocation(MCA.MODID, "mca_network_channel"), () -> PROTOCOL_VERSION, PROTOCOL_VERSION::equals, PROTOCOL_VERSION::equals);
    	
    }
    
    @SubscribeEvent
    public static void onCommonSetupEvent(FMLCommonSetupEvent event) {
    	
    	// Beneath each message register is the original code for backwards reference

    	// Client -> Server
    	INSTANCE.registerMessage(NETWORK_INDEX++, ButtonAction.class, ButtonAction::encode, ButtonAction::decode, MessageHandler.Server::handle, Optional.of(PLAY_TO_SERVER));
        //INSTANCE.registerMessage(0, ButtonActionHandler.class, ButtonAction.class, Side.SERVER);
        
    	INSTANCE.registerMessage(NETWORK_INDEX++, BabyName.class, BabyName::encode, BabyName::decode, MessageHandler.Server::handle, Optional.of(PLAY_TO_SERVER));
        //INSTANCE.registerMessage(BabyNameHandler.class, BabyName.class, 2, Side.SERVER);
        
    	INSTANCE.registerMessage(NETWORK_INDEX++, CareerRequest.class, CareerRequest::encode, CareerRequest::decode, MessageHandler.Server::handle, Optional.of(PLAY_TO_SERVER));
        //INSTANCE.registerMessage(CareerRequestHandler.class, CareerRequest.class, 4, Side.SERVER);
    	
    	INSTANCE.registerMessage(NETWORK_INDEX++, InventoryRequest.class, InventoryRequest::encode, InventoryRequest::decode, MessageHandler.Server::handle, Optional.of(PLAY_TO_SERVER));
        //INSTANCE.registerMessage(InventoryRequestHandler.class, InventoryRequest.class, 5, Side.SERVER);
        
    	INSTANCE.registerMessage(NETWORK_INDEX++, SavedVillagersRequest.class, SavedVillagersRequest::encode, SavedVillagersRequest::decode, MessageHandler.Server::handle, Optional.of(PLAY_TO_SERVER));
        //INSTANCE.registerMessage(SavedVillagersRequestHandler.class, SavedVillagersRequest.class, 7, Side.SERVER);
        
    	INSTANCE.registerMessage(NETWORK_INDEX++, ReviveVillager.class, ReviveVillager::encode, ReviveVillager::decode, MessageHandler.Server::handle, Optional.of(PLAY_TO_SERVER));
        //INSTANCE.registerMessage(ReviveVillagerHandler.class, ReviveVillager.class, 9, Side.SERVER);
        
    	INSTANCE.registerMessage(NETWORK_INDEX++, SetName.class, SetName::encode, SetName::decode, MessageHandler.Server::handle, Optional.of(PLAY_TO_SERVER));
        //INSTANCE.registerMessage(SetNameHandler.class, SetName.class, 10, Side.SERVER);
        
    	INSTANCE.registerMessage(NETWORK_INDEX++, GetFamily.class, GetFamily::encode, GetFamily::decode, MessageHandler.Server::handle, Optional.of(PLAY_TO_SERVER));
        //INSTANCE.registerMessage(GetFamilyHandler.class, GetFamily.class, 12, Side.SERVER);
        
    	INSTANCE.registerMessage(NETWORK_INDEX++, CallToPlayer.class, CallToPlayer::encode, CallToPlayer::decode, MessageHandler.Server::handle, Optional.of(PLAY_TO_SERVER));
        //INSTANCE.registerMessage(CallToPlayerHandler.class, CallToPlayer.class, 14, Side.SERVER);
        
    	INSTANCE.registerMessage(NETWORK_INDEX++, SetTexture.class, SetTexture::encode, SetTexture::decode, MessageHandler.Server::handle, Optional.of(PLAY_TO_SERVER));
        //INSTANCE.registerMessage(SetTextureHandler.class, SetTexture.class, 15, Side.SERVER);
        
    	INSTANCE.registerMessage(NETWORK_INDEX++, SetProfession.class, SetProfession::encode, SetProfession::decode, MessageHandler.Server::handle, Optional.of(PLAY_TO_SERVER));
        //INSTANCE.registerMessage(SetProfessionHandler.class, SetProfession.class, 16, Side.SERVER);
        
        // Server -> Client
    	INSTANCE.registerMessage(NETWORK_INDEX++, SpawnParticles.class, SpawnParticles::encode, SpawnParticles::decode, MessageHandler.Client::handle, Optional.of(PLAY_TO_CLIENT));
        //INSTANCE.registerMessage(SpawnParticlesHandler.class, SpawnParticles.class, 11, Side.CLIENT);
        
    	INSTANCE.registerMessage(NETWORK_INDEX++, Say.class, Say::encode, Say::decode, MessageHandler.Client::handle, Optional.of(PLAY_TO_CLIENT));
        //INSTANCE.registerMessage(SayHandler.class, Say.class, 1, Side.CLIENT);
        
    	INSTANCE.registerMessage(NETWORK_INDEX++, CareerResponse.class, CareerResponse::encode, CareerResponse::decode, MessageHandler.Client::handle, Optional.of(PLAY_TO_CLIENT));
        //INSTANCE.registerMessage(CareerResponseHandler.class, CareerResponse.class, 3, Side.CLIENT);
        
    	INSTANCE.registerMessage(NETWORK_INDEX++, InventoryResponse.class, InventoryResponse::encode, InventoryResponse::decode, MessageHandler.Client::handle, Optional.of(PLAY_TO_CLIENT));
        //INSTANCE.registerMessage(InventoryResponseHandler.class, InventoryResponse.class, 6, Side.CLIENT);
        
    	INSTANCE.registerMessage(NETWORK_INDEX++, SavedVillagersResponse.class, SavedVillagersResponse::encode, SavedVillagersResponse::decode, MessageHandler.Client::handle, Optional.of(PLAY_TO_CLIENT));
        //INSTANCE.registerMessage(SavedVillagersResponseHandler.class, SavedVillagersResponse.class, 8, Side.CLIENT);
        
    	INSTANCE.registerMessage(NETWORK_INDEX++, GetFamilyResponse.class, GetFamilyResponse::encode, GetFamilyResponse::decode, MessageHandler.Client::handle, Optional.of(PLAY_TO_CLIENT));
        //INSTANCE.registerMessage(GetFamilyResponseHandler.class, GetFamilyResponse.class, 13, Side.CLIENT);
        
    }

}

Message Handler, which is called on message recieved:

public static void handle(BabyName msg, Supplier<NetworkEvent.Context> context) {
  
  context.get().enqueueWork(() -> ServerHandler.processMessage(msg, context.get().getSender()));
  
  context.get().setPacketHandled(true);
		    
}

And finally: the specific handler itself:

protected static void processMessage(BabyName msg, ServerPlayerEntity player) {

	ItemStack stack = player.inventory.getSelected();

	if (stack.getItem() instanceof Baby) {

		CompoundNBT nbt = stack.serializeNBT();
		nbt.putString("name", msg.getBabyName());
		stack.deserializeNBT(nbt);

	}

	return;
		
}

I'm trying to figure out what is wrong with this. I can't seem to figure out what's going wrong, and I've been trying things and googling help for almost 3 days now.

 

Any advice would be appreciated!

 

Thanks!

 

-Rey

Edited by Reyzerbit
Clarity
Posted
  On 10/13/2021 at 4:42 AM, ImNotJahan said:

I'm not sure what he meant but could you show what code the 76th line of NameBabyScreen is

Expand  

Yup! It's actually the line 

 Network.INSTANCE.sendToServer(new BabyName(babyNameTextField.getValue().trim()));

from the Overrided init. I'll edit it with a comment so you can see.

Posted
  On 10/13/2021 at 7:41 AM, diesieben07 said:

How do you register the onCommonSetupEvent event handler? I am guessing you aren't, so it is never called.

Expand  

I knew I forgot something! This was the issue haha. I always forget to add the listener, for some reason my brain always wants to assume that the @EventSubscriber annotation is enough.

 

Thank you!

 

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



  • Recently Browsing

    • No registered users viewing this page.
  • Posts

    • It all began when I made what I thought was a smart move, investing a significant sum in a promising new cryptocurrency project. The marketing was slick, the whitepaper looked solid, and the hype was massive. But just a few weeks in, I started noticing red flags. The platform went down intermittently, withdrawals were delayed, and eventually, the website vanished altogether. I realized too late: I had fallen victim to a sophisticated crypto scam. Devastated and angry, I felt completely helpless. The blockchain is supposed to be secure and transparent, but tracing stolen assets through multiple wallets, mixers, and decentralized exchanges felt like chasing shadows. I reported it to local authorities, but they admitted they had limited tools for handling crypto-based crimes. That’s when a close friend recommended Alpha Spy Nest Forensic Digital Recovery Experts. Skeptical but desperate, I reached out. From the very first consultation, their professionalism stood out. They didn’t promise miracles, but they laid out a realistic recovery plan. Their team of cyber forensics specialists, blockchain analysts, and legal advisors worked together seamlessly. They began by tracing the movement of my funds through a series of blockchain addresses, even identifying key mixing points and suspicious wallet activity. I was amazed by the level of detail they could extract.Over the following weeks, Alpha Spy Nest liaised with major exchanges and digital compliance bodies, submitting detailed forensic reports. With their guidance, several suspicious wallets were flagged, frozen, and ultimately, a substantial portion of my lost funds was recovered and returned. I never thought recovery was even possible. But thanks to Alpha Spy Nest, not only did I regain a large part of my investment, I also restored some peace of mind. They didn’t just recover funds, they gave me back hope in a world where digital crime seemed untouchable. 
    • Looking to save big on your first international money transfer? Use the Lemfi coupon code 10% Cashback Up To $50 On First Transfer and enjoy instant cashback rewards on your first transaction. Our exclusive RITEQH6J Lemfi coupon code is designed to maximize your savings across the globe. Whether you're in the USA, Canada, UK, or elsewhere, this code unlocks premium benefits for you. With the Lemfi discount code $10 off and Lemfi code 10% Cashback Up To $50 On First Transfer, you’re not just sending money—you’re earning while doing it. Let’s dive into all the ways you can make the most of this offer. What Is The Lemfi Promo Code for 10% Cashback Up To $50 On First Transfer? Both new and existing users can benefit significantly by applying our Lemfi coupon 10% Cashback Up To $50 On First Transfer on the Lemfi app or website. This offer is part of Lemfi’s initiative to provide more value to its global users with every money transfer. 10% Cashback Up To $50 On First Transfer Lemfi coupon is your gateway to saving more, whether you're new or already using the app. Here's what you get with the promo code RITEQH6J: RITEQH6J – Flat 10% Cashback Up To $50 On First Transfer RITEQH6J – 10% Cashback Up To $50 On First Transfer coupon pack for multiple uses RITEQH6J – 10% Cashback Up To $50 On First Transfer flat discount for new customers RITEQH6J – Extra 10% Cashback Up To $50 On First Transfer promo code for existing customers Lemfi First Time Promo Code 10% Cashback Up To $50 On First Transfer For New Users In 2025 If you’re signing up for the first time in 2025, you’re in for an amazing treat. Using our Lemfi First Time Promo Code for 10% Cashback Up To $50 On First Transfer ensures maximum benefits on your first transaction. Here are some exciting perks of using RITEQH6J: RITEQH6J – $30 sign-up bonus to new users RITEQH6J – 10% cash back up to $50 on first transfer RITEQH6J – $20 cashback on recurring money transfers RITEQH6J – $30 bonus on $100 transfer RITEQH6J – Valid globally for all new Lemfi customers How To Redeem The Lemfi Coupon 10% Cashback Up To $50 On First Transfer For New Users? Using the Lemfi First Time Promo Code for 10% Cashback Up To $50 On First Transfer is super easy. Follow this simple guide: Download and install the Lemfi app from the App Store or Google Play. Sign up and create a new account. Go to the promo code section during your first transaction. Enter RITEQH6J to activate the Lemfi Promo Code First Order 10% Cashback Up To $50 On First Transfer. Complete the transaction to enjoy the Lemfi First Time Promo Code 10% Cashback Up To $50 On First Transfer for new users. Lemfi Promo Code 10% Cashback Up To $50 On First Transfer For Existing Customers Already a Lemfi user? You can still enjoy great benefits using our lemfi promo code 10% Cashback Up To $50 On First Transfer for existing users. Take advantage of the lemfi discount code 10% Cashback Up To $50 On First Transfer for existing customers by using the code RITEQH6J: RITEQH6J – $10 bonus for all users RITEQH6J – $20 per referral after 20 transactions RITEQH6J – $20 cashback on recurring money transfers RITEQH6J – $30 bonus on $100 transfer How To Use The Lemfi Code for 10% Cashback Up To $50 On First Transfer For Existing Customers? To redeem the Lemfi discount code for 10% Cashback Up To $50 On First Transfer, follow these steps: Open the Lemfi app and Lemfi login to your existing account. Go to the 'Promo Code' or 'Offers' section. Apply the Code promo Lemfi for 10% Cashback Up To $50 On First Transfer – RITEQH6J. Make your transaction and enjoy instant cashback rewards. Latest Lemfi Promo Code for 10% Cashback Up To $50 On First Transfer Stay ahead of the savings game by using our Lemfi first time promo code for 10% Cashback Up To $50 On First Transfer first order. It's the best way to unlock exclusive Lemfi offers. With the Lemfi discount code 10% Cashback Up To $50 On First Transfer and Lemfi cashback code, here’s what RITEQH6J brings: $30 sign-up bonus to new users 10% cashback up to $50 on first transfer $20 per referral after 20 transactions $20 cashback on recurring money transfers $30 bonus on $100 transfer How To Find The Lemfi Code for 10% Cashback Up To $50 On First Transfer? Finding the Lemfi code for 10% Cashback Up To $50 On First Transfer is easier than you think. You can get the Lemfi cashback code by subscribing to Lemfi’s newsletter for exclusive offers. Don’t forget to check out Lemfi referral code Reddit for 10% Cashback Up To $50 On First Transfer discussions and user-shared deals. Also, visit trusted coupon websites like ours for verified and regularly updated Lemfi promo codes. Is Lemfi 10% Cashback Up To $50 On First Transfer Code Legit? Absolutely! Wondering Is Lemfi legit?—Yes, it is. Our code promo Lemfi legit is fully tested and verified. The Lemfi discount code RITEQH6J is 100% authentic and can be used worldwide without restrictions. It's a secure, safe, and effective way to enjoy cashback on your transfers. How Does Lemfi Code for 10% Cashback Up To $50 On First Transfer Work? The 10% Cashback Up To $50 On First Transfer on first-time Lemfi money transfer works instantly once you apply the code RITEQH6J. After you enter the code during your transaction, Lemfi automatically applies the cashback. The Lemfi promo code for recurring transactions also allows users to benefit on future money transfers. Whether you're a new or existing user, the savings keep adding up with every use. How To Earn Lemfi 10% Cashback Up To $50 On First Transfer Coupons As A New Customer? To earn the Lemfi coupon code 10% Cashback Up To $50 On First Transfer, all you have to do is register on Lemfi with a valid email and phone number. After signing up, enter our code RITEQH6J during your first transfer. You can also look for 100 off Lemfi coupon code during Lemfi promotions. Keep an eye on your inbox and our site for fresh Lemfi offers every month. What Are The Advantages Of Using The Lemfi Discount Code for 10% Cashback Up To $50 On First Transfer? Using the Lemfi promo code for $10 bonus and Lemfi promo code for 10% Cashback Up To $50 On First Transfer offers many perks: $30 sign-up bonus to new users 10% cashback up to $50 on first transfer $20 per referral after 20 transactions $20 cashback on recurring money transfers $30 bonus on $100 transfer Lemfi Discount Code For 10% Cashback Up To $50 On First Transfer And Free Gift For New And Existing Customers With our Lemfi Discount Code for 10% Cashback Up To $50 On First Transfer, the bonuses don’t stop. Use the 10% Cashback Up To $50 On First Transfer Lemfi discount code and enjoy even more rewards. Here’s what RITEQH6J brings you: RITEQH6J – $30 sign-up bonus to new users RITEQH6J – 10% cashback up to $50 on first transfer RITEQH6J – $20 per referral after 20 transactions RITEQH6J – $20 cashback on recurring money transfers RITEQH6J – $30 bonus on $100 transfer Pros And Cons Of Using The Lemfi Discount Code 10% Cashback Up To $50 On First Transfer For Here are some pros and cons of the Lemfi 10% Cashback Up To $50 On First Transfer discount code and latest Lemfi code 10% cashback up to $50 on first transfer: Pros: Easy to apply and use Instant cashback on first transfer Valid for both new and existing users No expiration date Works globally Cons: Cashback capped at $50 May require minimum transfer amount Terms And Conditions Of Using The Lemfi Coupon 10% Cashback Up To $50 On First Transfer In 2025 To make the most of the Lemfi 10% Cashback Up To $50 On First Transfer code and latest Lemfi code 10% Cashback Up To $50 On First Transfer, keep these T&Cs in mind: Valid for both new and existing users Can be used worldwide No expiration date Requires use of code RITEQH6J during transaction Minimum transfer limit may apply Final Note: Use The Latest Lemfi Discount Code 10% Cashback Up To $50 On First Transfer To unlock your savings, don’t forget to use the Lemfi discount code for 10% Cashback Up To $50 On First Transfer. This code guarantees amazing benefits across various regions and transactions. With the Lemfi 10% Cashback Up To $50 On First Transfer code, you can enjoy worry-free money transfers and generous bonuses. Save more every time you send money! FAQs Of Lemfi 10% Cashback Up To $50 On First Transfer Code What is the best Lemfi promo code in 2025? The best Lemfi promo code for 2025 is RITEQH6J, offering 10% cashback up to $50 on your first transfer and other recurring rewards. Can I use the Lemfi code multiple times? Yes, you can use RITEQH6J for recurring benefits such as $20 cashback on future transfers and $30 bonuses on $100 sent. Is the Lemfi code valid in the USA and UK? Yes, the code is globally valid including in the USA, UK, Canada, and more. How do I enter the Lemfi promo code? Enter RITEQH6J in the promo section during your first transfer on the Lemfi app or website to activate your cashback offer. Does Lemfi have a referral bonus? Yes, Lemfi offers a $20 referral bonus after 20 successful transactions when your code is used by others
    • And the mods.toml?   Instead of using  modId="${mod_id}" try  modId="wackyweapons"
    • I've been working on Minecraft Forge 1.21 Modding, (I'm a bit inexperienced), and when trying to create my own custom throwable projectile entity, I come across this error I can't seem to fix. The console reads that my "mod not working due to Invalid bare key: '${mod_id}'  ". Does anyone know why this is happening? The Pastebin link for all the relevant files is https://pastebin.com/h3UaNYwn. Any help would be greatly appreciated. Thanks.
    • Found a similar post from 3 weeks ago as the only similar issue, seems specific to some linux distributions, like cachyos which i am using, due to libzng processing hashes differently? https://github.com/PrismLauncher/PrismLauncher/issues/3889
  • Topics

  • Who's Online (See full list)

    • There are no registered users currently online
×
×
  • Create New...

Important Information

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