Search in sources :

Example 1 with TagParser

use of net.minecraft.nbt.TagParser in project SpongeCommon by SpongePowered.

the class SpongeStringReader method parseNBTString.

@Override
public String parseNBTString() throws ArgumentParseException {
    final int startCursor = this.getCursor();
    try {
        new TagParser(this).readStruct();
    } catch (final CommandSyntaxException ex) {
        this.setCursor(startCursor);
        throw new ArgumentParseException(SpongeAdventure.asAdventure(ex.getRawMessage()), ex.getInput(), ex.getCursor());
    }
    // this will be just after a }
    final int endCursor = this.getCursor();
    return this.input().substring(startCursor, endCursor);
}
Also used : TagParser(net.minecraft.nbt.TagParser) ArgumentParseException(org.spongepowered.api.command.exception.ArgumentParseException) CommandSyntaxException(com.mojang.brigadier.exceptions.CommandSyntaxException)

Aggregations

CommandSyntaxException (com.mojang.brigadier.exceptions.CommandSyntaxException)1 TagParser (net.minecraft.nbt.TagParser)1 ArgumentParseException (org.spongepowered.api.command.exception.ArgumentParseException)1