This repository has been archived by the owner on Sep 15, 2024. It is now read-only.
generated from FabricMC/fabric-example-mod
-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
2402456
commit 0b21bc5
Showing
2 changed files
with
63 additions
and
5 deletions.
There are no files selected for viewing
62 changes: 62 additions & 0 deletions
62
...in/java/dev/microcontrollers/overlaytweaks/mixin/screenopacity/RecipeBookWidgetMixin.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,62 @@ | ||
package dev.microcontrollers.overlaytweaks.mixin.screenopacity; | ||
|
||
import com.mojang.blaze3d.systems.RenderSystem; | ||
import dev.microcontrollers.overlaytweaks.config.OverlayTweaksConfig; | ||
import net.minecraft.client.gui.DrawContext; | ||
import net.minecraft.client.gui.screen.recipebook.RecipeBookWidget; | ||
import org.spongepowered.asm.mixin.Mixin; | ||
import org.spongepowered.asm.mixin.injection.At; | ||
import org.spongepowered.asm.mixin.injection.Inject; | ||
import org.spongepowered.asm.mixin.injection.callback.CallbackInfo; | ||
|
||
@Mixin(RecipeBookWidget.class) | ||
public class RecipeBookWidgetMixin { | ||
@Inject(method = "render", at = @At(value = "INVOKE", target = "Lnet/minecraft/client/gui/DrawContext;drawTexture(Lnet/minecraft/util/Identifier;IIIIII)V")) | ||
private void containerOpacityStart(DrawContext context, int mouseX, int mouseY, float delta, CallbackInfo ci) { | ||
RenderSystem.enableBlend(); | ||
RenderSystem.setShaderColor(1F, 1F, 1F, OverlayTweaksConfig.CONFIG.instance().containerTextureOpacity / 100F); | ||
} | ||
|
||
@Inject(method = "render", at = @At(value = "INVOKE", target = "Lnet/minecraft/client/gui/DrawContext;drawTexture(Lnet/minecraft/util/Identifier;IIIIII)V", shift = At.Shift.AFTER)) | ||
private void containerOpacityEnd(DrawContext context, int mouseX, int mouseY, float delta, CallbackInfo ci) { | ||
RenderSystem.disableBlend(); | ||
RenderSystem.setShaderColor(1F, 1F, 1F, 1F); | ||
} | ||
|
||
@Inject(method = "render", at = @At(value = "INVOKE", target = "Lnet/minecraft/client/gui/screen/recipebook/RecipeGroupButtonWidget;render(Lnet/minecraft/client/gui/DrawContext;IIF)V")) | ||
private void widgetOpacityStart(DrawContext context, int mouseX, int mouseY, float delta, CallbackInfo ci) { | ||
RenderSystem.enableBlend(); | ||
RenderSystem.setShaderColor(1F, 1F, 1F, OverlayTweaksConfig.CONFIG.instance().containerTextureOpacity / 100F); | ||
} | ||
|
||
@Inject(method = "render", at = @At(value = "INVOKE", target = "Lnet/minecraft/client/gui/screen/recipebook/RecipeGroupButtonWidget;render(Lnet/minecraft/client/gui/DrawContext;IIF)V", shift = At.Shift.AFTER)) | ||
private void widgetOpacityEnd(DrawContext context, int mouseX, int mouseY, float delta, CallbackInfo ci) { | ||
RenderSystem.disableBlend(); | ||
RenderSystem.setShaderColor(1F, 1F, 1F, 1F); | ||
} | ||
|
||
@Inject(method = "render", at = @At(value = "INVOKE", target = "Lnet/minecraft/client/gui/widget/ToggleButtonWidget;render(Lnet/minecraft/client/gui/DrawContext;IIF)V")) | ||
private void toggleButtonOpacityStart(DrawContext context, int mouseX, int mouseY, float delta, CallbackInfo ci) { | ||
RenderSystem.enableBlend(); | ||
RenderSystem.setShaderColor(1F, 1F, 1F, OverlayTweaksConfig.CONFIG.instance().containerTextureOpacity / 100F); | ||
} | ||
|
||
@Inject(method = "render", at = @At(value = "INVOKE", target = "Lnet/minecraft/client/gui/widget/ToggleButtonWidget;render(Lnet/minecraft/client/gui/DrawContext;IIF)V", shift = At.Shift.AFTER)) | ||
private void toggleButtonOpacityEnd(DrawContext context, int mouseX, int mouseY, float delta, CallbackInfo ci) { | ||
RenderSystem.disableBlend(); | ||
RenderSystem.setShaderColor(1F, 1F, 1F, 1F); | ||
} | ||
|
||
@Inject(method = "render", at = @At(value = "INVOKE", target = "Lnet/minecraft/client/gui/widget/TextFieldWidget;render(Lnet/minecraft/client/gui/DrawContext;IIF)V")) | ||
private void searchOpacityStart(DrawContext context, int mouseX, int mouseY, float delta, CallbackInfo ci) { | ||
RenderSystem.enableBlend(); | ||
RenderSystem.setShaderColor(1F, 1F, 1F, OverlayTweaksConfig.CONFIG.instance().containerTextureOpacity / 100F); | ||
} | ||
|
||
@Inject(method = "render", at = @At(value = "INVOKE", target = "Lnet/minecraft/client/gui/widget/TextFieldWidget;render(Lnet/minecraft/client/gui/DrawContext;IIF)V", shift = At.Shift.AFTER)) | ||
private void searchOpacityEnd(DrawContext context, int mouseX, int mouseY, float delta, CallbackInfo ci) { | ||
RenderSystem.disableBlend(); | ||
RenderSystem.setShaderColor(1F, 1F, 1F, 1F); | ||
} | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters