diff --git a/src/main/java/betterblockentities/gui/ConfigScreen.java b/src/main/java/betterblockentities/gui/ConfigScreen.java index e53e417..a729ce9 100644 --- a/src/main/java/betterblockentities/gui/ConfigScreen.java +++ b/src/main/java/betterblockentities/gui/ConfigScreen.java @@ -36,7 +36,8 @@ public class ConfigScreen extends GameOptionsScreen { private SimpleOption signDistance; public ConfigScreen(Screen parent) { - super(parent, MinecraftClient.getInstance().options, Text.translatable("Better Block Entities")); + + super(parent, MinecraftClient.getInstance().options, Text.translatable("config.betterblockentities.title")); this.originalConfig = ConfigManager.CONFIG.copy(); } @@ -78,9 +79,9 @@ protected void addOptions() { private SimpleOption masterToggle() { return new SimpleOption<>( - "Enable Optimizations", - value -> Tooltip.of(Text.of("§7Turns the entire optimization system on or off.")), - (text, value) -> value ? Text.of("§aON") : Text.of("§cOFF"), + "config.betterblockentities.enable_optimizations", + value -> Tooltip.of(Text.translatable("config.betterblockentities.enable_optimizations.tooltip")), + (text, value) -> value ? Text.translatable("config.betterblockentities.on") : Text.translatable("config.betterblockentities.off"), SimpleOption.BOOLEAN, ConfigManager.CONFIG.master_optimize, value -> { @@ -92,9 +93,9 @@ private SimpleOption masterToggle() { private SimpleOption optimizeChests() { return new SimpleOption<>( - "Optimize Chests", - value -> Tooltip.of(Text.of("§7Turns off all Chest optimizations, overrides the option: §l§nChest Animations§r")), - (text, value) -> value ? Text.of("§aON") : Text.of("§cOFF"), + "config.betterblockentities.optimize_chests", + value -> Tooltip.of(Text.translatable("config.betterblockentities.optimize_chests.tooltip")), + (text, value) -> value ? Text.translatable("config.betterblockentities.on") : Text.translatable("config.betterblockentities.off"), SimpleOption.BOOLEAN, ConfigManager.CONFIG.optimize_chests, v -> { @@ -106,7 +107,7 @@ private SimpleOption optimizeChests() { private SimpleOption chestsAnimations() { return booleanOption( - "Chest Animations", + "config.betterblockentities.chest_animations", ConfigManager.CONFIG.chest_animations, v -> ConfigManager.CONFIG.chest_animations = v ); @@ -114,9 +115,9 @@ private SimpleOption chestsAnimations() { private SimpleOption optimizeSigns() { return new SimpleOption<>( - "Optimize Signs", - value -> Tooltip.of(Text.of("§7Turns off all Sign optimizations, overrides the option: §l§nSign Text§r")), - (text, value) -> value ? Text.of("§aON") : Text.of("§cOFF"), + "config.betterblockentities.optimize_signs", + value -> Tooltip.of(Text.translatable("config.betterblockentities.optimize_signs.tooltip")), + (text, value) -> value ? Text.translatable("config.betterblockentities.on") : Text.translatable("config.betterblockentities.off"), SimpleOption.BOOLEAN, ConfigManager.CONFIG.optimize_signs, v -> { @@ -128,7 +129,7 @@ private SimpleOption optimizeSigns() { private SimpleOption renderSignText() { return booleanOption( - "Sign Text", + "config.betterblockentities.render_sign_text", ConfigManager.CONFIG.render_sign_text, v -> ConfigManager.CONFIG.render_sign_text = v ); @@ -136,9 +137,9 @@ private SimpleOption renderSignText() { private SimpleOption optimizeShulkers() { return new SimpleOption<>( - "Optimize Shulkers", - value -> Tooltip.of(Text.of("§7Turns off all ShulkerBox optimizations, overrides the option: §l§nShulker Animations§r")), - (text, value) -> value ? Text.of("§aON") : Text.of("§cOFF"), + "config.betterblockentities.optimize_shulkers", + value -> Tooltip.of(Text.translatable("config.betterblockentities.optimize_shulkers.tooltip")), + (text, value) -> value ? Text.translatable("config.betterblockentities.on") : Text.translatable("config.betterblockentities.off"), SimpleOption.BOOLEAN, ConfigManager.CONFIG.optimize_shulkers, v -> { @@ -150,7 +151,7 @@ private SimpleOption optimizeShulkers() { private SimpleOption shulkerAnimations() { return booleanOption( - "Shulker Animations", + "config.betterblockentities.shulker_animations", ConfigManager.CONFIG.shulker_animations, v -> ConfigManager.CONFIG.shulker_animations = v ); @@ -158,9 +159,9 @@ private SimpleOption shulkerAnimations() { private SimpleOption optimizeBeds() { return new SimpleOption<>( - "Optimize Beds", - value -> Tooltip.of(Text.of("§7Turns off all Bed optimizations")), - (text, value) -> value ? Text.of("§aON") : Text.of("§cOFF"), + "config.betterblockentities.optimize_beds", + value -> Tooltip.of(Text.translatable("config.betterblockentities.optimize_beds.tooltip")), + (text, value) -> value ? Text.translatable("config.betterblockentities.on") : Text.translatable("config.betterblockentities.off"), SimpleOption.BOOLEAN, ConfigManager.CONFIG.optimize_beds, v -> { @@ -172,9 +173,9 @@ private SimpleOption optimizeBeds() { private SimpleOption optimizeBells() { return new SimpleOption<>( - "Optimize Bells", - value -> Tooltip.of(Text.of("§7Turns off all Bell optimizations, overrides the option: §l§nBell Animations§r")), - (text, value) -> value ? Text.of("§aON") : Text.of("§cOFF"), + "config.betterblockentities.optimize_bells", + value -> Tooltip.of(Text.translatable("config.betterblockentities.optimize_bells.tooltip")), + (text, value) -> value ? Text.translatable("config.betterblockentities.on") : Text.translatable("config.betterblockentities.off"), SimpleOption.BOOLEAN, ConfigManager.CONFIG.optimize_bells, v -> { @@ -186,7 +187,7 @@ private SimpleOption optimizeBells() { private SimpleOption bellAnimations() { return booleanOption( - "Bell Animations", + "config.betterblockentities.bell_animations", ConfigManager.CONFIG.bell_animations, v -> ConfigManager.CONFIG.bell_animations = v ); @@ -194,9 +195,9 @@ private SimpleOption bellAnimations() { private SimpleOption optimizeDecoratedPots() { return new SimpleOption<>( - "Optimize Decorated Pots", - value -> Tooltip.of(Text.of("§7Turns off all Decorated Pot optimizations, overrides the option: §l§nDecorated Pot Animations§r")), - (text, value) -> value ? Text.of("§aON") : Text.of("§cOFF"), + "config.betterblockentities.optimize_decorated_pots", + value -> Tooltip.of(Text.translatable("config.betterblockentities.optimize_decorated_pots.tooltip")), + (text, value) -> value ? Text.translatable("config.betterblockentities.on") : Text.translatable("config.betterblockentities.off"), SimpleOption.BOOLEAN, ConfigManager.CONFIG.optimize_decoratedpots, v -> { @@ -208,7 +209,7 @@ private SimpleOption optimizeDecoratedPots() { private SimpleOption potAnimations() { return booleanOption( - "Decorated Pot Animations", + "config.betterblockentities.pot_animations", ConfigManager.CONFIG.pot_animations, v -> ConfigManager.CONFIG.pot_animations = v ); @@ -216,9 +217,10 @@ private SimpleOption potAnimations() { private SimpleOption signTextRenderDistance() { return new SimpleOption<>( - "Sign Text Render Distance", - value -> Tooltip.of(Text.of("§7The amount of blocks the sign text will stop rendering at")), - (text, value) -> Text.of(text.getString() + ": " + value), + "config.betterblockentities.sign_text_render_distance", + value -> Tooltip.of(Text.translatable("config.betterblockentities.sign_text_render_distance.tooltip")), + + (text, value) -> Text.translatable("config.betterblockentities.value_format", text, value), new SimpleOption.ValidatingIntSliderCallbacks(0, 64), ConfigManager.CONFIG.sign_text_render_distance, v -> ConfigManager.CONFIG.sign_text_render_distance = v @@ -227,12 +229,12 @@ private SimpleOption signTextRenderDistance() { private SimpleOption updateType() { return new SimpleOption<>( - "Update Type", - value -> Tooltip.of(Text.of("§7Type of update scheduler being used. §l§nSmart§r §7updates only when the BE is not in line of sight or out of FOV. §l§nFast§r §7updates immediately")), + "config.betterblockentities.update_type", + value -> Tooltip.of(Text.translatable("config.betterblockentities.update_type.tooltip")), (text, value) -> switch (value) { - case 0 -> Text.of("Smart"); - case 1 -> Text.of("Fast"); - default -> Text.of("Fast"); + case 0 -> Text.translatable("config.betterblockentities.update_type.smart"); + case 1 -> Text.translatable("config.betterblockentities.update_type.fast"); + default -> Text.translatable("config.betterblockentities.update_type.fast"); }, new SimpleOption.MaxSuppliableIntCallbacks(0, () -> 1, 1), ConfigManager.CONFIG.updateType, @@ -242,9 +244,10 @@ private SimpleOption updateType() { private SimpleOption extraRenderPasses() { return new SimpleOption<>( - "Extra Render Passes", - value -> Tooltip.of(Text.of("§7The amount of extra render passes each optimized block entity should be rendered for after it stops animating, can help smooth out visual bugs")), - (text, value) -> Text.of(text.getString() + ": " + value), + "config.betterblockentities.extra_render_passes", + value -> Tooltip.of(Text.translatable("config.betterblockentities.extra_render_passes.tooltip")), + // 使用通用格式 "标题: 数值" + (text, value) -> Text.translatable("config.betterblockentities.value_format", text, value), new SimpleOption.ValidatingIntSliderCallbacks(0, 50), ConfigManager.CONFIG.smoothness_slider, v -> ConfigManager.CONFIG.smoothness_slider = v @@ -255,7 +258,7 @@ private SimpleOption booleanOption(String key, boolean initial, java.ut return new SimpleOption<>( key, SimpleOption.emptyTooltip(), - (text, value) -> value ? Text.of("§aON") : Text.of("§cOFF"), + (text, value) -> value ? Text.translatable("config.betterblockentities.on") : Text.translatable("config.betterblockentities.off"), SimpleOption.BOOLEAN, initial, onChange @@ -295,4 +298,4 @@ public void removed() { MinecraftClient.getInstance().reloadResources(); } } -} +} \ No newline at end of file diff --git a/src/main/resources/assets/betterblockentities/lang/en_us.json b/src/main/resources/assets/betterblockentities/lang/en_us.json new file mode 100644 index 0000000..45d4004 --- /dev/null +++ b/src/main/resources/assets/betterblockentities/lang/en_us.json @@ -0,0 +1,43 @@ +{ + "config.betterblockentities.title": "Better Block Entities", + "config.betterblockentities.on": "§aON", + "config.betterblockentities.off": "§cOFF", + "config.betterblockentities.value_format": "%s: %s", + + "config.betterblockentities.enable_optimizations": "Enable Optimizations", + "config.betterblockentities.enable_optimizations.tooltip": "§7Turns the entire optimization system on or off.", + + "config.betterblockentities.optimize_chests": "Optimize Chests", + "config.betterblockentities.optimize_chests.tooltip": "§7Turns off all Chest optimizations, overrides the option: §l§nChest Animations§r", + "config.betterblockentities.chest_animations": "Chest Animations", + + "config.betterblockentities.optimize_signs": "Optimize Signs", + "config.betterblockentities.optimize_signs.tooltip": "§7Turns off all Sign optimizations, overrides the option: §l§nSign Text§r", + "config.betterblockentities.render_sign_text": "Sign Text", + + "config.betterblockentities.optimize_shulkers": "Optimize Shulkers", + "config.betterblockentities.optimize_shulkers.tooltip": "§7Turns off all ShulkerBox optimizations, overrides the option: §l§nShulker Animations§r", + "config.betterblockentities.shulker_animations": "Shulker Animations", + + "config.betterblockentities.optimize_beds": "Optimize Beds", + "config.betterblockentities.optimize_beds.tooltip": "§7Turns off all Bed optimizations", + + "config.betterblockentities.optimize_bells": "Optimize Bells", + "config.betterblockentities.optimize_bells.tooltip": "§7Turns off all Bell optimizations, overrides the option: §l§nBell Animations§r", + "config.betterblockentities.bell_animations": "Bell Animations", + + "config.betterblockentities.optimize_decorated_pots": "Optimize Decorated Pots", + "config.betterblockentities.optimize_decorated_pots.tooltip": "§7Turns off all Decorated Pot optimizations, overrides the option: §l§nDecorated Pot Animations§r", + "config.betterblockentities.pot_animations": "Decorated Pot Animations", + + "config.betterblockentities.sign_text_render_distance": "Sign Text Render Distance", + "config.betterblockentities.sign_text_render_distance.tooltip": "§7The amount of blocks the sign text will stop rendering at", + + "config.betterblockentities.update_type": "Update Type", + "config.betterblockentities.update_type.tooltip": "§7Type of update scheduler being used. §l§nSmart§r §7updates only when the BE is not in line of sight or out of FOV. §l§nFast§r §7updates immediately", + "config.betterblockentities.update_type.smart": "Smart", + "config.betterblockentities.update_type.fast": "Fast", + + "config.betterblockentities.extra_render_passes": "Extra Render Passes", + "config.betterblockentities.extra_render_passes.tooltip": "§7The amount of extra render passes each optimized block entity should be rendered for after it stops animating, can help smooth out visual bugs" +} \ No newline at end of file diff --git a/src/main/resources/assets/betterblockentities/lang/zh_cn.json b/src/main/resources/assets/betterblockentities/lang/zh_cn.json new file mode 100644 index 0000000..ab7ace0 --- /dev/null +++ b/src/main/resources/assets/betterblockentities/lang/zh_cn.json @@ -0,0 +1,43 @@ +{ + "config.betterblockentities.title": "Better Block Entities 设置", + "config.betterblockentities.on": "§a开启", + "config.betterblockentities.off": "§c关闭", + "config.betterblockentities.value_format": "%s: %s", + + "config.betterblockentities.enable_optimizations": "启用优化", + "config.betterblockentities.enable_optimizations.tooltip": "§7开启或关闭整个优化系统。", + + "config.betterblockentities.optimize_chests": "优化箱子", + "config.betterblockentities.optimize_chests.tooltip": "§7开关所有箱子优化,此选项覆盖:§l§n箱子动画§r", + "config.betterblockentities.chest_animations": "箱子动画", + + "config.betterblockentities.optimize_signs": "优化告示牌", + "config.betterblockentities.optimize_signs.tooltip": "§7开关所有告示牌优化,此选项覆盖:§l§n告示牌文本§r", + "config.betterblockentities.render_sign_text": "告示牌文本", + + "config.betterblockentities.optimize_shulkers": "优化潜影盒", + "config.betterblockentities.optimize_shulkers.tooltip": "§7开关所有潜影盒优化,此选项覆盖:§l§n潜影盒动画§r", + "config.betterblockentities.shulker_animations": "潜影盒动画", + + "config.betterblockentities.optimize_beds": "优化床", + "config.betterblockentities.optimize_beds.tooltip": "§7开关所有床的优化", + + "config.betterblockentities.optimize_bells": "优化钟", + "config.betterblockentities.optimize_bells.tooltip": "§7开关所有钟优化,此选项覆盖:§l§n钟动画§r", + "config.betterblockentities.bell_animations": "钟动画", + + "config.betterblockentities.optimize_decorated_pots": "优化饰纹陶罐", + "config.betterblockentities.optimize_decorated_pots.tooltip": "§7开关所有饰纹陶罐优化,此选项覆盖:§l§n饰纹陶罐动画§r", + "config.betterblockentities.pot_animations": "饰纹陶罐动画", + + "config.betterblockentities.sign_text_render_distance": "告示牌文本渲染距离", + "config.betterblockentities.sign_text_render_distance.tooltip": "§7告示牌文本停止渲染的距离(方块数)", + + "config.betterblockentities.update_type": "更新模式", + "config.betterblockentities.update_type.tooltip": "§7使用的更新调度器类型。§l§n智能(Smart)§r §7仅在方块实体不在视线内或视野外时更新。§l§n快速(Fast)§r §7立即更新。", + "config.betterblockentities.update_type.smart": "智能", + "config.betterblockentities.update_type.fast": "快速", + + "config.betterblockentities.extra_render_passes": "额外渲染通道", + "config.betterblockentities.extra_render_passes.tooltip": "§7每个优化后的方块实体在停止动画后应进行的额外渲染通道数量,有助于消除视觉错误" +} \ No newline at end of file