Skip to content

Commit

Permalink
Merge #904 (NoFog hack)
Browse files Browse the repository at this point in the history
  • Loading branch information
Alexander01998 authored Dec 22, 2023
2 parents ef9e42f + 6cfd831 commit a764953
Show file tree
Hide file tree
Showing 5 changed files with 57 additions and 1 deletion.
1 change: 1 addition & 0 deletions src/main/java/net/wurstclient/hack/HackList.java
Original file line number Diff line number Diff line change
Expand Up @@ -134,6 +134,7 @@ public final class HackList implements UpdateListener
public final NoClipHack noClipHack = new NoClipHack();
public final NoFallHack noFallHack = new NoFallHack();
public final NoFireOverlayHack noFireOverlayHack = new NoFireOverlayHack();
public final NoFogHack noFogHack = new NoFogHack();
public final NoHurtcamHack noHurtcamHack = new NoHurtcamHack();
public final NoLevitationHack noLevitationHack = new NoLevitationHack();
public final NoOverlayHack noOverlayHack = new NoOverlayHack();
Expand Down
24 changes: 24 additions & 0 deletions src/main/java/net/wurstclient/hacks/NoFogHack.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
/*
* 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.hacks;

import net.wurstclient.Category;
import net.wurstclient.SearchTags;
import net.wurstclient.hack.Hack;

@SearchTags({"no fog", "AntiFog", "anti fog"})
public final class NoFogHack extends Hack
{
public NoFogHack()
{
super("NoFog");
setCategory(Category.RENDER);
}

// See BackgroundRendererMixin
}
31 changes: 30 additions & 1 deletion src/main/java/net/wurstclient/mixin/BackgroundRendererMixin.java
Original file line number Diff line number Diff line change
Expand Up @@ -10,16 +10,45 @@
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;
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 class BackgroundRendererMixin
public abstract class BackgroundRendererMixin
{
/**
* Makes the distance fog 100% transparent when NoFog is enabled,
* effectively removing it.
*/
@Inject(at = @At("HEAD"),
method = "applyFog(Lnet/minecraft/client/render/Camera;Lnet/minecraft/client/render/BackgroundRenderer$FogType;FZF)V")
private static void onApplyFog(Camera camera,
BackgroundRenderer.FogType fogType, float viewDistance,
boolean thickFog, float tickDelta, CallbackInfo ci)
{
if(!WurstClient.INSTANCE.getHax().noFogHack.isEnabled())
return;

CameraSubmersionType cameraSubmersionType = camera.getSubmersionType();
if(cameraSubmersionType != CameraSubmersionType.NONE)
return;

Entity entity = camera.getFocusedEntity();
if(BackgroundRenderer.getFogModifier(entity, tickDelta) != null)
return;

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)
Expand Down
1 change: 1 addition & 0 deletions src/main/resources/assets/wurst/lang/en_us.json
Original file line number Diff line number Diff line change
Expand Up @@ -115,6 +115,7 @@
"description.wurst.hack.nocomcrash": "Lags and crashes servers using the Nocom exploit.\nDoes not work on Paper servers. Tested working on Vanilla, Spigot, and Fabric. Can be disabled by some AntiCheats.",
"description.wurst.hack.nofall": "Protects you from fall damage.",
"description.wurst.hack.nofireoverlay": "Blocks the overlay when you are on fire.\n\n§c§lWARNING:§r This can cause you to burn to death without noticing.",
"description.wurst.hack.nofog": "Removes distance fog from the world.",
"description.wurst.hack.nohurtcam": "Disables the shaking effect when you get hurt.",
"description.wurst.hack.nolevitation": "Disables the levitation effect when you get hit by a Shulker.\n\n§c§lWARNING:§r You will fall if you activate this while the levitation effect is already active!",
"description.wurst.hack.nooverlay": "Blocks the overlays of water and lava.",
Expand Down
1 change: 1 addition & 0 deletions src/main/resources/wurst.accesswidener
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
accessWidener v1 named
accessible class net/minecraft/client/render/BackgroundRenderer$StatusEffectFogModifier
accessible method net/minecraft/client/MinecraftClient doItemUse ()V
accessible method net/minecraft/client/render/BackgroundRenderer getFogModifier (Lnet/minecraft/entity/Entity;F)Lnet/minecraft/client/render/BackgroundRenderer$StatusEffectFogModifier;
accessible method net/minecraft/client/render/GameRenderer loadPostProcessor (Lnet/minecraft/util/Identifier;)V
accessible method net/minecraft/entity/projectile/FishingBobberEntity isOpenOrWaterAround (Lnet/minecraft/util/math/BlockPos;)Z
accessible field net/minecraft/client/MinecraftClient itemUseCooldown I
Expand Down

0 comments on commit a764953

Please sign in to comment.