--- a/net/minecraft/commands/execution/tasks/BuildContexts.java
+++ b/net/minecraft/commands/execution/tasks/BuildContexts.java
@@ -52,7 +52,8 @@
                     }
 
                     RedirectModifier<T> redirectmodifier = commandcontext.getRedirectModifier();
-                    if (redirectmodifier instanceof CustomModifierExecutor<T> custommodifierexecutor) {
+                    if (redirectmodifier instanceof CustomModifierExecutor<?>) {
+                        CustomModifierExecutor<T> custommodifierexecutor = (CustomModifierExecutor<T>) redirectmodifier;
                         custommodifierexecutor.apply(p_309567_, list, contextchain, chainmodifiers, ExecutionControl.create(p_305977_, p_309603_));
                         return;
                     }
@@ -90,11 +91,13 @@
 
         if (list.isEmpty()) {
             if (chainmodifiers.isReturn()) {
-                p_305977_.queueNext(new CommandQueueEntry<>(p_309603_, FallthroughTask.instance()));
+                p_305977_.queueNext(new CommandQueueEntry<T>(p_309603_, FallthroughTask.instance()));
             }
         } else {
             CommandContext<T> commandcontext1 = contextchain.getTopContext();
-            if (commandcontext1.getCommand() instanceof CustomCommandExecutor<T> customcommandexecutor) {
+            com.mojang.brigadier.Command<T> command = commandcontext1.getCommand();
+            if (command instanceof CustomCommandExecutor<?>) {
+                CustomCommandExecutor<T> customcommandexecutor = (CustomCommandExecutor<T>) command;
                 ExecutionControl<T> executioncontrol = ExecutionControl.create(p_305977_, p_309603_);
 
                 for (T t2 : list) {
