aboutsummaryrefslogtreecommitdiff
path: root/src/main
diff options
context:
space:
mode:
Diffstat (limited to 'src/main')
-rw-r--r--src/main/java/net/girlonthe/simplerenamecommand/SimpleRenameCommand.java5
-rw-r--r--src/main/resources/fabric.mod.json19
-rw-r--r--src/main/resources/icon.pngbin0 -> 6767 bytes
3 files changed, 20 insertions, 4 deletions
diff --git a/src/main/java/net/girlonthe/simplerenamecommand/SimpleRenameCommand.java b/src/main/java/net/girlonthe/simplerenamecommand/SimpleRenameCommand.java
index 780b9f2..3cf709f 100644
--- a/src/main/java/net/girlonthe/simplerenamecommand/SimpleRenameCommand.java
+++ b/src/main/java/net/girlonthe/simplerenamecommand/SimpleRenameCommand.java
@@ -16,6 +16,7 @@ import net.minecraft.network.chat.PlayerChatMessage;
import net.minecraft.network.chat.ChatType.Bound;
import net.minecraft.server.level.ServerPlayer;
import net.minecraft.world.item.ItemStack;
+import net.minecraft.ChatFormatting;
import net.minecraft.commands.CommandSourceStack;
import net.minecraft.commands.Commands;
@@ -29,10 +30,10 @@ public class SimpleRenameCommand implements ModInitializer {
.executes(ctx -> {
ServerPlayer src = ctx.getSource().getPlayerOrException();
ItemStack stack = src.getMainHandItem();
- if (stack != null) {
+ if (!stack.isEmpty()) {
stack.set(DataComponents.CUSTOM_NAME, ctx.getArgument("itemName", Component.class));
} else {
- src.sendChatMessage(OutgoingChatMessage.create(PlayerChatMessage.system("slur")), true, ChatType.bind(ChatType.CHAT, ctx.getSource()));
+ src.sendSystemMessage(Component.literal("You must be holding an item.").withStyle(ChatFormatting.RED));
}
return Command.SINGLE_SUCCESS;
diff --git a/src/main/resources/fabric.mod.json b/src/main/resources/fabric.mod.json
index f661659..72832b7 100644
--- a/src/main/resources/fabric.mod.json
+++ b/src/main/resources/fabric.mod.json
@@ -3,9 +3,24 @@
"id": "simple-rename-command",
"version": "${version}",
"name": "Simple Rename Command",
- "description": "Do you really need me to tell you what it does?",
- "authors": ["Rosa (girlonthe.net)"],
+ "description": "A dead simple command to rename the held item.",
+ "authors": [
+ {
+ "name": "Rosa (girlonthe.net)",
+ "contact": {
+ "discord": "https://discord.gg/A2FEXREAtQ",
+ "email": "rosaontheweb@proton.me",
+ "matrix": "https://matrix.to/#/@rosa:girlonthe.net"
+ }
+ }
+ ],
+ "contact": {
+ "discord": "https://discord.gg/A2FEXREAtQ",
+ "issues": "https://codeberg.org/girlonthenet/simple-rename-command/issues",
+ "sources": "https://codeberg.org/girlonthenet/simple-rename-command"
+ },
"license": "Unlicense",
+ "icon": "icon.png",
"environment": "*",
"entrypoints": {
"main": ["net.girlonthe.simplerenamecommand.SimpleRenameCommand"]
diff --git a/src/main/resources/icon.png b/src/main/resources/icon.png
new file mode 100644
index 0000000..0931072
--- /dev/null
+++ b/src/main/resources/icon.png
Binary files differ