From bb04df708632278fef7583896824f65397ff2be2 Mon Sep 17 00:00:00 2001 From: Jonathan Coates Date: Fri, 11 Oct 2024 12:12:02 +0200 Subject: [PATCH] Remove command translation keys MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - is no longer used, as positions cannot be nullable. - We don't really need the position one — we can just concatenate in Java. --- .../generated/resources/assets/computercraft/lang/en_us.json | 2 -- .../java/dan200/computercraft/data/LanguageProvider.java | 2 -- .../computercraft/shared/command/text/ChatHelpers.java | 5 ++--- .../peripheral/generic/methods/AbstractInventoryMethods.java | 2 +- .../shared/peripheral/generic/methods/InventoryMethods.java | 2 +- 5 files changed, 4 insertions(+), 9 deletions(-) diff --git a/projects/common/src/generated/resources/assets/computercraft/lang/en_us.json b/projects/common/src/generated/resources/assets/computercraft/lang/en_us.json index a53f4b41d..dde797f0e 100644 --- a/projects/common/src/generated/resources/assets/computercraft/lang/en_us.json +++ b/projects/common/src/generated/resources/assets/computercraft/lang/en_us.json @@ -38,8 +38,6 @@ "commands.computercraft.generic.additional_rows": "%d additional rows…", "commands.computercraft.generic.exception": "Unhandled exception (%s)", "commands.computercraft.generic.no": "N", - "commands.computercraft.generic.no_position": "", - "commands.computercraft.generic.position": "%s, %s, %s", "commands.computercraft.generic.yes": "Y", "commands.computercraft.help.desc": "Displays this help message", "commands.computercraft.help.no_children": "%s has no sub-commands", diff --git a/projects/common/src/main/java/dan200/computercraft/data/LanguageProvider.java b/projects/common/src/main/java/dan200/computercraft/data/LanguageProvider.java index 2dc57e405..1f23f7873 100644 --- a/projects/common/src/main/java/dan200/computercraft/data/LanguageProvider.java +++ b/projects/common/src/main/java/dan200/computercraft/data/LanguageProvider.java @@ -160,8 +160,6 @@ public final class LanguageProvider implements DataProvider { add("commands.computercraft.queue.synopsis", "Send a computer_command event to a command computer"); add("commands.computercraft.queue.desc", "Send a computer_command event to a command computer, passing through the additional arguments. This is mostly designed for map makers, acting as a more computer-friendly version of /trigger. Any player can run the command, which would most likely be done through a text component's click event."); - add("commands.computercraft.generic.no_position", ""); - add("commands.computercraft.generic.position", "%s, %s, %s"); add("commands.computercraft.generic.yes", "Y"); add("commands.computercraft.generic.no", "N"); add("commands.computercraft.generic.exception", "Unhandled exception (%s)"); diff --git a/projects/common/src/main/java/dan200/computercraft/shared/command/text/ChatHelpers.java b/projects/common/src/main/java/dan200/computercraft/shared/command/text/ChatHelpers.java index 849654875..1c9a910f3 100644 --- a/projects/common/src/main/java/dan200/computercraft/shared/command/text/ChatHelpers.java +++ b/projects/common/src/main/java/dan200/computercraft/shared/command/text/ChatHelpers.java @@ -40,9 +40,8 @@ public final class ChatHelpers { return component; } - public static MutableComponent position(@Nullable BlockPos pos) { - if (pos == null) return Component.translatable("commands.computercraft.generic.no_position"); - return Component.translatable("commands.computercraft.generic.position", pos.getX(), pos.getY(), pos.getZ()); + public static MutableComponent position(BlockPos pos) { + return Component.literal(pos.toShortString()); } public static MutableComponent bool(boolean value) { diff --git a/projects/common/src/main/java/dan200/computercraft/shared/peripheral/generic/methods/AbstractInventoryMethods.java b/projects/common/src/main/java/dan200/computercraft/shared/peripheral/generic/methods/AbstractInventoryMethods.java index 1115a46a8..78fd2d934 100644 --- a/projects/common/src/main/java/dan200/computercraft/shared/peripheral/generic/methods/AbstractInventoryMethods.java +++ b/projects/common/src/main/java/dan200/computercraft/shared/peripheral/generic/methods/AbstractInventoryMethods.java @@ -1,6 +1,6 @@ // SPDX-FileCopyrightText: 2020 The CC: Tweaked Developers // -// SPDX-License-Identifier: LicenseRef-CCPL +// SPDX-License-Identifier: MPL-2.0 package dan200.computercraft.shared.peripheral.generic.methods; diff --git a/projects/forge/src/main/java/dan200/computercraft/shared/peripheral/generic/methods/InventoryMethods.java b/projects/forge/src/main/java/dan200/computercraft/shared/peripheral/generic/methods/InventoryMethods.java index 09cec73f1..d1c109485 100644 --- a/projects/forge/src/main/java/dan200/computercraft/shared/peripheral/generic/methods/InventoryMethods.java +++ b/projects/forge/src/main/java/dan200/computercraft/shared/peripheral/generic/methods/InventoryMethods.java @@ -1,6 +1,6 @@ // SPDX-FileCopyrightText: 2020 The CC: Tweaked Developers // -// SPDX-License-Identifier: LicenseRef-CCPL +// SPDX-License-Identifier: MPL-2.0 package dan200.computercraft.shared.peripheral.generic.methods;