@@ -116,7 +116,7 @@ private static int test2(CommandContext<ServerCommandSource> context) {
116116 try {
117117 ServerPlayerEntity player = context .getSource ().getPlayer ();
118118 Text text = TextParserUtils .formatText (context .getArgument ("text" , String .class ));
119- player .sendMessage (Text .literal (Text .Serialization .toJsonString (text )), false );
119+ player .sendMessage (Text .literal (Text .Serialization .toJsonString (text , context . getSource (). getRegistryManager () )), false );
120120 player .sendMessage (text , false );
121121 } catch (Exception e ) {
122122 e .printStackTrace ();
@@ -147,10 +147,10 @@ private static int test2oldnewjson(CommandContext<ServerCommandSource> context)
147147 Text text = TextParserV1 .DEFAULT .parseNode (form ).toText ();
148148 Text text2 = TagParser .SIMPLIFIED_TEXT_FORMAT .parseNode (form ).toText ();
149149 player .sendMessage (Text .literal ("v1" ), false );
150- player .sendMessage (Text .literal (Text .Serialization .toJsonString (text )), false );
150+ player .sendMessage (Text .literal (Text .Serialization .toJsonString (text , context . getSource (). getRegistryManager () )), false );
151151 player .sendMessage (text , false );
152152 player .sendMessage (Text .literal ("v2" ), false );
153- player .sendMessage (Text .literal (Text .Serialization .toJsonString (text2 )), false );
153+ player .sendMessage (Text .literal (Text .Serialization .toJsonString (text2 , context . getSource (). getRegistryManager () )), false );
154154 player .sendMessage (text2 , false );
155155 } catch (Exception e ) {
156156 e .printStackTrace ();
@@ -183,7 +183,7 @@ private static int test3(CommandContext<ServerCommandSource> context) {
183183 Text text = placeholders .toText (ParserContext .of (PlaceholderContext .KEY , PlaceholderContext .of (player )), true );
184184 var textTime = System .nanoTime () - time ;
185185
186- player .sendMessage (Text .literal (Text .Serialization .toJsonString (text )), false );
186+ player .sendMessage (Text .literal (Text .Serialization .toJsonString (text , context . getSource (). getRegistryManager () )), false );
187187 player .sendMessage (Texts .parse (context .getSource (), text , context .getSource ().getEntity (), 0 ), false );
188188 player .sendMessage (Text .literal (
189189 "Tag: " + ((tagTime / 1000 ) / 1000d ) + " ms | " +
@@ -205,7 +205,7 @@ private static int test4Text(CommandContext<ServerCommandSource> context) {
205205 Placeholders .PREDEFINED_PLACEHOLDER_PATTERN ,
206206 Map .of ("player" , player .getName ())
207207 );
208- player .sendMessage (Text .literal (Text .Serialization .toJsonString (text )), false );
208+ player .sendMessage (Text .literal (Text .Serialization .toJsonString (text , context . getSource (). getRegistryManager () )), false );
209209 player .sendMessage (text , false );
210210 } catch (Exception e ) {
211211 e .printStackTrace ();
@@ -221,7 +221,7 @@ private static int test4nodes(CommandContext<ServerCommandSource> context) {
221221 Placeholders .PREDEFINED_PLACEHOLDER_PATTERN ,
222222 Map .of ("player" , player .getName ())
223223 ).toText (ParserContext .of (PlaceholderContext .KEY , PlaceholderContext .of (player )), true );
224- player .sendMessage (Text .literal (Text .Serialization .toJsonString (text )), false );
224+ player .sendMessage (Text .literal (Text .Serialization .toJsonString (text , context . getSource (). getRegistryManager () )), false );
225225 player .sendMessage (text , false );
226226 } catch (Exception e ) {
227227 e .printStackTrace ();
@@ -239,7 +239,7 @@ private static int test5(CommandContext<ServerCommandSource> context) {
239239 .simplifiedTextFormat ()
240240 .build ()
241241 .parseText (form , PlaceholderContext .of (player ).asParserContext ());
242- player .sendMessage (Text .literal (Text .Serialization .toJsonString (text2 )), false );
242+ player .sendMessage (Text .literal (Text .Serialization .toJsonString (text2 , context . getSource (). getRegistryManager () )), false );
243243 player .sendMessage (text2 , false );
244244 } catch (Exception e ) {
245245 e .printStackTrace ();
@@ -278,7 +278,7 @@ private static int test7(CommandContext<ServerCommandSource> context) {
278278 public void onInitialize () {
279279 CommandRegistrationCallback .EVENT .register ((dispatcher , registryAccess , dedicated ) -> {
280280 dispatcher .register (
281- literal ("test" ).then (argument ("text" , TextArgumentType .text ()).executes (TestMod ::test ))
281+ literal ("test" ).then (argument ("text" , TextArgumentType .text (registryAccess )).executes (TestMod ::test ))
282282 );
283283 dispatcher .register (
284284 literal ("argtest" ).then (argument ("arg" , StringArgumentType .greedyString ()).executes (TestMod ::argTest ))
0 commit comments