mirror of
https://github.com/ViaVersion/ViaFabricPlus.git
synced 2024-11-15 10:45:35 +01:00
Hide recipe books from various screens in pre 1.13 versions
This commit is contained in:
parent
6082ed6041
commit
8e639e1ebe
@ -21,8 +21,15 @@ package de.florianmichael.viafabricplus.injection.mixin.fixes.minecraft.screen;
|
||||
|
||||
import com.viaversion.viaversion.api.protocol.version.ProtocolVersion;
|
||||
import de.florianmichael.viafabricplus.protocoltranslator.ProtocolTranslator;
|
||||
import de.florianmichael.viafabricplus.settings.impl.VisualSettings;
|
||||
import net.minecraft.client.MinecraftClient;
|
||||
import net.minecraft.client.gui.Drawable;
|
||||
import net.minecraft.client.gui.Element;
|
||||
import net.minecraft.client.gui.Selectable;
|
||||
import net.minecraft.client.gui.screen.Screen;
|
||||
import net.minecraft.client.gui.screen.ingame.FurnaceScreen;
|
||||
import net.minecraft.client.gui.screen.recipebook.RecipeBookWidget;
|
||||
import net.minecraft.client.gui.widget.TexturedButtonWidget;
|
||||
import net.minecraft.text.Style;
|
||||
import net.minecraft.util.StringHelper;
|
||||
import org.jetbrains.annotations.Nullable;
|
||||
@ -47,4 +54,17 @@ 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) {
|
||||
if (drawableElement instanceof TexturedButtonWidget button && button.textures == RecipeBookWidget.BUTTON_TEXTURES) {
|
||||
final boolean furnace = ((Screen) (Object) this) instanceof FurnaceScreen;
|
||||
|
||||
if (VisualSettings.global().hideFurnaceRecipeBook.isEnabled() && furnace) {
|
||||
cir.setReturnValue(drawableElement);
|
||||
} else if (VisualSettings.global().hideCraftingRecipeBook.isEnabled() && !furnace) {
|
||||
cir.setReturnValue(drawableElement);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -46,7 +46,6 @@ public class SettingsScreen extends VFPScreen {
|
||||
|
||||
@Override
|
||||
public void render(DrawContext context, int mouseX, int mouseY, float delta) {
|
||||
this.renderBackground(context, mouseX, mouseY, delta);
|
||||
super.render(context, mouseX, mouseY, delta);
|
||||
|
||||
this.renderTitle(context);
|
||||
|
@ -42,9 +42,11 @@ public class VisualSettings extends SettingGroup {
|
||||
// 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));
|
||||
public final VersionedBooleanSetting hideFurnaceRecipeBook = new VersionedBooleanSetting(this, Text.translatable("visual_settings.viafabricplus.hide_furnace_recipe_book"), VersionRange.andOlder(ProtocolVersion.v1_12_2));
|
||||
|
||||
// 1.12 -> 1.11.1
|
||||
public final VersionedBooleanSetting sidewaysBackwardsRunning = new VersionedBooleanSetting(this, Text.translatable("visual_settings.viafabricplus.sideways_backwards_walking"), VersionRange.andOlder(ProtocolVersion.v1_11_1));
|
||||
public final VersionedBooleanSetting hideCraftingRecipeBook = new VersionedBooleanSetting(this, Text.translatable("visual_settings.viafabricplus.hide_crafting_recipe_book"), VersionRange.andOlder(ProtocolVersion.v1_11_1));
|
||||
|
||||
// 1.9 -> 1.8.x
|
||||
public final VersionedBooleanSetting emulateArmorHud = new VersionedBooleanSetting(this, Text.translatable("visual_settings.viafabricplus.emulate_armor_hud"), VersionRange.andOlder(ProtocolVersion.v1_8));
|
||||
|
@ -87,6 +87,8 @@
|
||||
"visual_settings.viafabricplus.disable_server_pinging": "Disable server pinging",
|
||||
"visual_settings.viafabricplus.sideways_backwards_walking": "Sideways backwards walking",
|
||||
"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",
|
||||
|
||||
"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",
|
||||
|
@ -16,6 +16,7 @@ accessible field net/minecraft/client/font/FontStorage glyphCache Lnet/minecraft
|
||||
accessible field net/minecraft/entity/EntityType dimensions Lnet/minecraft/entity/EntityDimensions;
|
||||
accessible field net/minecraft/block/AbstractBlock velocityMultiplier F
|
||||
accessible field net/minecraft/client/gui/screen/world/WorldIcon UNKNOWN_SERVER_ID Lnet/minecraft/util/Identifier;
|
||||
accessible field net/minecraft/client/gui/widget/TexturedButtonWidget textures Lnet/minecraft/client/gui/screen/ButtonTextures;
|
||||
|
||||
accessible method net/minecraft/screen/GenericContainerScreenHandler <init> (Lnet/minecraft/screen/ScreenHandlerType;ILnet/minecraft/entity/player/PlayerInventory;I)V
|
||||
accessible method net/minecraft/client/font/FontStorage$GlyphPair <init> (Lnet/minecraft/client/font/Glyph;Lnet/minecraft/client/font/Glyph;)V
|
||||
|
Loading…
Reference in New Issue
Block a user