fix: button category names

This commit is contained in:
Martin Prokoph
2025-10-01 14:12:12 +02:00
parent 4d85879c87
commit 830ac38b02
2 changed files with 7 additions and 19 deletions

View File

@@ -413,7 +413,7 @@ public class ButtonBinding {
}
static {
MOVEMENT_CATEGORY = InputManager.registerDefaultCategory("key.categories.movement", category -> category.registerAllBindings(
MOVEMENT_CATEGORY = InputManager.registerDefaultCategory("movement", category -> category.registerAllBindings(
ButtonBinding.FORWARD,
ButtonBinding.BACK,
ButtonBinding.LEFT,
@@ -421,12 +421,12 @@ public class ButtonBinding {
ButtonBinding.JUMP,
ButtonBinding.SNEAK,
ButtonBinding.SPRINT));
GAMEPLAY_CATEGORY = InputManager.registerDefaultCategory("key.categories.gameplay", category -> category.registerAllBindings(
GAMEPLAY_CATEGORY = InputManager.registerDefaultCategory("gameplay", category -> category.registerAllBindings(
ButtonBinding.ATTACK,
ButtonBinding.PICK_BLOCK,
ButtonBinding.USE
));
INVENTORY_CATEGORY = InputManager.registerDefaultCategory("key.categories.inventory", category -> category.registerAllBindings(
INVENTORY_CATEGORY = InputManager.registerDefaultCategory("inventory", category -> category.registerAllBindings(
ButtonBinding.EXIT,
ButtonBinding.DROP_ITEM,
ButtonBinding.HOTBAR_LEFT,
@@ -445,9 +445,9 @@ public class ButtonBinding {
ButtonBinding.SLOT_LEFT,
ButtonBinding.SLOT_RIGHT
));
MULTIPLAYER_CATEGORY = InputManager.registerDefaultCategory("key.categories.multiplayer",
MULTIPLAYER_CATEGORY = InputManager.registerDefaultCategory("multiplayer",
category -> category.registerAllBindings(ButtonBinding.CHAT, ButtonBinding.PLAYER_LIST));
MISC_CATEGORY = InputManager.registerDefaultCategory("key.categories.misc", category -> category.registerAllBindings(
MISC_CATEGORY = InputManager.registerDefaultCategory("misc", category -> category.registerAllBindings(
ButtonBinding.SCREENSHOT,
ButtonBinding.TOGGLE_PERSPECTIVE,
ButtonBinding.PAUSE_GAME,

View File

@@ -38,15 +38,6 @@ public class ButtonCategory {
public ButtonCategory(@NotNull Identifier id) {
this(id, 100);
}
@Deprecated
public ButtonCategory(@NotNull org.aperlambda.lambdacommon.Identifier id, int priority) {
this(Identifier.of(id.getNamespace(), id.getName()), priority);
}
@Deprecated
public ButtonCategory(@NotNull org.aperlambda.lambdacommon.Identifier id) {
this(id, 100);
}
public void registerBinding(@NotNull ButtonBinding binding) {
if (this.bindings.contains(binding))
@@ -74,15 +65,12 @@ public class ButtonCategory {
/**
* Gets the translated name of this category.
* <p>
* The translation key should be `modid.identifier_name`.
* The translation key should be `key.category.modid.identifier_name`.
*
* @return the translated name
*/
public @NotNull String getTranslatedName() {
if (this.id.getNamespace().equals("minecraft"))
return I18n.translate(this.id.getPath());
else
return I18n.translate(this.id.getNamespace() + "." + this.id.getPath());
return I18n.translate("key.category.%s.%s".formatted(id.getNamespace(), id.getPath()));
}
/**