Jump to content

ArgumentTypes in Minecraft 1.19


miraisoft

Recommended Posts

Hi, I want to update my mod to Minecraft 1.19 (forge 41.0.1).
I noticed that net.minecraft.commands.synchronization.ArgumentTypes does not exist anymore.
Any hints what to change?

My current line of code:
 

ArgumentTypes.register("myargument", MyArgument.class, new MyArgument.Serializer());

Thanks in advance!

Link to comment
Share on other sites

Thanks so far.
I still get an error message during world joining:
 

java.lang.IllegalArgumentException: Unrecognized argument type mymod.MyArgument@5d81d85d (class mymod.MyArgument)
	at net.minecraft.commands.synchronization.ArgumentTypeInfos.m_235382_(ArgumentTypeInfos.java:152) ~[client-1.19-20220607.102129-srg.jar%2371!/:?]
	at net.minecraft.commands.synchronization.ArgumentTypeInfos.m_235393_(ArgumentTypeInfos.java:159) ~[client-1.19-20220607.102129-srg.jar%2371!/:?]
	at net.minecraft.network.protocol.game.ClientboundCommandsPacket$ArgumentNodeStub.<init>(ClientboundCommandsPacket.java:162) ~[client-1.19-20220607.102129-srg.jar%2371!/:?]
	at net.minecraft.network.protocol.game.ClientboundCommandsPacket.m_237621_(ClientboundCommandsPacket.java:235) ~[client-1.19-20220607.102129-srg.jar%2371!/:?]
	at net.minecraft.network.protocol.game.ClientboundCommandsPacket.m_237626_(ClientboundCommandsPacket.java:107) ~[client-1.19-20220607.102129-srg.jar%2371!/:?]
	at net.minecraft.network.protocol.game.ClientboundCommandsPacket.<init>(ClientboundCommandsPacket.java:52) ~[client-1.19-20220607.102129-srg.jar%2371!/:?]
	at net.minecraft.commands.Commands.m_82095_(Commands.java:289) ~[client-1.19-20220607.102129-srg.jar%2371!/:?]
	at net.minecraft.server.players.PlayerList.m_11226_(PlayerList.java:587) ~[client-1.19-20220607.102129-srg.jar%2371!/:?]
	at net.minecraft.server.players.PlayerList.m_11289_(PlayerList.java:480) ~[client-1.19-20220607.102129-srg.jar%2371!/:?]
	at net.minecraft.server.players.PlayerList.m_11261_(PlayerList.java:173) ~[client-1.19-20220607.102129-srg.jar%2371!/:?]
	at net.minecraft.server.network.ServerLoginPacketListenerImpl.m_143699_(ServerLoginPacketListenerImpl.java:147) ~[client-1.19-20220607.102129-srg.jar%2371!/:?]
	at net.minecraft.server.network.ServerLoginPacketListenerImpl.m_10055_(ServerLoginPacketListenerImpl.java:134) ~[client-1.19-20220607.102129-srg.jar%2371!/:?]
	at net.minecraft.server.network.ServerLoginPacketListenerImpl.m_10050_(ServerLoginPacketListenerImpl.java:78) ~[client-1.19-20220607.102129-srg.jar%2371!/:?]
	at net.minecraft.network.Connection.m_129483_(Connection.java:240) ~[client-1.19-20220607.102129-srg.jar%2371!/:?]
	at net.minecraft.server.network.ServerConnectionListener.m_9721_(ServerConnectionListener.java:141) ~[client-1.19-20220607.102129-srg.jar%2371!/:?]
	at net.minecraft.server.MinecraftServer.m_5703_(MinecraftServer.java:880) ~[client-1.19-20220607.102129-srg.jar%2371!/:?]
	at net.minecraft.server.MinecraftServer.m_5705_(MinecraftServer.java:806) ~[client-1.19-20220607.102129-srg.jar%2371!/:?]
	at net.minecraft.client.server.IntegratedServer.m_5705_(IntegratedServer.java:84) ~[client-1.19-20220607.102129-srg.jar%2371!/:?]
	at net.minecraft.server.MinecraftServer.m_130011_(MinecraftServer.java:654) ~[client-1.19-20220607.102129-srg.jar%2371!/:?]
	at net.minecraft.server.MinecraftServer.m_177918_(MinecraftServer.java:245) ~[client-1.19-20220607.102129-srg.jar%2371!/:?]
	at java.lang.Thread.run(Thread.java:833) [?:?]

My code is:

DeferredRegister<ArgumentTypeInfo<?, ?>> argTypeRegistry = DeferredRegister.create(Registry.COMMAND_ARGUMENT_TYPE_REGISTRY, MOD_ID);
argTypeRegistry.register("myargument", () -> ArgumentTypeInfos.registerByClass(MyArgument.class, new MyArgument.Info()));

Do I need to register the argument type anywhere else?

Also, I tested it in a single player world and after the error the multi player server selection screen was shown to me (instead of single player world selection).

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.