diff --git a/common/src/main/java/net/raphimc/immediatelyfast/injection/mixins/screen_batching/MixinHandledScreen.java b/common/src/main/java/net/raphimc/immediatelyfast/injection/mixins/screen_batching/MixinHandledScreen.java index e7bbf992..d1ad450a 100644 --- a/common/src/main/java/net/raphimc/immediatelyfast/injection/mixins/screen_batching/MixinHandledScreen.java +++ b/common/src/main/java/net/raphimc/immediatelyfast/injection/mixins/screen_batching/MixinHandledScreen.java @@ -18,34 +18,20 @@ package net.raphimc.immediatelyfast.injection.mixins.screen_batching; import net.minecraft.client.gui.screen.ingame.HandledScreen; -import net.minecraft.client.util.math.MatrixStack; import net.raphimc.immediatelyfast.feature.batching.BatchingBuffers; import org.spongepowered.asm.mixin.Mixin; -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.Redirect; import org.spongepowered.asm.mixin.injection.callback.CallbackInfo; @Mixin(value = HandledScreen.class, priority = 500) public abstract class MixinHandledScreen { - @Shadow - public static void drawSlotHighlight(MatrixStack matrices, int x, int y, int z) { - } - @Inject(method = "render", at = @At(value = "FIELD", target = "Lnet/minecraft/client/gui/screen/ingame/HandledScreen;focusedSlot:Lnet/minecraft/screen/slot/Slot;", ordinal = 0)) private void beginBatching(CallbackInfo ci) { BatchingBuffers.beginHudBatching(); } - @Redirect(method = "render", at = @At(value = "INVOKE", target = "Lnet/minecraft/client/gui/screen/ingame/HandledScreen;drawSlotHighlight(Lnet/minecraft/client/util/math/MatrixStack;III)V")) - private void drawSlotHightlightOnTop(MatrixStack matrices, int x, int y, int z) { - BatchingBuffers.beginItemOverlayRendering(); - drawSlotHighlight(matrices, x, y, z); - BatchingBuffers.endItemOverlayRendering(); - } - @Inject(method = "render", at = @At(value = "INVOKE", target = "Lnet/minecraft/client/gui/screen/ingame/HandledScreen;drawForeground(Lnet/minecraft/client/util/math/MatrixStack;II)V", shift = At.Shift.BEFORE)) private void endBatching(CallbackInfo ci) { BatchingBuffers.endHudBatching(); diff --git a/fabric/src/main/java/net/raphimc/immediatelyfast/fabric/injection/mixins/screen_batching/MixinHandledScreen.java b/fabric/src/main/java/net/raphimc/immediatelyfast/fabric/injection/mixins/screen_batching/MixinHandledScreen.java new file mode 100644 index 00000000..696e8d03 --- /dev/null +++ b/fabric/src/main/java/net/raphimc/immediatelyfast/fabric/injection/mixins/screen_batching/MixinHandledScreen.java @@ -0,0 +1,42 @@ +/* + * This file is part of ImmediatelyFast - https://github.com/RaphiMC/ImmediatelyFast + * Copyright (C) 2023 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.fabric.injection.mixins.screen_batching; + +import net.minecraft.client.gui.screen.ingame.HandledScreen; +import net.minecraft.client.util.math.MatrixStack; +import net.raphimc.immediatelyfast.feature.batching.BatchingBuffers; +import org.spongepowered.asm.mixin.Mixin; +import org.spongepowered.asm.mixin.Shadow; +import org.spongepowered.asm.mixin.injection.At; +import org.spongepowered.asm.mixin.injection.Redirect; + +@Mixin(value = HandledScreen.class, priority = 500) +public abstract class MixinHandledScreen { + + @Shadow + public static void drawSlotHighlight(MatrixStack matrices, int x, int y, int z) { + } + + @Redirect(method = "render", at = @At(value = "INVOKE", target = "Lnet/minecraft/client/gui/screen/ingame/HandledScreen;drawSlotHighlight(Lnet/minecraft/client/util/math/MatrixStack;III)V")) + private void drawSlotHightlightOnTop(MatrixStack matrices, int x, int y, int z) { + BatchingBuffers.beginItemOverlayRendering(); + drawSlotHighlight(matrices, x, y, z); + BatchingBuffers.endItemOverlayRendering(); + } + +} diff --git a/fabric/src/main/resources/immediatelyfast-fabric.mixins.json b/fabric/src/main/resources/immediatelyfast-fabric.mixins.json index c246d0c4..f06039b1 100644 --- a/fabric/src/main/resources/immediatelyfast-fabric.mixins.json +++ b/fabric/src/main/resources/immediatelyfast-fabric.mixins.json @@ -7,7 +7,8 @@ "client": [ "core.MixinRenderLayer", "hud_batching.MixinInGameHud", - "hud_batching.compat.appleskin.MixinAppleSkin_HUDOverlayHandler" + "hud_batching.compat.appleskin.MixinAppleSkin_HUDOverlayHandler", + "screen_batching.MixinHandledScreen" ], "injectors": { "defaultRequire": 1 diff --git a/forge/src/main/java/net/raphimc/immediatelyfast/forge/injection/mixins/screen_batching/MixinHandledScreen.java b/forge/src/main/java/net/raphimc/immediatelyfast/forge/injection/mixins/screen_batching/MixinHandledScreen.java new file mode 100644 index 00000000..68f972b0 --- /dev/null +++ b/forge/src/main/java/net/raphimc/immediatelyfast/forge/injection/mixins/screen_batching/MixinHandledScreen.java @@ -0,0 +1,42 @@ +/* + * This file is part of ImmediatelyFast - https://github.com/RaphiMC/ImmediatelyFast + * Copyright (C) 2023 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.forge.injection.mixins.screen_batching; + +import net.minecraft.client.gui.screen.ingame.HandledScreen; +import net.minecraft.client.util.math.MatrixStack; +import net.raphimc.immediatelyfast.feature.batching.BatchingBuffers; +import org.spongepowered.asm.mixin.Mixin; +import org.spongepowered.asm.mixin.Shadow; +import org.spongepowered.asm.mixin.injection.At; +import org.spongepowered.asm.mixin.injection.Redirect; + +@Mixin(value = HandledScreen.class, priority = 500) +public abstract class MixinHandledScreen { + + @Shadow + public static void renderSlotHighlight(MatrixStack matrices, int x, int y, int z, int slotColor) { + } + + @Redirect(method = "render", at = @At(value = "INVOKE", target = "Lnet/minecraft/client/gui/screen/ingame/HandledScreen;renderSlotHighlight(Lnet/minecraft/client/util/math/MatrixStack;IIII)V")) + private void drawSlotHightlightOnTop(MatrixStack matrices, int x, int y, int z, int slotColor) { + BatchingBuffers.beginItemOverlayRendering(); + renderSlotHighlight(matrices, x, y, z, slotColor); + BatchingBuffers.endItemOverlayRendering(); + } + +} diff --git a/forge/src/main/resources/immediatelyfast-forge.mixins.json b/forge/src/main/resources/immediatelyfast-forge.mixins.json index 91927166..624707cd 100644 --- a/forge/src/main/resources/immediatelyfast-forge.mixins.json +++ b/forge/src/main/resources/immediatelyfast-forge.mixins.json @@ -7,7 +7,8 @@ "client": [ "core.MixinForgeRenderTypes", "hud_batching.MixinForgeGui", - "hud_batching.compat.appleskin.MixinAppleSkin_HUDOverlayHandler" + "hud_batching.compat.appleskin.MixinAppleSkin_HUDOverlayHandler", + "screen_batching.MixinHandledScreen" ], "injectors": { "defaultRequire": 1