feat(C-01): i18n main commands — 148 translatable keys

Phase 3: Migrate Component.literal() in all remaining command files.
- NPCCommand (34), CellCommand (33), SocialCommand (16), CollarCommand (25),
  KeyCommand (18), BountyCommand (6), KidnapSetCommand (2), CaptivityDebugCommand (7),
  InventorySubCommand (3), TestAnimSubCommand (2), MasterTestSubCommand (7), DebtSubCommand (8)
- Strip all section sign color codes, use .withStyle(ChatFormatting)
- 148 new keys in en_us.json (command.tiedup.*)
- Debug/dynamic strings intentionally kept as literal
This commit is contained in:
NotEvil
2026-04-15 13:54:26 +02:00
parent 70965c2dda
commit fa5cfb913c
14 changed files with 478 additions and 445 deletions

View File

@@ -13,6 +13,7 @@ import net.minecraft.resources.ResourceLocation;
import com.tiedup.remake.v2.BodyRegionV2;
import java.util.List;
import java.util.Optional;
import net.minecraft.ChatFormatting;
import net.minecraft.commands.CommandSourceStack;
import net.minecraft.commands.Commands;
import net.minecraft.commands.arguments.EntityArgument;
@@ -199,7 +200,7 @@ public class NPCCommand {
z = player.getZ();
} else {
source.sendFailure(
Component.literal("Must specify a player or be a player")
Component.translatable("command.tiedup.error.must_be_player")
);
return 0;
}
@@ -219,15 +220,15 @@ public class NPCCommand {
source.sendSuccess(
() ->
Component.literal(
"§aSpawned Kidnapper at " + formatPos(x, y, z)
),
Component.translatable(
"command.tiedup.npc.spawned_kidnapper", formatPos(x, y, z)
).withStyle(ChatFormatting.GREEN),
true
);
return 1;
}
source.sendFailure(Component.literal("Failed to spawn Kidnapper"));
source.sendFailure(Component.translatable("command.tiedup.npc.spawn_failed_kidnapper"));
return 0;
}
@@ -245,11 +246,7 @@ public class NPCCommand {
);
if (variant == null) {
source.sendFailure(
Component.literal(
"Unknown elite variant: " +
name +
". Available: suki, carol, athena, evelyn"
)
Component.translatable("command.tiedup.npc.unknown_variant", name)
);
return 0;
}
@@ -266,7 +263,7 @@ public class NPCCommand {
z = player.getZ();
} else {
source.sendFailure(
Component.literal("Must specify a player or be a player")
Component.translatable("command.tiedup.error.must_be_player")
);
return 0;
}
@@ -289,19 +286,16 @@ public class NPCCommand {
source.sendSuccess(
() ->
Component.literal(
"§aSpawned Elite Kidnapper '" +
variant.defaultName() +
"' at " +
formatPos(x, y, z)
),
Component.translatable(
"command.tiedup.npc.spawned_elite", variant.defaultName(), formatPos(x, y, z)
).withStyle(ChatFormatting.GREEN),
true
);
return 1;
}
source.sendFailure(
Component.literal("Failed to spawn Elite Kidnapper")
Component.translatable("command.tiedup.npc.spawn_failed_elite")
);
return 0;
}
@@ -325,7 +319,7 @@ public class NPCCommand {
z = player.getZ();
} else {
source.sendFailure(
Component.literal("Must specify a player or be a player")
Component.translatable("command.tiedup.error.must_be_player")
);
return 0;
}
@@ -346,16 +340,16 @@ public class NPCCommand {
source.sendSuccess(
() ->
Component.literal(
"§aSpawned Archer Kidnapper at " + formatPos(x, y, z)
),
Component.translatable(
"command.tiedup.npc.spawned_archer", formatPos(x, y, z)
).withStyle(ChatFormatting.GREEN),
true
);
return 1;
}
source.sendFailure(
Component.literal("Failed to spawn Archer Kidnapper")
Component.translatable("command.tiedup.npc.spawn_failed_archer")
);
return 0;
}
@@ -379,7 +373,7 @@ public class NPCCommand {
z = player.getZ();
} else {
source.sendFailure(
Component.literal("Must specify a player or be a player")
Component.translatable("command.tiedup.error.must_be_player")
);
return 0;
}
@@ -399,15 +393,15 @@ public class NPCCommand {
source.sendSuccess(
() ->
Component.literal(
"§aSpawned Damsel at " + formatPos(x, y, z)
),
Component.translatable(
"command.tiedup.npc.spawned_damsel", formatPos(x, y, z)
).withStyle(ChatFormatting.GREEN),
true
);
return 1;
}
source.sendFailure(Component.literal("Failed to spawn Damsel"));
source.sendFailure(Component.translatable("command.tiedup.npc.spawn_failed_damsel"));
return 0;
}
@@ -441,9 +435,9 @@ public class NPCCommand {
int finalKilled = killed;
source.sendSuccess(
() ->
Component.literal(
"§aKilled " + finalKilled + " mod NPCs in radius " + radius
),
Component.translatable(
"command.tiedup.npc.killed", finalKilled, radius
).withStyle(ChatFormatting.GREEN),
true
);
@@ -491,7 +485,7 @@ public class NPCCommand {
context
.getSource()
.sendFailure(
Component.literal("No mod NPC found within 10 blocks")
Component.translatable("command.tiedup.npc.no_npc_nearby")
);
return 0;
}
@@ -499,7 +493,7 @@ public class NPCCommand {
if (npc.isTiedUp()) {
context
.getSource()
.sendFailure(Component.literal("NPC is already tied up"));
.sendFailure(Component.translatable("command.tiedup.npc.already_tied"));
return 0;
}
@@ -510,7 +504,7 @@ public class NPCCommand {
context
.getSource()
.sendSuccess(
() -> Component.literal("§aTied up " + npc.getKidnappedName()),
() -> Component.translatable("command.tiedup.npc.tied", npc.getKidnappedName()).withStyle(ChatFormatting.GREEN),
true
);
return 1;
@@ -522,7 +516,7 @@ public class NPCCommand {
context
.getSource()
.sendFailure(
Component.literal("No mod NPC found within 10 blocks")
Component.translatable("command.tiedup.npc.no_npc_nearby")
);
return 0;
}
@@ -530,7 +524,7 @@ public class NPCCommand {
if (npc.isGagged()) {
context
.getSource()
.sendFailure(Component.literal("NPC is already gagged"));
.sendFailure(Component.translatable("command.tiedup.npc.already_gagged"));
return 0;
}
@@ -541,7 +535,7 @@ public class NPCCommand {
context
.getSource()
.sendSuccess(
() -> Component.literal("§aGagged " + npc.getKidnappedName()),
() -> Component.translatable("command.tiedup.npc.gagged", npc.getKidnappedName()).withStyle(ChatFormatting.GREEN),
true
);
return 1;
@@ -555,7 +549,7 @@ public class NPCCommand {
context
.getSource()
.sendFailure(
Component.literal("No mod NPC found within 10 blocks")
Component.translatable("command.tiedup.npc.no_npc_nearby")
);
return 0;
}
@@ -563,7 +557,7 @@ public class NPCCommand {
if (npc.isBlindfolded()) {
context
.getSource()
.sendFailure(Component.literal("NPC is already blindfolded"));
.sendFailure(Component.translatable("command.tiedup.npc.already_blindfolded"));
return 0;
}
@@ -575,9 +569,8 @@ public class NPCCommand {
.getSource()
.sendSuccess(
() ->
Component.literal(
"§aBlindfolded " + npc.getKidnappedName()
),
Component.translatable("command.tiedup.npc.blindfolded", npc.getKidnappedName()
).withStyle(ChatFormatting.GREEN),
true
);
return 1;
@@ -589,7 +582,7 @@ public class NPCCommand {
context
.getSource()
.sendFailure(
Component.literal("No mod NPC found within 10 blocks")
Component.translatable("command.tiedup.npc.no_npc_nearby")
);
return 0;
}
@@ -597,7 +590,7 @@ public class NPCCommand {
if (npc.hasCollar()) {
context
.getSource()
.sendFailure(Component.literal("NPC already has a collar"));
.sendFailure(Component.translatable("command.tiedup.npc.already_collared"));
return 0;
}
@@ -608,7 +601,7 @@ public class NPCCommand {
context
.getSource()
.sendSuccess(
() -> Component.literal("§aCollared " + npc.getKidnappedName()),
() -> Component.translatable("command.tiedup.npc.collared", npc.getKidnappedName()).withStyle(ChatFormatting.GREEN),
true
);
return 1;
@@ -620,7 +613,7 @@ public class NPCCommand {
context
.getSource()
.sendFailure(
Component.literal("No mod NPC found within 10 blocks")
Component.translatable("command.tiedup.npc.no_npc_nearby")
);
return 0;
}
@@ -629,7 +622,7 @@ public class NPCCommand {
context
.getSource()
.sendSuccess(
() -> Component.literal("§aUntied " + npc.getKidnappedName()),
() -> Component.translatable("command.tiedup.npc.untied", npc.getKidnappedName()).withStyle(ChatFormatting.GREEN),
true
);
return 1;
@@ -643,7 +636,7 @@ public class NPCCommand {
context
.getSource()
.sendFailure(
Component.literal("No mod NPC found within 10 blocks")
Component.translatable("command.tiedup.npc.no_npc_nearby")
);
return 0;
}
@@ -667,9 +660,9 @@ public class NPCCommand {
.getSource()
.sendSuccess(
() ->
Component.literal(
"§aFully restrained " + npc.getKidnappedName()
),
Component.translatable(
"command.tiedup.npc.fully_restrained", npc.getKidnappedName()
).withStyle(ChatFormatting.GREEN),
true
);
return 1;
@@ -683,7 +676,7 @@ public class NPCCommand {
context
.getSource()
.sendFailure(
Component.literal("No mod NPC found within 10 blocks")
Component.translatable("command.tiedup.npc.no_npc_nearby")
);
return 0;
}
@@ -692,68 +685,67 @@ public class NPCCommand {
source.sendSuccess(
() ->
Component.literal(
"§6=== NPC State: " + npc.getKidnappedName() + " ==="
),
Component.translatable(
"command.tiedup.npc.state_header", npc.getKidnappedName()
).withStyle(ChatFormatting.GOLD),
false
);
if (npc instanceof EntityDamsel damsel) {
source.sendSuccess(
() ->
Component.literal("§eVariant: §f" + damsel.getVariantId()),
Component.translatable("command.tiedup.npc.state_variant", damsel.getVariantId()).withStyle(ChatFormatting.YELLOW),
false
);
source.sendSuccess(
() ->
Component.literal(
"§eSlim Arms: " +
(damsel.hasSlimArms() ? "§aYes" : "§7No")
),
Component.translatable("command.tiedup.npc.state_slim_arms",
Component.translatable(damsel.hasSlimArms() ? "command.tiedup.yes" : "command.tiedup.no")
).withStyle(ChatFormatting.YELLOW),
false
);
}
source.sendSuccess(
() ->
Component.literal(
"§eTied Up: " + (npc.isTiedUp() ? "§aYes" : "§7No")
),
Component.translatable("command.tiedup.npc.state_tied",
Component.translatable(npc.isTiedUp() ? "command.tiedup.yes" : "command.tiedup.no")
).withStyle(ChatFormatting.YELLOW),
false
);
source.sendSuccess(
() ->
Component.literal(
"§eGagged: " + (npc.isGagged() ? "§aYes" : "§7No")
),
Component.translatable("command.tiedup.npc.state_gagged",
Component.translatable(npc.isGagged() ? "command.tiedup.yes" : "command.tiedup.no")
).withStyle(ChatFormatting.YELLOW),
false
);
source.sendSuccess(
() ->
Component.literal(
"§eBlindfolded: " + (npc.isBlindfolded() ? "§aYes" : "§7No")
),
Component.translatable("command.tiedup.npc.state_blindfolded",
Component.translatable(npc.isBlindfolded() ? "command.tiedup.yes" : "command.tiedup.no")
).withStyle(ChatFormatting.YELLOW),
false
);
source.sendSuccess(
() ->
Component.literal(
"§eHas Collar: " + (npc.hasCollar() ? "§aYes" : "§7No")
),
Component.translatable("command.tiedup.npc.state_collar",
Component.translatable(npc.hasCollar() ? "command.tiedup.yes" : "command.tiedup.no")
).withStyle(ChatFormatting.YELLOW),
false
);
source.sendSuccess(
() ->
Component.literal(
"§eHas Earplugs: " + (npc.hasEarplugs() ? "§aYes" : "§7No")
),
Component.translatable("command.tiedup.npc.state_earplugs",
Component.translatable(npc.hasEarplugs() ? "command.tiedup.yes" : "command.tiedup.no")
).withStyle(ChatFormatting.YELLOW),
false
);
source.sendSuccess(
() ->
Component.literal(
"§eIs Captive: " + (npc.isCaptive() ? "§aYes" : "§7No")
),
Component.translatable("command.tiedup.npc.state_captive",
Component.translatable(npc.isCaptive() ? "command.tiedup.yes" : "command.tiedup.no")
).withStyle(ChatFormatting.YELLOW),
false
);