CraftTweaker

CraftTweaker

151M Downloads

CTCommands should use StringArgumentType.string() and IntegerArgumentType.integer() rather than using StringReader directly

3TUSK opened this issue ยท 1 comments

commented

Issue Description:

CTCommands should use StringArgumentType.string() and IntegerArgumentType.integer() instead of using StringReader::readString and StringReader::readInt directly.

.then(Commands.argument("toCopy", StringReader::readString).executes(context -> {

.then(Commands.argument("page", StringReader::readInt)

Using lambda directly like above will cause Brigadier unable to serialize the argument and thus affecting clients' auto-completion.

Yes, this is technically duplicate of #944 but with my own analysis and proposed fix.

What happens:

Nothing is wrong, except the following console log spam:

[26Aug2020 01:51:17.297] [Netty Epoll Server IO #10/ERROR] [net.minecraft.command.arguments.ArgumentTypes/]: Could not serialize com.blamejared.crafttweaker.impl.commands.CTCommands$$Lambda$5467/1571374326@135adfd7 (class com.blamejared.crafttweaker.impl.commands.CTCommands$$Lambda$5467/1571374326) - will not be sent to client!
[26Aug2020 01:51:17.297] [Netty Epoll Server IO #10/ERROR] [net.minecraft.command.arguments.ArgumentTypes/]: Could not serialize com.blamejared.crafttweaker.impl.commands.CTCommands$$Lambda$5489/1048851859@3657caef (class com.blamejared.crafttweaker.impl.commands.CTCommands$$Lambda$5489/1048851859) - will not be sent to client!

What you expected to happen:

No log spam. Even though we have achieved the same effect by supplying our own custom Log4j2 configuration.

Script used

N/A, our server environment does not have any CraftTweaker scripts installed at this moment.

crafttweaker.log file

Note: only 4 lines because we do not have any CraftTweaker scripts at this moment, as mentioned above.

https://paste.ubuntu.com/p/MsD8bPFrdC/


Affected Versions (Do not use "latest"):

  • Minecraft: 1.15.2
  • Forge: 31.2.0
  • Crafttweaker: CraftTweaker-1.15.2-6.0.0.24.jar
  • Using a server: Yes, dedicated server with only Forge installed
  • If yes, does the client have the exact same scripts? Technically both yes and no because there is currently no scripts used, as mentioned above.

Your most recent log file where the issue was present (Please pastebin.com or gist.github.com your file, posting an unpasted or ungist'd file will automatically close this issue. We are NOT going to download files, do NOT upload your file to this issue, please give us a link to a paste / gist of the file.):

Note: partial log of latest.log, with sensitive informations such as IP addresses removed, only the relevant part remained.

https://paste.ubuntu.com/p/Kn2H7pJN2w/

commented

If I remember correctly, this was already fixed.
If not, please answer here and I'll reopen the issue.