String argument serializes its stringType option to type field. The same type field is overwritten by argument type later.
For example, the criterion argument node of /advancement command in the report shows:
"argument": {
"type": "minecraft:string"
}The “greedy” string type information is lost.
Code analysis
The “greedy” string type mentioned above is defined in AdvancementCommands.java:
Commands.argument("criterion", StringArgument.greedyString())The field name conflict can be observed in the following files.
In StringArgument.java:
private static final MapCodec<StringArgument> MAP_CODEC = RecordCodecBuilder.mapCodec(
i -> i.group(StringArgument.StringType.CODEC.fieldOf("type").forGetter(o -> o.stringType)).apply(i, StringArgument::new)
);In Codec.java (of DFU):
default <E> Codec<E> dispatch(final Function<? super E, ? extends A> type, final Function<? super A, ? extends MapCodec<? extends E>> codec) {
return dispatch("type", type, codec);
}Both uses the same type as key.
Comments 0
No comments.