From c531b2b5c7c977fba491b541bec9b1e447a288df Mon Sep 17 00:00:00 2001 From: Alex Thomson Date: Tue, 3 May 2022 05:43:49 +1200 Subject: [PATCH] Allow Exception passed through CommandEvent to propagate (#8590) --- .../minecraft/net/minecraft/commands/Commands.java.patch | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/patches/minecraft/net/minecraft/commands/Commands.java.patch b/patches/minecraft/net/minecraft/commands/Commands.java.patch index 7a95572e3b..0db5752866 100644 --- a/patches/minecraft/net/minecraft/commands/Commands.java.patch +++ b/patches/minecraft/net/minecraft/commands/Commands.java.patch @@ -17,7 +17,7 @@ this.f_82090_.findAmbiguities((p_82108_, p_82109_, p_82110_, p_82111_) -> { f_82089_.warn("Ambiguity between arguments {} and {} with inputs: {}", this.f_82090_.getPath(p_82109_), this.f_82090_.getPath(p_82110_), p_82111_); -@@ -220,7 +_,15 @@ +@@ -220,7 +_,17 @@ try { try { @@ -25,7 +25,9 @@ + ParseResults parse = this.f_82090_.parse(stringreader, p_82118_); + net.minecraftforge.event.CommandEvent event = new net.minecraftforge.event.CommandEvent(parse); + if (net.minecraftforge.common.MinecraftForge.EVENT_BUS.post(event)) { -+ if (event.getException() != null) { ++ if (event.getException() instanceof Exception exception) { ++ throw exception; ++ } else if (event.getException() != null) { + com.google.common.base.Throwables.throwIfUnchecked(event.getException()); + } + return 1;