mirror of
https://github.com/MinecraftForge/MinecraftForge.git
synced 2026-11-21 20:52:34 +00:00
Properly move `ServerStatusPing` to codec Reimplement custom display contexts Co-authored-by: Matyrobbrt <[email protected]> Co-authored-by: coehlrich <[email protected]> Signed-off-by: SizableShrimp <[email protected]>
52 lines
2.6 KiB
Diff
52 lines
2.6 KiB
Diff
--- a/net/minecraft/commands/Commands.java
|
|
+++ b/net/minecraft/commands/Commands.java
|
|
@@ -191,7 +_,7 @@
|
|
JfrCommand.m_183645_(this.f_82090_);
|
|
}
|
|
|
|
- if (SharedConstants.f_136183_) {
|
|
+ if (net.minecraftforge.gametest.ForgeGameTestHooks.isGametestEnabled()) {
|
|
TestCommand.m_127946_(this.f_82090_);
|
|
SpawnArmorTrimsCommand.m_266283_(this.f_82090_);
|
|
}
|
|
@@ -216,9 +_,11 @@
|
|
if (p_230943_.f_82144_) {
|
|
PublishCommand.m_138184_(this.f_82090_);
|
|
}
|
|
+ net.minecraftforge.event.ForgeEventFactory.onCommandRegister(this.f_82090_, p_230943_, p_230944_);
|
|
|
|
this.f_82090_.setConsumer((p_230954_, p_230955_, p_230956_) -> {
|
|
p_230954_.getSource().m_81342_(p_230954_, p_230955_, p_230956_);
|
|
+ p_230954_.getSource().m_81342_(p_230954_, p_230955_, p_230956_);
|
|
});
|
|
}
|
|
|
|
@@ -241,7 +_,16 @@
|
|
|
|
try {
|
|
try {
|
|
- return this.f_82090_.execute(p_242844_);
|
|
+ net.minecraftforge.event.CommandEvent event = new net.minecraftforge.event.CommandEvent(p_242844_);
|
|
+ if (net.minecraftforge.common.MinecraftForge.EVENT_BUS.post(event)) {
|
|
+ if (event.getException() instanceof Exception exception) {
|
|
+ throw exception;
|
|
+ } else if (event.getException() != null) {
|
|
+ com.google.common.base.Throwables.throwIfUnchecked(event.getException());
|
|
+ }
|
|
+ return 1;
|
|
+ }
|
|
+ return this.f_82090_.execute(event.getParseResults());
|
|
} catch (CommandRuntimeException commandruntimeexception) {
|
|
commandsourcestack.m_81352_(commandruntimeexception.m_79226_());
|
|
return 0;
|
|
@@ -297,7 +_,8 @@
|
|
Map<CommandNode<CommandSourceStack>, CommandNode<SharedSuggestionProvider>> map = Maps.newHashMap();
|
|
RootCommandNode<SharedSuggestionProvider> rootcommandnode = new RootCommandNode<>();
|
|
map.put(this.f_82090_.getRoot(), rootcommandnode);
|
|
- this.m_82112_(this.f_82090_.getRoot(), rootcommandnode, p_82096_.m_20203_(), map);
|
|
+ // FORGE: Use our own command node merging method to handle redirect nodes properly, see issue #7551
|
|
+ net.minecraftforge.server.command.CommandHelper.mergeCommandNode(this.f_82090_.getRoot(), rootcommandnode, map, p_82096_.m_20203_(), ctx -> 0, suggest -> SuggestionProviders.m_121664_((com.mojang.brigadier.suggestion.SuggestionProvider<SharedSuggestionProvider>) (com.mojang.brigadier.suggestion.SuggestionProvider<?>) suggest));
|
|
p_82096_.f_8906_.m_9829_(new ClientboundCommandsPacket(rootcommandnode));
|
|
}
|
|
|