diff --git a/src/main/java/tools/redstone/redstonetools/features/commands/BinaryBlockReadFeature.java b/src/main/java/tools/redstone/redstonetools/features/commands/BinaryBlockReadFeature.java index 332f97de..fdcd7b60 100644 --- a/src/main/java/tools/redstone/redstonetools/features/commands/BinaryBlockReadFeature.java +++ b/src/main/java/tools/redstone/redstonetools/features/commands/BinaryBlockReadFeature.java @@ -26,6 +26,7 @@ import static tools.redstone.redstonetools.features.arguments.serializers.IntegerSerializer.integer; import static tools.redstone.redstonetools.features.arguments.serializers.NumberBaseSerializer.numberBase; + @AutoService(AbstractFeature.class) @Feature(name = "Binary Block Read", description = "Interprets your WorldEdit selection as a binary number.", command = "/read", worldedit = true) public class BinaryBlockReadFeature extends CommandFeature { 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 b5ee5452..c35adc29 100644 --- a/src/main/java/tools/redstone/redstonetools/features/commands/MinSelectionFeature.java +++ b/src/main/java/tools/redstone/redstonetools/features/commands/MinSelectionFeature.java @@ -1,5 +1,6 @@ package tools.redstone.redstonetools.features.commands; + import com.google.auto.service.AutoService; import tools.redstone.redstonetools.features.AbstractFeature; import tools.redstone.redstonetools.features.Feature; diff --git a/src/main/java/tools/redstone/redstonetools/features/commands/QuickTpFeature.java b/src/main/java/tools/redstone/redstonetools/features/commands/QuickTpFeature.java index 46ffbf0e..2662dc13 100644 --- a/src/main/java/tools/redstone/redstonetools/features/commands/QuickTpFeature.java +++ b/src/main/java/tools/redstone/redstonetools/features/commands/QuickTpFeature.java @@ -18,6 +18,7 @@ import static tools.redstone.redstonetools.features.arguments.serializers.BoolSerializer.bool; import static tools.redstone.redstonetools.features.arguments.serializers.FloatSerializer.floatArg; + @AutoService(AbstractFeature.class) @Feature(name = "Quick TP", description = "Teleports you in the direction you are looking.", command = "quicktp") public class QuickTpFeature extends CommandFeature { diff --git a/src/main/java/tools/redstone/redstonetools/features/commands/RStackFeature.java b/src/main/java/tools/redstone/redstonetools/features/commands/RStackFeature.java index 77364d75..df322d3e 100644 --- a/src/main/java/tools/redstone/redstonetools/features/commands/RStackFeature.java +++ b/src/main/java/tools/redstone/redstonetools/features/commands/RStackFeature.java @@ -1,29 +1,24 @@ package tools.redstone.redstonetools.features.commands; import com.google.auto.service.AutoService; -import tools.redstone.redstonetools.features.AbstractFeature; -import tools.redstone.redstonetools.features.Feature; -import tools.redstone.redstonetools.features.arguments.Argument; -import tools.redstone.redstonetools.features.feedback.Feedback; -import tools.redstone.redstonetools.utils.DirectionArgument; import com.mojang.brigadier.exceptions.CommandSyntaxException; -import com.sk89q.worldedit.EditSession; import com.sk89q.worldedit.IncompleteRegionException; -import com.sk89q.worldedit.LocalSession; import com.sk89q.worldedit.WorldEdit; import com.sk89q.worldedit.WorldEditException; import com.sk89q.worldedit.fabric.FabricAdapter; -import com.sk89q.worldedit.fabric.FabricPlayer; import com.sk89q.worldedit.function.mask.Mask; import com.sk89q.worldedit.function.mask.Mask2D; import com.sk89q.worldedit.function.operation.ForwardExtentCopy; import com.sk89q.worldedit.function.operation.Operations; import com.sk89q.worldedit.math.BlockVector3; import com.sk89q.worldedit.regions.Region; -import com.sk89q.worldedit.util.Direction; -import com.sk89q.worldedit.world.World; import net.minecraft.server.command.ServerCommandSource; import org.jetbrains.annotations.Nullable; +import tools.redstone.redstonetools.features.AbstractFeature; +import tools.redstone.redstonetools.features.Feature; +import tools.redstone.redstonetools.features.arguments.Argument; +import tools.redstone.redstonetools.features.feedback.Feedback; +import tools.redstone.redstonetools.utils.DirectionArgument; import static tools.redstone.redstonetools.features.arguments.serializers.DirectionSerializer.direction; import static tools.redstone.redstonetools.features.arguments.serializers.IntegerSerializer.integer; diff --git a/src/main/java/tools/redstone/redstonetools/features/feedback/FeedbackSender.java b/src/main/java/tools/redstone/redstonetools/features/feedback/FeedbackSender.java index efd5a156..9528ab5a 100644 --- a/src/main/java/tools/redstone/redstonetools/features/feedback/FeedbackSender.java +++ b/src/main/java/tools/redstone/redstonetools/features/feedback/FeedbackSender.java @@ -1,9 +1,10 @@ package tools.redstone.redstonetools.features.feedback; import net.minecraft.server.command.ServerCommandSource; -import net.minecraft.text.LiteralText; +import net.minecraft.text.Text; import javax.inject.Singleton; +import java.util.function.Supplier; @Singleton public class FeedbackSender extends AbstractFeedbackSender { @@ -12,8 +13,9 @@ public void sendFeedback(ServerCommandSource source, Feedback feedback) { if (feedback.getType() == FeedbackType.NONE) { return; } + Supplier feedbackSupplier = () -> Text.literal(feedback.getMessage()) + .formatted(feedback.getFormatting()); - source.sendFeedback(new LiteralText(feedback.getMessage()) - .formatted(feedback.getFormatting()), false); + source.sendFeedback(feedbackSupplier, false); } } diff --git a/src/main/java/tools/redstone/redstonetools/macros/gui/screen/MacroEditScreen.java b/src/main/java/tools/redstone/redstonetools/macros/gui/screen/MacroEditScreen.java index 0e7ac2b2..6918d673 100644 --- a/src/main/java/tools/redstone/redstonetools/macros/gui/screen/MacroEditScreen.java +++ b/src/main/java/tools/redstone/redstonetools/macros/gui/screen/MacroEditScreen.java @@ -21,7 +21,6 @@ import net.minecraft.client.util.InputUtil.Type; import net.minecraft.client.util.math.MatrixStack; import net.minecraft.screen.ScreenTexts; -import net.minecraft.text.LiteralText; import net.minecraft.text.Text; import net.minecraft.util.Formatting; import tools.redstone.redstonetools.utils.KeyBindingUtils; @@ -92,11 +91,11 @@ public void init() { Key keyCode = macro.getKey(); Text text = keyCode.getLocalizedText(); if (keyCode == InputUtil.UNKNOWN_KEY) text = Text.of(""); - if ( KeyBindingUtils.isKeyAlreadyBound(keyCode) ) { text = new LiteralText(text.getString()).formatted(Formatting.RED); } + if ( KeyBindingUtils.isKeyAlreadyBound(keyCode) ) { text = Text.literal(text.getString()).formatted(Formatting.RED); } keyBindButton = new ButtonWidget(this.width / 2 + 26, 55, 75, 20, text, (button) -> { detectingKeycodeKey = true; - keyBindButton.setMessage((new LiteralText("> ")).append(keyBindButton.getMessage().copy().formatted(Formatting.YELLOW)).append(" <").formatted(Formatting.YELLOW)); + keyBindButton.setMessage((Text.literal("> ")).append(keyBindButton.getMessage().copy().formatted(Formatting.YELLOW)).append(" <").formatted(Formatting.YELLOW)); }); if (detectingKeycodeKey) keyBindButton.onPress(); diff --git a/src/main/java/tools/redstone/redstonetools/macros/gui/widget/commandlist/CommandEntry.java b/src/main/java/tools/redstone/redstonetools/macros/gui/widget/commandlist/CommandEntry.java index bdc9c0da..5258f904 100644 --- a/src/main/java/tools/redstone/redstonetools/macros/gui/widget/commandlist/CommandEntry.java +++ b/src/main/java/tools/redstone/redstonetools/macros/gui/widget/commandlist/CommandEntry.java @@ -1,5 +1,6 @@ package tools.redstone.redstonetools.macros.gui.widget.commandlist; +import net.minecraft.client.gui.DrawContext; import tools.redstone.redstonetools.macros.gui.MacroCommandSuggestor; import tools.redstone.redstonetools.macros.gui.widget.IconButtonWidget; import net.minecraft.client.MinecraftClient; @@ -67,6 +68,11 @@ public void setFocused(boolean focused){ owner.focusOn(this); } + @Override + public void render(DrawContext context, int index, int y, int x, int entryWidth, int entryHeight, int mouseX, int mouseY, boolean hovered, float tickDelta) { + return; + } + protected String getText() { return command.getText(); } diff --git a/src/main/java/tools/redstone/redstonetools/mixin/accessors/MinecraftClientAccessor.java b/src/main/java/tools/redstone/redstonetools/mixin/accessors/MinecraftClientAccessor.java index 6996cf54..17ff6b16 100644 --- a/src/main/java/tools/redstone/redstonetools/mixin/accessors/MinecraftClientAccessor.java +++ b/src/main/java/tools/redstone/redstonetools/mixin/accessors/MinecraftClientAccessor.java @@ -9,7 +9,7 @@ @Mixin(MinecraftClient.class) public interface MinecraftClientAccessor { - @Invoker - ItemStack invokeAddBlockEntityNbt(ItemStack stack, BlockEntity blockEntity); + @Invoker("addBlockEntityNbt") + void invokeAddBlockEntityNbt(ItemStack stack, BlockEntity blockEntity); } diff --git a/src/main/java/tools/redstone/redstonetools/utils/DirectionUtils.java b/src/main/java/tools/redstone/redstonetools/utils/DirectionUtils.java index 8fbcbe3b..094b654b 100644 --- a/src/main/java/tools/redstone/redstonetools/utils/DirectionUtils.java +++ b/src/main/java/tools/redstone/redstonetools/utils/DirectionUtils.java @@ -33,7 +33,7 @@ public static DirectionArgument relativeToAbsolute(DirectionArgument direction, default -> null; }; case LEFT -> switch (firstOrdinal(playerFacing)) { - case UP, DOWN -> throw new CommandException(Text.of("Can't determine direction")); + //case UP, DOWN -> throw new CommandException(Text.of("Can't determine direction")); case NORTH -> DirectionArgument.WEST; case EAST -> DirectionArgument.NORTH; case SOUTH -> DirectionArgument.EAST; @@ -45,7 +45,7 @@ public static DirectionArgument relativeToAbsolute(DirectionArgument direction, default -> null; }; case RIGHT -> switch (firstOrdinal(playerFacing)) { - case UP, DOWN -> throw new CommandException(Text.of("Can't determine direction")); + //case UP, DOWN -> throw new CommandException(Text.of("Can't determine direction")); case NORTH -> DirectionArgument.EAST; case EAST -> DirectionArgument.SOUTH; case SOUTH -> DirectionArgument.WEST; @@ -76,8 +76,7 @@ public static DirectionArgument relativeToAbsolute(DirectionArgument direction, // big evil match direction function, there might be a better way to do this but // i don't know how @NotNull - public static Direction matchDirection(DirectionArgument direction, Direction playerFacing) - throws CommandException { + public static Direction matchDirection(DirectionArgument direction, Direction playerFacing) { var absoluteDirection = relativeToAbsolute(direction, playerFacing); return switch (absoluteDirection) { case NORTH -> Direction.NORTH; diff --git a/src/main/java/tools/redstone/redstonetools/utils/SignalBlockSupplier.java b/src/main/java/tools/redstone/redstonetools/utils/SignalBlockSupplier.java index 0e42015c..92354ba8 100644 --- a/src/main/java/tools/redstone/redstonetools/utils/SignalBlockSupplier.java +++ b/src/main/java/tools/redstone/redstonetools/utils/SignalBlockSupplier.java @@ -9,6 +9,7 @@ import net.minecraft.nbt.NbtList; import net.minecraft.registry.Registries; import net.minecraft.registry.Registry; +import net.minecraft.text.Text; import net.minecraft.text.MutableText; import net.minecraft.text.Text; import net.minecraft.util.Formatting;