|
1 | 1 | package xaeroplus.mixin.client;
|
2 | 2 |
|
| 3 | +import com.llamalad7.mixinextras.injector.wrapoperation.Operation; |
| 4 | +import com.llamalad7.mixinextras.injector.wrapoperation.WrapOperation; |
3 | 5 | import com.mojang.blaze3d.pipeline.RenderTarget;
|
| 6 | +import com.mojang.blaze3d.platform.GlStateManager; |
| 7 | +import com.mojang.blaze3d.systems.RenderSystem; |
4 | 8 | import net.minecraft.client.gui.GuiGraphics;
|
5 | 9 | import net.minecraft.client.renderer.MultiBufferSource;
|
6 | 10 | import net.minecraft.world.entity.Entity;
|
@@ -216,4 +220,24 @@ public void redirectRenderMainEntityDot(final MinimapFBORenderer instance,
|
216 | 220 | public int modifyArrowOffsetY(final int offsetY) {
|
217 | 221 | return Settings.REGISTRY.fixMainEntityDot.get() ? -10 : offsetY;
|
218 | 222 | }
|
| 223 | + |
| 224 | + @WrapOperation(method = "renderMinimap", at = @At( |
| 225 | + value = "INVOKE", |
| 226 | + target = "Lcom/mojang/blaze3d/systems/RenderSystem;blendFuncSeparate(Lcom/mojang/blaze3d/platform/GlStateManager$SourceFactor;Lcom/mojang/blaze3d/platform/GlStateManager$DestFactor;Lcom/mojang/blaze3d/platform/GlStateManager$SourceFactor;Lcom/mojang/blaze3d/platform/GlStateManager$DestFactor;)V" |
| 227 | + ), remap = true) // $REMAP |
| 228 | + public void correctBlendingForFpsLimiter(final GlStateManager.SourceFactor sourceFactor, final GlStateManager.DestFactor destFactor, final GlStateManager.SourceFactor sourceFactor2, final GlStateManager.DestFactor destFactor2, final Operation<Void> original) { |
| 229 | + if (Settings.REGISTRY.minimapFpsLimiter.get()) { |
| 230 | + // todo: when minimap opacity is not set to 100 this is slightly different than without fps limiter |
| 231 | + // the minimap will appear more opaque and dim than it should be |
| 232 | + // when we are rendering to our buffering render target the blending isn't exactly the same as our BG opacity is 0 |
| 233 | + RenderSystem.blendFuncSeparate( |
| 234 | + GlStateManager.SourceFactor.SRC_ALPHA, |
| 235 | + GlStateManager.DestFactor.ONE_MINUS_SRC_ALPHA, |
| 236 | + GlStateManager.SourceFactor.SRC_COLOR, |
| 237 | + GlStateManager.DestFactor.ZERO |
| 238 | + ); |
| 239 | + } else { |
| 240 | + original.call(sourceFactor, destFactor, sourceFactor2, destFactor2); |
| 241 | + } |
| 242 | + } |
219 | 243 | }
|
0 commit comments