diff --git a/common/src/main/java/net/raphimc/immediatelyfast/feature/core/BatchableBufferSource.java b/common/src/main/java/net/raphimc/immediatelyfast/feature/core/BatchableBufferSource.java index 365dc826..f41c6403 100644 --- a/common/src/main/java/net/raphimc/immediatelyfast/feature/core/BatchableBufferSource.java +++ b/common/src/main/java/net/raphimc/immediatelyfast/feature/core/BatchableBufferSource.java @@ -211,6 +211,14 @@ protected int getLayerOrder(final RenderLayer layer) { } } else if (textureId.equals(TexturedRenderLayers.ARMOR_TRIMS_ATLAS_TEXTURE)) { return 1; + } else if (layer.name.startsWith("text")) { + // Draws vanilla text over custom font layers + // Fixes https://github.com/RaphiMC/ImmediatelyFast/issues/81, https://github.com/RaphiMC/ImmediatelyFast/issues/287, https://github.com/RaphiMC/ImmediatelyFast/issues/288 + if (textureId.getNamespace().equals("minecraft")) { + return 2; + } else { + return 1; + } } } } diff --git a/common/src/main/java/net/raphimc/immediatelyfast/injection/mixins/core/compat/MixinTextRenderer_Drawer.java b/common/src/main/java/net/raphimc/immediatelyfast/injection/mixins/core/compat/MixinTextRenderer_Drawer.java deleted file mode 100644 index 743a2656..00000000 --- a/common/src/main/java/net/raphimc/immediatelyfast/injection/mixins/core/compat/MixinTextRenderer_Drawer.java +++ /dev/null @@ -1,53 +0,0 @@ -/* - * This file is part of ImmediatelyFast - https://github.com/RaphiMC/ImmediatelyFast - * Copyright (C) 2023-2024 RK_01/RaphiMC and contributors - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 3 of the License, or (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program. If not, see . - */ -package net.raphimc.immediatelyfast.injection.mixins.core.compat; - -import com.llamalad7.mixinextras.sugar.Local; -import net.minecraft.client.font.Glyph; -import net.minecraft.client.font.TextRenderer; -import net.minecraft.text.Style; -import org.joml.Matrix4f; -import org.spongepowered.asm.mixin.Final; -import org.spongepowered.asm.mixin.Mixin; -import org.spongepowered.asm.mixin.Mutable; -import org.spongepowered.asm.mixin.Shadow; -import org.spongepowered.asm.mixin.injection.At; -import org.spongepowered.asm.mixin.injection.Inject; -import org.spongepowered.asm.mixin.injection.callback.CallbackInfoReturnable; - -@Mixin(TextRenderer.Drawer.class) -public abstract class MixinTextRenderer_Drawer { - - @Shadow - @Final - @Mutable - private Matrix4f matrix; - - /** - * Fixes https://github.com/RaphiMC/ImmediatelyFast/issues/81 - * Needed because the universal batching optimization combines glyphs on the same texture into a single draw call which causes overlapping to not be handled by draw order. - */ - @Inject(method = "accept", at = @At(value = "RETURN")) - private void fixNegativeAdvanceGlyphs(int i, Style style, int j, CallbackInfoReturnable cir, @Local Glyph glyph) { - final float advance = glyph.getAdvance(style.isBold()); - if (advance < 0) { - this.matrix = this.matrix.translate(0F, 0F, 0.001F, new Matrix4f()); - } - } - -} diff --git a/common/src/main/resources/immediatelyfast-common.mixins.json b/common/src/main/resources/immediatelyfast-common.mixins.json index dedc220a..28d63b49 100644 --- a/common/src/main/resources/immediatelyfast-common.mixins.json +++ b/common/src/main/resources/immediatelyfast-common.mixins.json @@ -13,7 +13,6 @@ "core.MixinWindow", "core.compat.MixinGameRenderer", "core.compat.MixinTextDisplayEntityRenderer", - "core.compat.MixinTextRenderer_Drawer", "disable_error_checking.MixinGL11", "fast_buffer_upload.MixinVertexBuffer", "fast_text_lookup.MixinTextRenderer_Drawer",