Rework jigsaw screen settings

This commit is contained in:
FlorianMichael 2024-07-06 21:04:24 +02:00
parent 8e639e1ebe
commit 559cabae1c
No known key found for this signature in database
GPG Key ID: C2FB87E71C425126
4 changed files with 18 additions and 15 deletions

View File

@ -60,24 +60,23 @@ public abstract class MixinJigsawBlockScreen extends Screen {
@Inject(method = "init", at = @At("RETURN"))
private void disableWidgets(CallbackInfo ci) {
if (VisualSettings.global().removeNewerFeaturesFromJigsawScreen.isEnabled()) {
if (ProtocolTranslator.getTargetVersion().olderThanOrEqualTo(ProtocolVersion.v1_15_2)) {
nameField.active = false;
jointRotationButton.active = false;
int index = children().indexOf(jointRotationButton);
((ClickableWidget) children().get(index + 1)).active = false; // levels slider
((ClickableWidget) children().get(index + 2)).active = false; // keep jigsaws toggle
((ClickableWidget) children().get(index + 3)).active = false; // generate button
}
if (!VisualSettings.global().hidePrioritySelectionsInJigsawScreen.isEnabled()) {
selectionPriorityField.active = false;
placementPriorityField.active = false;
}
if (VisualSettings.global().hideModernJigsawScreenFeatures.isEnabled()) {
nameField.active = false;
jointRotationButton.active = false;
int index = children().indexOf(jointRotationButton);
((ClickableWidget) children().get(index + 1)).active = false; // levels slider
((ClickableWidget) children().get(index + 2)).active = false; // keep jigsaws toggle
((ClickableWidget) children().get(index + 3)).active = false; // generate button
}
}
@Inject(method = "render", at = @At("HEAD"))
private void copyText(DrawContext context, int mouseX, int mouseY, float delta, CallbackInfo ci) {
if (VisualSettings.global().removeNewerFeaturesFromJigsawScreen.isEnabled() && ProtocolTranslator.getTargetVersion().olderThanOrEqualTo(ProtocolVersion.v1_15_2)) {
if (VisualSettings.global().hideModernJigsawScreenFeatures.isEnabled()) {
nameField.setText(targetField.getText());
}
}

View File

@ -55,7 +55,7 @@ public abstract class MixinScreen {
}
@Inject(method = "addDrawableChild", at = @At("HEAD"), cancellable = true)
public <T extends Element & Drawable & Selectable> void removeRecipeBook(T drawableElement, CallbackInfoReturnable<T> cir) {
private <T extends Element & Drawable & Selectable> void removeRecipeBook(T drawableElement, CallbackInfoReturnable<T> cir) {
if (drawableElement instanceof TexturedButtonWidget button && button.textures == RecipeBookWidget.BUTTON_TEXTURES) {
final boolean furnace = ((Screen) (Object) this) instanceof FurnaceScreen;

View File

@ -30,8 +30,8 @@ public class VisualSettings extends SettingGroup {
private static final VisualSettings INSTANCE = new VisualSettings();
// 1.20.3 -> 1.20.2 and 1.16 -> 1.15.2
public final VersionedBooleanSetting removeNewerFeaturesFromJigsawScreen = new VersionedBooleanSetting(this, Text.translatable("visual_settings.viafabricplus.remove_newer_features_from_jigsaw_screen"), VersionRange.andOlder(ProtocolVersion.v1_20_2));
// 1.20.3 -> 1.20.2
public final VersionedBooleanSetting hidePrioritySelectionsInJigsawScreen = new VersionedBooleanSetting(this, Text.translatable("visual_settings.viafabricplus.hide_priority_selections_in_jigsaw_screen"), VersionRange.andOlder(ProtocolVersion.v1_20_2));
// 1.19.2 -> 1.19
public final VersionedBooleanSetting disableSecureChatWarning = new VersionedBooleanSetting(this, Text.translatable("visual_settings.viafabricplus.disable_secure_chat_warning"), VersionRange.andOlder(ProtocolVersion.v1_19));
@ -39,6 +39,9 @@ public class VisualSettings extends SettingGroup {
// 1.19 -> 1.18.2
public final VersionedBooleanSetting hideSignatureIndicator = new VersionedBooleanSetting(this, Text.translatable("visual_settings.viafabricplus.hide_signature_indicator"), VersionRange.andOlder(ProtocolVersion.v1_18_2));
// 1.16 -> 1.15.2
public final VersionedBooleanSetting hideModernJigsawScreenFeatures = new VersionedBooleanSetting(this, Text.translatable("visual_settings.viafabricplus.hide_modern_jigsaw_screen_features"), VersionRange.andOlder(ProtocolVersion.v1_15_2));
// 1.13 -> 1.12.2
public final VersionedBooleanSetting replacePetrifiedOakSlab = new VersionedBooleanSetting(this, Text.translatable("visual_settings.viafabricplus.replace_petrified_oak_slab"), VersionRange.of(LegacyProtocolVersion.r1_3_1tor1_3_2, ProtocolVersion.v1_12_2));
public final VersionedBooleanSetting changeFontRendererBehaviour = new VersionedBooleanSetting(this, Text.translatable("visual_settings.viafabricplus.change_font_renderer_behaviour"), VersionRange.andOlder(ProtocolVersion.v1_12_2));

View File

@ -73,7 +73,7 @@
"visual_settings.viafabricplus.disable_secure_chat_warning": "Disable Secure Chat warning",
"visual_settings.viafabricplus.hide_signature_indicator": "Hide signature indicator",
"visual_settings.viafabricplus.remove_newer_features_from_jigsaw_screen": "Remove newer features from the Jigsaw screen",
"visual_settings.viafabricplus.hide_priority_selections_in_jigsaw_screen": "Hide priority selections in Jigsaw screen",
"visual_settings.viafabricplus.replace_petrified_oak_slab": "Replace petrified oak slab texture with the 'unknown' texture",
"visual_settings.viafabricplus.emulate_armor_hud": "Emulate Armor HUD",
"visual_settings.viafabricplus.remove_newer_features_from_command_block_screen": "Remove newer features from the Command Block screen",
@ -89,6 +89,7 @@
"visual_settings.viafabricplus.enable_legacy_tablist": "Enable legacy tablist",
"visual_settings.viafabricplus.hide_furnace_recipe_book": "Hide furnace recipe book",
"visual_settings.viafabricplus.hide_crafting_recipe_book": "Hide crafting recipe book",
"visual_settings.viafabricplus.hide_modern_jigsaw_screen_features": "Hide modern Jigsaw screen features",
"bedrock.viafabricplus.login": "Your browser should have opened.\nClosing this screen will cancel the process!",
"authentication.viafabricplus.failed_to_verify_session": "ViaFabricPlus couldn't verify your session! Please log in to an account or disable the BetaCraft authentication in the ViaFabricPlus Settings",