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

View File

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