Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Deleted random ununsed imports and fixed all the LiteralText errors #348

Merged
merged 2 commits into from
Dec 31, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down
Original file line number Diff line number Diff line change
@@ -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;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down
Original file line number Diff line number Diff line change
@@ -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;
Expand Down
Original file line number Diff line number Diff line change
@@ -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 {
Expand All @@ -12,8 +13,9 @@ public void sendFeedback(ServerCommandSource source, Feedback feedback) {
if (feedback.getType() == FeedbackType.NONE) {
return;
}
Supplier<Text> feedbackSupplier = () -> Text.literal(feedback.getMessage())
.formatted(feedback.getFormatting());

source.sendFeedback(new LiteralText(feedback.getMessage())
.formatted(feedback.getFormatting()), false);
source.sendFeedback(feedbackSupplier, false);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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();

Expand Down
Original file line number Diff line number Diff line change
@@ -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;
Expand Down Expand Up @@ -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();
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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);

}
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand All @@ -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;
Expand Down Expand Up @@ -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;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
Loading