-
-
Notifications
You must be signed in to change notification settings - Fork 421
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
28c6538
commit 61ef0da
Showing
1 changed file
with
67 additions
and
67 deletions.
There are no files selected for viewing
134 changes: 67 additions & 67 deletions
134
src/main/java/net/wurstclient/mixin/BackgroundRendererMixin.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 |
---|---|---|
@@ -1,67 +1,67 @@ | ||
/* | ||
* Copyright (c) 2014-2023 Wurst-Imperium and contributors. | ||
* | ||
* This source code is subject to the terms of the GNU General Public | ||
* License, version 3. If a copy of the GPL was not distributed with this | ||
* file, You can obtain one at: https://www.gnu.org/licenses/gpl-3.0.txt | ||
*/ | ||
package net.wurstclient.mixin; | ||
|
||
import org.jetbrains.annotations.Nullable; | ||
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.callback.CallbackInfo; | ||
import org.spongepowered.asm.mixin.injection.callback.CallbackInfoReturnable; | ||
|
||
import com.mojang.blaze3d.systems.RenderSystem; | ||
|
||
import net.minecraft.client.render.BackgroundRenderer; | ||
import net.minecraft.client.render.BackgroundRenderer.StatusEffectFogModifier; | ||
import net.minecraft.client.render.Camera; | ||
import net.minecraft.client.render.CameraSubmersionType; | ||
import net.minecraft.entity.Entity; | ||
import net.wurstclient.WurstClient; | ||
|
||
@Mixin(BackgroundRenderer.class) | ||
public abstract class BackgroundRendererMixin | ||
{ | ||
@Shadow | ||
@Nullable | ||
protected static StatusEffectFogModifier getFogModifier(Entity entity, | ||
float tickDelta) | ||
{ | ||
return null; | ||
} | ||
|
||
@Inject(at = @At("HEAD"), method = "applyFog") | ||
private static void onApplyFog(Camera camera, | ||
BackgroundRenderer.FogType fogType, float viewDistance, | ||
boolean thickFog, float tickDelta, CallbackInfo ci) | ||
{ | ||
if(WurstClient.INSTANCE.getHax().noFogHack.isEnabled()) | ||
{ | ||
CameraSubmersionType cameraSubmersionType = | ||
camera.getSubmersionType(); | ||
|
||
Entity entity = camera.getFocusedEntity(); | ||
BackgroundRenderer.StatusEffectFogModifier statusEffectFogModifier = | ||
getFogModifier(entity, tickDelta); | ||
|
||
if(cameraSubmersionType == CameraSubmersionType.NONE | ||
&& statusEffectFogModifier == null) | ||
RenderSystem.setShaderFogColor(0, 0, 0, 0); | ||
} | ||
} | ||
|
||
@Inject(at = @At("HEAD"), | ||
method = "getFogModifier(Lnet/minecraft/entity/Entity;F)Lnet/minecraft/client/render/BackgroundRenderer$StatusEffectFogModifier;", | ||
cancellable = true) | ||
private static void onGetFogModifier(Entity entity, float tickDelta, | ||
CallbackInfoReturnable<StatusEffectFogModifier> ci) | ||
{ | ||
if(WurstClient.INSTANCE.getHax().antiBlindHack.isEnabled()) | ||
ci.setReturnValue(null); | ||
} | ||
} | ||
/* | ||
* Copyright (c) 2014-2023 Wurst-Imperium and contributors. | ||
* | ||
* This source code is subject to the terms of the GNU General Public | ||
* License, version 3. If a copy of the GPL was not distributed with this | ||
* file, You can obtain one at: https://www.gnu.org/licenses/gpl-3.0.txt | ||
*/ | ||
package net.wurstclient.mixin; | ||
|
||
import org.jetbrains.annotations.Nullable; | ||
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.callback.CallbackInfo; | ||
import org.spongepowered.asm.mixin.injection.callback.CallbackInfoReturnable; | ||
|
||
import com.mojang.blaze3d.systems.RenderSystem; | ||
|
||
import net.minecraft.client.render.BackgroundRenderer; | ||
import net.minecraft.client.render.BackgroundRenderer.StatusEffectFogModifier; | ||
import net.minecraft.client.render.Camera; | ||
import net.minecraft.client.render.CameraSubmersionType; | ||
import net.minecraft.entity.Entity; | ||
import net.wurstclient.WurstClient; | ||
|
||
@Mixin(BackgroundRenderer.class) | ||
public abstract class BackgroundRendererMixin | ||
{ | ||
@Shadow | ||
@Nullable | ||
protected static StatusEffectFogModifier getFogModifier(Entity entity, | ||
float tickDelta) | ||
{ | ||
return null; | ||
} | ||
|
||
@Inject(at = @At("HEAD"), method = "applyFog") | ||
private static void onApplyFog(Camera camera, | ||
BackgroundRenderer.FogType fogType, float viewDistance, | ||
boolean thickFog, float tickDelta, CallbackInfo ci) | ||
{ | ||
if(WurstClient.INSTANCE.getHax().noFogHack.isEnabled()) | ||
{ | ||
CameraSubmersionType cameraSubmersionType = | ||
camera.getSubmersionType(); | ||
|
||
Entity entity = camera.getFocusedEntity(); | ||
BackgroundRenderer.StatusEffectFogModifier statusEffectFogModifier = | ||
getFogModifier(entity, tickDelta); | ||
|
||
if(cameraSubmersionType == CameraSubmersionType.NONE | ||
&& statusEffectFogModifier == null) | ||
RenderSystem.setShaderFogColor(0, 0, 0, 0); | ||
} | ||
} | ||
|
||
@Inject(at = @At("HEAD"), | ||
method = "getFogModifier(Lnet/minecraft/entity/Entity;F)Lnet/minecraft/client/render/BackgroundRenderer$StatusEffectFogModifier;", | ||
cancellable = true) | ||
private static void onGetFogModifier(Entity entity, float tickDelta, | ||
CallbackInfoReturnable<StatusEffectFogModifier> ci) | ||
{ | ||
if(WurstClient.INSTANCE.getHax().antiBlindHack.isEnabled()) | ||
ci.setReturnValue(null); | ||
} | ||
} |