Skip to content

Commit

Permalink
Honestly not much point erroring, its always a file not found excepti…
Browse files Browse the repository at this point in the history
…on and we can recover by doing an empty list
  • Loading branch information
KnightMiner committed Feb 4, 2022
1 parent 6f3da2d commit 8408b0d
Show file tree
Hide file tree
Showing 2 changed files with 1 addition and 9 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@
import com.mojang.brigadier.builder.LiteralArgumentBuilder;
import com.mojang.brigadier.context.CommandContext;
import com.mojang.brigadier.exceptions.CommandSyntaxException;
import com.mojang.brigadier.exceptions.Dynamic2CommandExceptionType;
import net.minecraft.commands.CommandSourceStack;
import net.minecraft.commands.Commands;
import net.minecraft.commands.arguments.ResourceLocationArgument;
Expand Down Expand Up @@ -36,8 +35,6 @@
/** Command that dumps a tag into a JSON object */
public class DumpTagCommand {
protected static final Gson GSON = new GsonBuilder().setPrettyPrinting().create();
private static final Dynamic2CommandExceptionType ERROR_READING_TAG = new Dynamic2CommandExceptionType((type, name) -> new TranslatableComponent("command.mantle.dump_tag.read_error", type, name));
private static final Component SUCCESS_LOG = new TranslatableComponent("command.mantle.dump_tag.success_log");

/**
* Registers this sub command with the root command
Expand Down Expand Up @@ -73,12 +70,8 @@ private static int run(CommandContext<CommandSourceStack> context, boolean saveF
// if the tag does not exist in the collect, probably an invalid tag name
if (type.getCollection().getTag(name) == null) {
throw ViewTagCommand.TAG_NOT_FOUND.create(type.getName(), name);
// if its a valid name, avoid erroring, just create the empty tag
} else if (!saveFile) {
// tag exists and we still could not read it? something went wrong
Mantle.logger.error("Couldn't read {} tag list {} from {}", type.getName(), name, path, ex);
throw ERROR_READING_TAG.create(type.getName(), name);
}
// if its a valid name, avoid erroring, just do the empty tag
}

// simply create a tag builder
Expand Down
1 change: 0 additions & 1 deletion src/main/resources/assets/mantle/lang/en_us.json
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,6 @@
"command.mantle.book_test.not_found": "Unknown book with ID %s",

"command.mantle.dump_tag.success": "Printed combined %s tag '%s' to console log",
"command.mantle.dump_tag.read_error": "Error reading %s tag '%s':",
"command.mantle.dump_tag.success_log": "Dumped combined %s tag '%s' to '%s'",
"command.mantle.dump_all_tags.success": "Dumped all tags to '%s'",
"command.mantle.dump_all_tags.type_success": "Dumped all %s tags to '%s'",
Expand Down

0 comments on commit 8408b0d

Please sign in to comment.