diff --git a/src/main/java/club/sk1er/patcher/config/PatcherConfig.java b/src/main/java/club/sk1er/patcher/config/PatcherConfig.java index da43fa97a..0903bcbd7 100644 --- a/src/main/java/club/sk1er/patcher/config/PatcherConfig.java +++ b/src/main/java/club/sk1er/patcher/config/PatcherConfig.java @@ -192,6 +192,14 @@ public class PatcherConfig extends Config { ) public static float fireOverlayOpacity = 1.0F; + @Slider( // todo add percentage + name = "Pumpkin Overlay Opacity", + description = "Change the opacity of the pumpkin overlay.", + category = "Miscellaneous", subcategory = "Overlays", + min = 0F, max = 1.0F + ) + public static float pumpkinOverlayOpacity = 1.0F; + @Switch( name = "Hide Fire Overlay with Fire Resistance", description = "Hide the fire overlay when you have fire resistance active.\n" + diff --git a/src/main/java/club/sk1er/patcher/mixins/features/GuiIngameMixin_PumpkinBlurRendering.java b/src/main/java/club/sk1er/patcher/mixins/features/GuiIngameMixin_PumpkinBlurRendering.java new file mode 100644 index 000000000..854aa6b6d --- /dev/null +++ b/src/main/java/club/sk1er/patcher/mixins/features/GuiIngameMixin_PumpkinBlurRendering.java @@ -0,0 +1,23 @@ +package club.sk1er.patcher.mixins.features; + +import club.sk1er.patcher.config.PatcherConfig; +import net.minecraft.client.gui.GuiIngame; +import net.minecraft.client.gui.ScaledResolution; +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.ModifyArg; +import org.spongepowered.asm.mixin.injection.callback.CallbackInfo; + +@Mixin(GuiIngame.class) +public class GuiIngameMixin_PumpkinBlurRendering { + @Inject(method = "renderPumpkinOverlay", at = @At("HEAD"), cancellable = true) + private void patcher$cancelPumpkinOverlay(ScaledResolution scaledRes, CallbackInfo ci) { + if (PatcherConfig.pumpkinOverlayOpacity == 0) ci.cancel(); // micro-optimization, let's skip all the math to render if it's not going to be visible anyways + } + + @ModifyArg(method = "renderPumpkinOverlay", at = @At(value = "INVOKE", target = "Lnet/minecraft/client/renderer/GlStateManager;color(FFFF)V"), index = 3) + private float patcher$modifyPumpkinOpacity(float alpha) { + return PatcherConfig.pumpkinOverlayOpacity; + } +} diff --git a/src/main/resources/mixins.patcher.json b/src/main/resources/mixins.patcher.json index 693f68928..c6a3710fc 100644 --- a/src/main/resources/mixins.patcher.json +++ b/src/main/resources/mixins.patcher.json @@ -138,6 +138,7 @@ "features.GuiIngameForgeMixin_CrosshairRendering", "features.GuiIngameForgeMixin_TitleRendering", "features.GuiIngameMixin_CrosshairVisibility", + "features.GuiIngameMixin_PumpkinBlurRendering", "features.GuiMultiplayerMixin_FastServerJoin", "features.GuiNewChatMixin_ChatDelay", "features.GuiNewChatMixin_CompactChat",