Skip to content

Commit

Permalink
Cleanup and fix
Browse files Browse the repository at this point in the history
  • Loading branch information
ThisTestUser committed Jan 2, 2024
1 parent fda28a8 commit ee3c219
Show file tree
Hide file tree
Showing 3 changed files with 74 additions and 72 deletions.
3 changes: 2 additions & 1 deletion src/main/java/net/wurstclient/hack/HackList.java
Original file line number Diff line number Diff line change
Expand Up @@ -138,7 +138,8 @@ public final class HackList implements UpdateListener
public final NoHurtcamHack noHurtcamHack = new NoHurtcamHack();
public final NoLevitationHack noLevitationHack = new NoLevitationHack();
public final NoOverlayHack noOverlayHack = new NoOverlayHack();
public final NoPortalOverlayHack noPortalOverlayHack = new NoPortalOverlayHack();
public final NoPortalOverlayHack noPortalOverlayHack =
new NoPortalOverlayHack();
public final NoPumpkinHack noPumpkinHack = new NoPumpkinHack();
public final NoShieldOverlayHack noShieldOverlayHack =
new NoShieldOverlayHack();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,6 @@ public NoPortalOverlayHack()
super("NoPortalOverlay");
setCategory(Category.RENDER);
}

// See IngameHudMixin.onRenderPortalOverlay()
}
141 changes: 71 additions & 70 deletions src/main/java/net/wurstclient/mixin/IngameHudMixin.java
Original file line number Diff line number Diff line change
@@ -1,70 +1,71 @@
/*
* Copyright (c) 2014-2024 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.spongepowered.asm.mixin.Final;
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 net.minecraft.client.gui.DrawContext;
import net.minecraft.client.gui.hud.DebugHud;
import net.minecraft.client.gui.hud.InGameHud;
import net.minecraft.util.Identifier;
import net.wurstclient.WurstClient;
import net.wurstclient.event.EventManager;
import net.wurstclient.events.GUIRenderListener.GUIRenderEvent;

@Mixin(InGameHud.class)
public class IngameHudMixin
{
@Shadow
@Final
private DebugHud debugHud;

@Inject(
at = @At(value = "INVOKE",
target = "Lcom/mojang/blaze3d/systems/RenderSystem;enableBlend()V",
remap = false,
ordinal = 3),
method = "render(Lnet/minecraft/client/gui/DrawContext;F)V")
private void onRender(DrawContext context, float tickDelta, CallbackInfo ci)
{
if(debugHud.shouldShowDebugHud())
return;

EventManager.fire(new GUIRenderEvent(context, tickDelta));
}

@Inject(at = @At("HEAD"),
method = "renderOverlay(Lnet/minecraft/client/gui/DrawContext;Lnet/minecraft/util/Identifier;F)V",
cancellable = true)
private void onRenderOverlay(DrawContext context, Identifier texture,
float opacity, CallbackInfo ci)
{
if(texture == null
|| !"textures/misc/pumpkinblur.png".equals(texture.getPath()))
return;

if(WurstClient.INSTANCE.getHax().noPumpkinHack.isEnabled())
ci.cancel();
}

@Inject(at = @At("HEAD"),
method = "renderPortalOverlay(Lnet/minecraft/client/util/math/MatrixStack;F)V",
cancellable = true)
private void onRenderPortalOverlay(MatrixStack matrixStack, float nauseaStrength, CallbackInfo ci)
{
if(!WurstClient.INSTANCE.getHax().noPortalOverlayHack.isEnabled())
return;

ci.cancel();
}
}
/*
* Copyright (c) 2014-2024 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.spongepowered.asm.mixin.Final;
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 net.minecraft.client.gui.DrawContext;
import net.minecraft.client.gui.hud.DebugHud;
import net.minecraft.client.gui.hud.InGameHud;
import net.minecraft.util.Identifier;
import net.wurstclient.WurstClient;
import net.wurstclient.event.EventManager;
import net.wurstclient.events.GUIRenderListener.GUIRenderEvent;

@Mixin(InGameHud.class)
public class IngameHudMixin
{
@Shadow
@Final
private DebugHud debugHud;

@Inject(
at = @At(value = "INVOKE",
target = "Lcom/mojang/blaze3d/systems/RenderSystem;enableBlend()V",
remap = false,
ordinal = 3),
method = "render(Lnet/minecraft/client/gui/DrawContext;F)V")
private void onRender(DrawContext context, float tickDelta, CallbackInfo ci)
{
if(debugHud.shouldShowDebugHud())
return;

EventManager.fire(new GUIRenderEvent(context, tickDelta));
}

@Inject(at = @At("HEAD"),
method = "renderOverlay(Lnet/minecraft/client/gui/DrawContext;Lnet/minecraft/util/Identifier;F)V",
cancellable = true)
private void onRenderOverlay(DrawContext context, Identifier texture,
float opacity, CallbackInfo ci)
{
if(texture == null
|| !"textures/misc/pumpkinblur.png".equals(texture.getPath()))
return;

if(WurstClient.INSTANCE.getHax().noPumpkinHack.isEnabled())
ci.cancel();
}

@Inject(at = @At("HEAD"),
method = "renderPortalOverlay(Lnet/minecraft/client/gui/DrawContext;F)V",
cancellable = true)
private void onRenderPortalOverlay(DrawContext context,
float nauseaStrength, CallbackInfo ci)
{
if(!WurstClient.INSTANCE.getHax().noPortalOverlayHack.isEnabled())
return;

ci.cancel();
}
}

0 comments on commit ee3c219

Please sign in to comment.