Skip to content

Commit

Permalink
Update to 25w02a
Browse files Browse the repository at this point in the history
  • Loading branch information
Alexander01998 committed Jan 9, 2025
1 parent 9f7108b commit 1b4b11a
Show file tree
Hide file tree
Showing 14 changed files with 42 additions and 41 deletions.
4 changes: 2 additions & 2 deletions src/main/java/net/wurstclient/hacks/AutoArmorHack.java
Original file line number Diff line number Diff line change
Expand Up @@ -103,8 +103,8 @@ public void onUpdate()
ClientPlayerEntity player = MC.player;
PlayerInventory inventory = player.getInventory();

if(!swapWhileMoving.isChecked() && (player.input.movementForward != 0
|| player.input.movementSideways != 0))
if(!swapWhileMoving.isChecked()
&& player.input.getMovementInput().length() > 1e-5F)
return;

// store slots and values of best armor pieces
Expand Down
2 changes: 1 addition & 1 deletion src/main/java/net/wurstclient/hacks/AutoSprintHack.java
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ public void onUpdate()
if(player.horizontalCollision || player.isSneaking())
return;

if(player.isInsideWaterOrBubbleColumn() || player.isSubmergedInWater())
if(player.isTouchingWater() || player.isSubmergedInWater())
return;

if(!allDirections.isChecked() && player.forwardSpeed <= 0)
Expand Down
8 changes: 3 additions & 5 deletions src/main/java/net/wurstclient/hacks/AutoSwordHack.java
Original file line number Diff line number Diff line change
Expand Up @@ -7,15 +7,13 @@
*/
package net.wurstclient.hacks;

import net.minecraft.component.DataComponentTypes;
import net.minecraft.entity.Entity;
import net.minecraft.entity.LivingEntity;
import net.minecraft.entity.attribute.EntityAttributes;
import net.minecraft.item.Item;
import net.minecraft.item.ItemStack;
import net.minecraft.item.MaceItem;
import net.minecraft.item.MiningToolItem;
import net.minecraft.item.SwordItem;
import net.minecraft.item.TridentItem;
import net.minecraft.util.hit.EntityHitResult;
import net.minecraft.util.hit.HitResult;
import net.wurstclient.Category;
Expand Down Expand Up @@ -146,8 +144,8 @@ public void setSlot(Entity entity)
private float getValue(ItemStack stack, Entity entity)
{
Item item = stack.getItem();
if(!(item instanceof SwordItem || item instanceof MiningToolItem
|| item instanceof TridentItem || item instanceof MaceItem))
if(stack.get(DataComponentTypes.TOOL) == null
&& stack.get(DataComponentTypes.WEAPON) == null)
return Integer.MIN_VALUE;

switch(priority.getSelected())
Expand Down
4 changes: 2 additions & 2 deletions src/main/java/net/wurstclient/hacks/AutoToolHack.java
Original file line number Diff line number Diff line change
Expand Up @@ -18,11 +18,11 @@
import net.minecraft.enchantment.Enchantments;
import net.minecraft.entity.player.PlayerInventory;
import net.minecraft.item.ItemStack;
import net.minecraft.item.SwordItem;
import net.minecraft.registry.DynamicRegistryManager;
import net.minecraft.registry.Registry;
import net.minecraft.registry.RegistryKeys;
import net.minecraft.registry.entry.RegistryEntry.Reference;
import net.minecraft.registry.tag.ItemTags;
import net.minecraft.util.hit.HitResult;
import net.minecraft.util.math.BlockPos;
import net.wurstclient.Category;
Expand Down Expand Up @@ -175,7 +175,7 @@ private int getBestSlot(BlockState state, boolean useSwords, int repairMode)
if(speed <= bestSpeed)
continue;

if(!useSwords && stack.getItem() instanceof SwordItem)
if(!useSwords && stack.isIn(ItemTags.SWORDS))
continue;

if(isTooDamaged(stack, repairMode))
Expand Down
3 changes: 1 addition & 2 deletions src/main/java/net/wurstclient/hacks/FastLadderHack.java
Original file line number Diff line number Diff line change
Expand Up @@ -43,8 +43,7 @@ public void onUpdate()
if(!player.isClimbing() || !player.horizontalCollision)
return;

if(player.input.movementForward == 0
&& player.input.movementSideways == 0)
if(player.input.getMovementInput().length() <= 1e-5F)
return;

Vec3d velocity = player.getVelocity();
Expand Down
3 changes: 1 addition & 2 deletions src/main/java/net/wurstclient/hacks/StepHack.java
Original file line number Diff line number Diff line change
Expand Up @@ -64,8 +64,7 @@ public void onUpdate()
|| player.isTouchingWater() || player.isInLava())
return;

if(player.input.movementForward == 0
&& player.input.movementSideways == 0)
if(player.input.getMovementInput().length() <= 1e-5F)
return;

if(player.jumping)
Expand Down
4 changes: 2 additions & 2 deletions src/main/java/net/wurstclient/hacks/TemplateToolHack.java
Original file line number Diff line number Diff line change
Expand Up @@ -486,8 +486,8 @@ public void saveFile()

// show success message
MutableText message = Text.literal("Saved template as ");
ClickEvent event = new ClickEvent(ClickEvent.Action.OPEN_FILE,
file.getParentFile().getAbsolutePath());
ClickEvent event =
new ClickEvent.OpenFile(file.getParentFile().getAbsolutePath());
MutableText link = Text.literal(file.getName())
.styled(s -> s.withUnderline(true).withClickEvent(event));
message.append(link);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,21 +12,27 @@
import org.spongepowered.asm.mixin.injection.Inject;
import org.spongepowered.asm.mixin.injection.callback.CallbackInfoReturnable;

import net.minecraft.client.render.LightmapTextureManager;
import net.minecraft.entity.LivingEntity;
import net.minecraft.entity.effect.StatusEffect;
import net.minecraft.entity.effect.StatusEffects;
import net.minecraft.registry.entry.RegistryEntry;
import net.wurstclient.WurstClient;

@Mixin(LightmapTextureManager.class)
public class LightmapTextureManagerMixin
@Mixin(LivingEntity.class)
public class LivingEntityMixin
{
/**
* Stops the other darkness effect in caves when AntiBlind is enabled.
*/
@Inject(at = @At("HEAD"),
method = "getDarknessFactor(F)F",
method = "method_66279(Lnet/minecraft/registry/entry/RegistryEntry;F)F",
cancellable = true)
private void onGetDarknessFactor(float delta,
CallbackInfoReturnable<Float> cir)
private void onGetDarknessFactor(RegistryEntry<StatusEffect> registryEntry,
float delta, CallbackInfoReturnable<Float> cir)
{
if(registryEntry != StatusEffects.DARKNESS)
return;

if(WurstClient.INSTANCE.getHax().antiBlindHack.isEnabled())
cir.setReturnValue(0F);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,10 +8,9 @@
package net.wurstclient.mixin;

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.CallbackInfoReturnable;
import org.spongepowered.asm.mixin.injection.callback.CallbackInfo;

import net.minecraft.entity.effect.StatusEffectInstance;
import net.wurstclient.WurstClient;
Expand All @@ -20,13 +19,10 @@
public abstract class StatusEffectInstanceMixin
implements Comparable<StatusEffectInstance>
{
@Shadow
private int duration;

@Inject(at = @At("HEAD"), method = "updateDuration()I", cancellable = true)
private void onUpdateDuration(CallbackInfoReturnable<Integer> cir)
@Inject(at = @At("HEAD"), method = "updateDuration()V", cancellable = true)
private void onUpdateDuration(CallbackInfo ci)
{
if(WurstClient.INSTANCE.getHax().potionSaverHack.isFrozen())
cir.setReturnValue(duration);
ci.cancel();
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,8 @@
*/
package net.wurstclient.other_features;

import java.net.URI;

import net.fabricmc.fabric.api.client.networking.v1.ClientLoginConnectionEvents;
import net.minecraft.client.MinecraftClient;
import net.minecraft.client.gui.hud.MessageIndicator;
Expand Down Expand Up @@ -92,9 +94,9 @@ public void onReceivedMessage(ChatInputEvent event)

event.cancel();

ClickEvent clickEvent = new ClickEvent(ClickEvent.Action.OPEN_URL,
"https://wurst.wiki/ncr");
HoverEvent hoverEvent = new HoverEvent(HoverEvent.Action.SHOW_TEXT,
ClickEvent clickEvent =
new ClickEvent.OpenUrl(URI.create("https://wurst.wiki/ncr"));
HoverEvent hoverEvent = new HoverEvent.ShowText(
Text.literal("Original message: ").append(originalText));

ChatUtils.component(Text.literal(
Expand Down
3 changes: 2 additions & 1 deletion src/main/java/net/wurstclient/update/WurstUpdater.java
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
*/
package net.wurstclient.update;

import java.net.URI;
import java.net.URLEncoder;
import java.nio.charset.StandardCharsets;

Expand Down Expand Up @@ -118,7 +119,7 @@ public void checkForUpdates()

private void showLink(String text, String url)
{
ClickEvent event = new ClickEvent(ClickEvent.Action.OPEN_URL, url);
ClickEvent event = new ClickEvent.OpenUrl(URI.create(url));
component = Text.literal(text).styled(s -> s.withClickEvent(event));
}

Expand Down
6 changes: 3 additions & 3 deletions src/main/java/net/wurstclient/util/InteractionSimulator.java
Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,8 @@
* without sacrificing anti-cheat resistance or customizability.
*
* <p>
* Accurately replicates {@link MinecraftClient#doItemUse()} as of 24w33a
* (1.21.2), while being much easier to read and adding convenient ways to
* Accurately replicates {@link MinecraftClient#doItemUse()} as of 25w02a
* (1.21.5), while being much easier to read and adding convenient ways to
* change parts of the behavior.
*/
public enum InteractionSimulator
Expand Down Expand Up @@ -127,7 +127,7 @@ private static boolean interactBlockAndSwing(BlockHitResult hitResult,
swing.swing(hand);

if(!stack.isEmpty() && (stack.getCount() != oldCount
|| MC.interactionManager.hasCreativeInventory()))
|| MC.player.isInCreativeMode()))
MC.gameRenderer.firstPersonRenderer.resetEquipProgress(hand);
}

Expand Down
6 changes: 3 additions & 3 deletions src/main/resources/fabric.mod.json
Original file line number Diff line number Diff line change
Expand Up @@ -26,9 +26,9 @@
],
"accessWidener": "wurst.accesswidener",
"depends": {
"fabricloader": ">=0.16.9",
"fabric-api": ">=0.110.5",
"minecraft": "~1.21.4-rc.3",
"fabricloader": ">=0.16.10",
"fabric-api": ">=0.114.1",
"minecraft": "~1.21.5-alpha.25.2.a",
"java": ">=21"
},
"suggests": {
Expand Down
2 changes: 1 addition & 1 deletion src/main/resources/wurst.mixins.json
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@
"KeyBindingMixin",
"KeyboardMixin",
"LanguageManagerMixin",
"LightmapTextureManagerMixin",
"LivingEntityMixin",
"LivingEntityRendererMixin",
"MinecraftClientMixin",
"MobEntityRendererMixin",
Expand Down

0 comments on commit 1b4b11a

Please sign in to comment.