|
| 1 | +/* |
| 2 | + * Copyright 2025 Lambda |
| 3 | + * |
| 4 | + * This program is free software: you can redistribute it and/or modify |
| 5 | + * it under the terms of the GNU General Public License as published by |
| 6 | + * the Free Software Foundation, either version 3 of the License, or |
| 7 | + * (at your option) any later version. |
| 8 | + * |
| 9 | + * This program is distributed in the hope that it will be useful, |
| 10 | + * but WITHOUT ANY WARRANTY; without even the implied warranty of |
| 11 | + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
| 12 | + * GNU General Public License for more details. |
| 13 | + * |
| 14 | + * You should have received a copy of the GNU General Public License |
| 15 | + * along with this program. If not, see <http://www.gnu.org/licenses/>. |
| 16 | + */ |
| 17 | + |
| 18 | +package com.lambda.mixin.render; |
| 19 | + |
| 20 | +import com.lambda.module.modules.render.NoRender; |
| 21 | +import com.mojang.blaze3d.buffers.GpuBuffer; |
| 22 | +import com.mojang.blaze3d.buffers.GpuBufferSlice; |
| 23 | +import net.minecraft.client.render.fog.FogRenderer; |
| 24 | +import org.spongepowered.asm.mixin.Final; |
| 25 | +import org.spongepowered.asm.mixin.Mixin; |
| 26 | +import org.spongepowered.asm.mixin.Shadow; |
| 27 | +import org.spongepowered.asm.mixin.injection.At; |
| 28 | +import org.spongepowered.asm.mixin.injection.Inject; |
| 29 | +import org.spongepowered.asm.mixin.injection.callback.CallbackInfoReturnable; |
| 30 | + |
| 31 | +import static net.minecraft.client.render.fog.FogRenderer.FOG_UBO_SIZE; |
| 32 | + |
| 33 | +@Mixin(FogRenderer.class) |
| 34 | +public class FogRendererMixin { |
| 35 | + @Final |
| 36 | + @Shadow |
| 37 | + private GpuBuffer emptyBuffer; |
| 38 | + |
| 39 | + @Inject(method = "getFogBuffer", at = @At("HEAD"), cancellable = true) |
| 40 | + private void modify(FogRenderer.FogType fogType, CallbackInfoReturnable<GpuBufferSlice> cir) { |
| 41 | + if (fogType == FogRenderer.FogType.WORLD && NoRender.INSTANCE.isEnabled() && NoRender.getNoTerrainFog()) |
| 42 | + cir.setReturnValue(emptyBuffer.slice(0L, FOG_UBO_SIZE)); |
| 43 | + } |
| 44 | +} |
0 commit comments