Skip to content

Commit

Permalink
Deleted random ununsed imports and fixed all the LiteralText erros (n…
Browse files Browse the repository at this point in the history
…ow denoted with Text.literal or Text.of)
maghedo243 committed Dec 31, 2023

Verified

This commit was created on GitHub.com and signed with GitHub’s verified signature. The key has expired.
1 parent 610719a commit 5abac36
Showing 14 changed files with 30 additions and 36 deletions.
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
package tools.redstone.redstonetools.features.arguments.serializers;

import Z;
import com.mojang.brigadier.StringReader;
import com.mojang.brigadier.exceptions.CommandSyntaxException;
import net.minecraft.block.Block;
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
package tools.redstone.redstonetools.features.arguments.serializers;

import ;
import com.mojang.brigadier.StringReader;
import com.mojang.brigadier.context.CommandContext;
import com.mojang.brigadier.exceptions.CommandSyntaxException;
Original file line number Diff line number Diff line change
@@ -26,7 +26,7 @@
import static tools.redstone.redstonetools.features.arguments.serializers.IntegerSerializer.integer;
import static tools.redstone.redstonetools.features.arguments.serializers.NumberBaseSerializer.numberBase;

import Z;


@AutoService(AbstractFeature.class)
@Feature(name = "Binary Block Read", description = "Interprets your WorldEdit selection as a binary number.", command = "/read", worldedit = true)
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
package tools.redstone.redstonetools.features.commands;

import Z;

import com.google.auto.service.AutoService;
import tools.redstone.redstonetools.features.AbstractFeature;
import tools.redstone.redstonetools.features.Feature;
Original file line number Diff line number Diff line change
@@ -18,7 +18,7 @@
import static tools.redstone.redstonetools.features.arguments.serializers.BoolSerializer.bool;
import static tools.redstone.redstonetools.features.arguments.serializers.FloatSerializer.floatArg;

import D;


@AutoService(AbstractFeature.class)
@Feature(name = "Quick TP", description = "Teleports you in the direction you are looking.", command = "quicktp")
Original file line number Diff line number Diff line change
@@ -1,37 +1,30 @@
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;
import static tools.redstone.redstonetools.utils.DirectionUtils.directionToBlock;
import static tools.redstone.redstonetools.utils.DirectionUtils.matchDirection;

import I;

@AutoService(AbstractFeature.class)
@Feature(name = "RStack", description = "Stacks with custom distance", command = "/rstack", worldedit = true)
public class RStackFeature extends CommandFeature {
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 {
@@ -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
@@ -41,8 +41,6 @@

import static tools.redstone.redstonetools.RedstoneToolsClient.INJECTOR;

import Z;

import static net.minecraft.server.command.CommandManager.argument;
import static net.minecraft.server.command.CommandManager.literal;

Original file line number Diff line number Diff line change
@@ -12,8 +12,7 @@
import javax.json.JsonObject;
import javax.json.JsonReader;
import javax.json.JsonWriter;
import ;
import Z;

import java.io.FileReader;
import java.io.FileWriter;
import java.io.IOException;
Original file line number Diff line number Diff line change
@@ -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();

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;
@@ -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();
}
Original file line number Diff line number Diff line change
@@ -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
@@ -3,8 +3,6 @@

import com.sk89q.worldedit.math.BlockVector3;
import com.sk89q.worldedit.util.Direction;
import net.minecraft.command.CommandException;
import net.minecraft.text.Text;
import org.jetbrains.annotations.NotNull;

public class DirectionUtils {
@@ -34,7 +32,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;
@@ -46,7 +44,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,7 +74,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;
Original file line number Diff line number Diff line change
@@ -8,8 +8,9 @@
import net.minecraft.nbt.NbtCompound;
import net.minecraft.nbt.NbtList;
import net.minecraft.registry.Registry;
import net.minecraft.text.LiteralText;
import net.minecraft.text.Text;
import net.minecraft.text.MutableText;
import net.minecraft.text.Text;
import net.minecraft.util.Formatting;
import net.minecraft.util.math.MathHelper;

@@ -123,7 +124,7 @@ private static void setCompoundNbt(ItemStack item, NbtCompound nbt) {
}

private static void setItemName(ItemStack item, int signalStrength) {
MutableText text = new LiteralText(String.valueOf(signalStrength));
MutableText text = Text.literal(String.valueOf(signalStrength));
text.setStyle(text.getStyle().withColor(Formatting.RED));
item.setCustomName(text);
}

0 comments on commit 5abac36

Please sign in to comment.