Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
83 changes: 43 additions & 40 deletions src/main/java/betterblockentities/gui/ConfigScreen.java
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,8 @@ public class ConfigScreen extends GameOptionsScreen {
private SimpleOption<Integer> 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();
}

Expand Down Expand Up @@ -78,9 +79,9 @@ protected void addOptions() {

private SimpleOption<Boolean> 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 -> {
Expand All @@ -92,9 +93,9 @@ private SimpleOption<Boolean> masterToggle() {

private SimpleOption<Boolean> 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 -> {
Expand All @@ -106,17 +107,17 @@ private SimpleOption<Boolean> optimizeChests() {

private SimpleOption<Boolean> chestsAnimations() {
return booleanOption(
"Chest Animations",
"config.betterblockentities.chest_animations",
ConfigManager.CONFIG.chest_animations,
v -> ConfigManager.CONFIG.chest_animations = v
);
}

private SimpleOption<Boolean> 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 -> {
Expand All @@ -128,17 +129,17 @@ private SimpleOption<Boolean> optimizeSigns() {

private SimpleOption<Boolean> renderSignText() {
return booleanOption(
"Sign Text",
"config.betterblockentities.render_sign_text",
ConfigManager.CONFIG.render_sign_text,
v -> ConfigManager.CONFIG.render_sign_text = v
);
}

private SimpleOption<Boolean> 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 -> {
Expand All @@ -150,17 +151,17 @@ private SimpleOption<Boolean> optimizeShulkers() {

private SimpleOption<Boolean> shulkerAnimations() {
return booleanOption(
"Shulker Animations",
"config.betterblockentities.shulker_animations",
ConfigManager.CONFIG.shulker_animations,
v -> ConfigManager.CONFIG.shulker_animations = v
);
}

private SimpleOption<Boolean> 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 -> {
Expand All @@ -172,9 +173,9 @@ private SimpleOption<Boolean> optimizeBeds() {

private SimpleOption<Boolean> 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 -> {
Expand All @@ -186,17 +187,17 @@ private SimpleOption<Boolean> optimizeBells() {

private SimpleOption<Boolean> bellAnimations() {
return booleanOption(
"Bell Animations",
"config.betterblockentities.bell_animations",
ConfigManager.CONFIG.bell_animations,
v -> ConfigManager.CONFIG.bell_animations = v
);
}

private SimpleOption<Boolean> 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 -> {
Expand All @@ -208,17 +209,18 @@ private SimpleOption<Boolean> optimizeDecoratedPots() {

private SimpleOption<Boolean> potAnimations() {
return booleanOption(
"Decorated Pot Animations",
"config.betterblockentities.pot_animations",
ConfigManager.CONFIG.pot_animations,
v -> ConfigManager.CONFIG.pot_animations = v
);
}

private SimpleOption<Integer> 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
Expand All @@ -227,12 +229,12 @@ private SimpleOption<Integer> signTextRenderDistance() {

private SimpleOption<Integer> 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,
Expand All @@ -242,9 +244,10 @@ private SimpleOption<Integer> updateType() {

private SimpleOption<Integer> 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
Expand All @@ -255,7 +258,7 @@ private SimpleOption<Boolean> 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
Expand Down Expand Up @@ -295,4 +298,4 @@ public void removed() {
MinecraftClient.getInstance().reloadResources();
}
}
}
}
43 changes: 43 additions & 0 deletions src/main/resources/assets/betterblockentities/lang/en_us.json
Original file line number Diff line number Diff line change
@@ -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"
}
43 changes: 43 additions & 0 deletions src/main/resources/assets/betterblockentities/lang/zh_cn.json
Original file line number Diff line number Diff line change
@@ -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每个优化后的方块实体在停止动画后应进行的额外渲染通道数量,有助于消除视觉错误"
}