forked from ChomeNS/chipmunkmod
some OHIo
This commit is contained in:
parent
d987be251f
commit
6a26456bc1
3 changed files with 27 additions and 2 deletions
|
@ -0,0 +1,24 @@
|
||||||
|
package land.chipmunk.chipmunkmod.mixin;
|
||||||
|
|
||||||
|
import com.mojang.brigadier.CommandDispatcher;
|
||||||
|
import com.mojang.brigadier.ParseResults;
|
||||||
|
import com.mojang.brigadier.StringReader;
|
||||||
|
import com.mojang.brigadier.context.CommandContextBuilder;
|
||||||
|
import com.mojang.brigadier.tree.CommandNode;
|
||||||
|
import org.spongepowered.asm.mixin.Mixin;
|
||||||
|
import org.spongepowered.asm.mixin.injection.At;
|
||||||
|
import org.spongepowered.asm.mixin.injection.Inject;
|
||||||
|
import org.spongepowered.asm.mixin.injection.callback.CallbackInfoReturnable;
|
||||||
|
|
||||||
|
@Mixin(CommandDispatcher.class)
|
||||||
|
public class CommandDispatcherMixin<S> {
|
||||||
|
@Inject(method = "parseNodes", at = @At("HEAD"), cancellable = true, /* important --> */ remap = false)
|
||||||
|
private void parseNodes (CommandNode<S> node, StringReader originalReader, CommandContextBuilder<S> contextSoFar, CallbackInfoReturnable<ParseResults<S>> cir) {
|
||||||
|
// correct way to patch this?
|
||||||
|
// if (node.getRelevantNodes(originalReader).size() > 127) {
|
||||||
|
// cir.setReturnValue(new ParseResults<>(contextSoFar));
|
||||||
|
//
|
||||||
|
// cir.cancel();
|
||||||
|
// }
|
||||||
|
}
|
||||||
|
}
|
|
@ -55,7 +55,7 @@ public class TextSerializerMixin {
|
||||||
|
|
||||||
if (!overLimit) return;
|
if (!overLimit) return;
|
||||||
|
|
||||||
cir.setReturnValue(Text.literal("Component is too big").formatted(Formatting.RED));
|
cir.setReturnValue(Text.empty()); // just ignores it
|
||||||
|
|
||||||
cir.cancel();
|
cir.cancel();
|
||||||
}
|
}
|
||||||
|
|
|
@ -22,7 +22,8 @@
|
||||||
"ClientConnectionAccessor",
|
"ClientConnectionAccessor",
|
||||||
"PlayerListEntryAccessor",
|
"PlayerListEntryAccessor",
|
||||||
"SharedConstantsMixin",
|
"SharedConstantsMixin",
|
||||||
"TextSerializerMixin"
|
"TextSerializerMixin",
|
||||||
|
"CommandDispatcherMixin"
|
||||||
],
|
],
|
||||||
"injectors": {
|
"injectors": {
|
||||||
"defaultRequire": 1
|
"defaultRequire": 1
|
||||||
|
|
Loading…
Reference in a new issue