diff --git a/src/main/java/tools/redstone/redstonetools/features/commands/MinSelectionFeature.java b/src/main/java/tools/redstone/redstonetools/features/commands/MinSelectionFeature.java index c35adc29..70d9975b 100644 --- a/src/main/java/tools/redstone/redstonetools/features/commands/MinSelectionFeature.java +++ b/src/main/java/tools/redstone/redstonetools/features/commands/MinSelectionFeature.java @@ -2,6 +2,7 @@ import com.google.auto.service.AutoService; +import com.mojang.brigadier.exceptions.SimpleCommandExceptionType; import tools.redstone.redstonetools.features.AbstractFeature; import tools.redstone.redstonetools.features.Feature; import tools.redstone.redstonetools.features.feedback.Feedback; @@ -99,7 +100,7 @@ private void minimiseSelection(World selectionWorld, Region selection) try { selection.contract(changes.toArray(new BlockVector3[changes.size()])); } catch (RegionOperationException e) { - throw new net.minecraft.command.CommandException(Text.of("There was an error modifying the region.")); + throw new SimpleCommandExceptionType(Text.of("There was an error modifying the region.")).create(); } if (!finished) diff --git a/src/main/java/tools/redstone/redstonetools/mixin/features/ItemBindMixin.java b/src/main/java/tools/redstone/redstonetools/mixin/features/ItemBindMixin.java index 085a813c..0cad09fd 100644 --- a/src/main/java/tools/redstone/redstonetools/mixin/features/ItemBindMixin.java +++ b/src/main/java/tools/redstone/redstonetools/mixin/features/ItemBindMixin.java @@ -53,7 +53,7 @@ private boolean tryToExecuteNBTCommand(Hand hand, World world) { NbtCompound nbt = getNbt(); if (nbt == null || !nbt.contains("command")) return false; NbtString command = (NbtString) nbt.get("command"); - MinecraftClient.getInstance().getNetworkHandler().sendChatMessage(command.asString()); + MinecraftClient.getInstance().getNetworkHandler().sendChatCommand(command.asString()); return true; } @@ -61,11 +61,11 @@ private boolean tryToExecuteNBTCommand(Hand hand, World world) { @Mixin(ClientPlayNetworkHandler.class) - private abstract static class PlayerMixin { + private abstract static class NetworkHandlerMixin { - @Inject(method = "sendChatMessage", at = @At("HEAD"), cancellable = true) + @Inject(method = "sendChatCommand", at = @At("HEAD"), cancellable = true) public void injectCommand(String message, CallbackInfo ci) { - if (!message.startsWith("/") || !ItemBindFeature.waitingForCommand) return; + if (!ItemBindFeature.waitingForCommand) return; Feedback addCommandFeedback = ItemBindFeature.addCommand(message); if (addCommandFeedback != null) {