From ca8fea7d0c7521d89051b7b4660e477c333d1314 Mon Sep 17 00:00:00 2001 From: melontini <104443436+melontini@users.noreply.github.com> Date: Fri, 10 May 2024 17:20:36 +0700 Subject: [PATCH] Update Codec info --- docs/develop/Commands.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/docs/develop/Commands.md b/docs/develop/Commands.md index bc458ab..cbda7c6 100644 --- a/docs/develop/Commands.md +++ b/docs/develop/Commands.md @@ -4,7 +4,7 @@ In general, you should prefer to implement Brigadier `/` commands, but there are ## Creating commands -Creating new commands is easy, you'll have to implement the `Command` interface, create a [Codec](https://forge.gemwire.uk/wiki/Codecs) to serialize/deserialize the command and register the codec with `CommandTypes.register()`. +Creating new commands is easy, you'll have to implement the `Command` interface, create a [MapCodec](https://forge.gemwire.uk/wiki/Codecs) to serialize/deserialize the command and register the codec with `CommandTypes.register()`. Let's create a simple command which will print a string to standard output. @@ -27,7 +27,7 @@ public record DummyCommand(String text) implements Command { Now create a [Codec](https://forge.gemwire.uk/wiki/Codecs) for your command. ```java -public static final Codec CODEC = Codec.STRING.fieldOf("text").xmap(DummyCommand::new, DummyCommand::text).codec(); +public static final MapCodec CODEC = Codec.STRING.fieldOf("text").xmap(DummyCommand::new, DummyCommand::text); ``` With that done, we'll have to register the command to get our `CommandType`.