Skip to content

Commit

Permalink
Update to 24w03b
Browse files Browse the repository at this point in the history
  • Loading branch information
Alexander01998 committed Jan 24, 2024
1 parent af01d9d commit 2e66a9c
Show file tree
Hide file tree
Showing 11 changed files with 50 additions and 107 deletions.
2 changes: 1 addition & 1 deletion build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ buildscript {
}

plugins {
id 'fabric-loom' version '1.4-SNAPSHOT'
id 'fabric-loom' version '1.5-SNAPSHOT'
id 'maven-publish'
id 'com.diffplug.spotless' version '6.23.3'
}
Expand Down

This file was deleted.

5 changes: 2 additions & 3 deletions src/main/java/net/wurstclient/hacks/AutoSwordHack.java
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@

import net.minecraft.enchantment.EnchantmentHelper;
import net.minecraft.entity.Entity;
import net.minecraft.entity.EntityGroup;
import net.minecraft.entity.EntityType;
import net.minecraft.entity.LivingEntity;
import net.minecraft.item.Item;
import net.minecraft.item.ItemStack;
Expand Down Expand Up @@ -156,8 +156,7 @@ private float getValue(ItemStack stack, Entity entity)
return ItemUtils.getAttackSpeed(item);

case DAMAGE:
EntityGroup group = entity instanceof LivingEntity le
? le.getGroup() : EntityGroup.DEFAULT;
EntityType<?> group = entity.getType();
float dmg = EnchantmentHelper.getAttackDamage(stack, group);
if(item instanceof SwordItem sword)
dmg += sword.getAttackDamage();
Expand Down
23 changes: 2 additions & 21 deletions src/main/java/net/wurstclient/hacks/LiquidsHack.java
Original file line number Diff line number Diff line change
Expand Up @@ -8,34 +8,15 @@
package net.wurstclient.hacks;

import net.wurstclient.Category;
import net.wurstclient.events.HitResultRayTraceListener;
import net.wurstclient.hack.Hack;

public final class LiquidsHack extends Hack implements HitResultRayTraceListener
public final class LiquidsHack extends Hack
{
public LiquidsHack()
{
super("Liquids");
setCategory(Category.BLOCKS);
}

@Override
protected void onEnable()
{
EVENTS.add(HitResultRayTraceListener.class, this);
}

@Override
protected void onDisable()
{
EVENTS.remove(HitResultRayTraceListener.class, this);
}

@Override
public void onHitResultRayTrace(float partialTicks)
{
double reach = MC.player.getBlockInteractionRange();
MC.crosshairTarget =
MC.getCameraEntity().raycast(reach, partialTicks, true);
}
// See GameRendererMixin.liquidsRaycast()
}
8 changes: 3 additions & 5 deletions src/main/java/net/wurstclient/hacks/TunnellerHack.java
Original file line number Diff line number Diff line change
Expand Up @@ -713,7 +713,6 @@ private Vec3d toVec3d(BlockPos pos)

private class PlaceTorchTask extends Task
{
@SuppressWarnings("deprecation")
@Override
public boolean canRun()
{
Expand Down Expand Up @@ -755,10 +754,9 @@ public boolean canRun()
BlockState state = BlockUtils.getState(nextTorch);
if(!state.isReplaceable())
return false;

// Can't see why canPlaceAt() is deprecated. Still seems to be
// widely used with no replacement.
return Blocks.TORCH.canPlaceAt(state, MC.world, nextTorch);

return Blocks.TORCH.getDefaultState().canPlaceAt(MC.world,
nextTorch);
}

@Override
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@
import net.minecraft.network.packet.s2c.play.BlockUpdateS2CPacket;
import net.minecraft.network.packet.s2c.play.ChunkData;
import net.minecraft.network.packet.s2c.play.ChunkDeltaUpdateS2CPacket;
import net.minecraft.network.packet.s2c.play.ServerMetadataS2CPacket;
import net.minecraft.network.packet.s2c.play.GameJoinS2CPacket;
import net.minecraft.text.MutableText;
import net.minecraft.text.Text;
import net.wurstclient.WurstClient;
Expand All @@ -42,15 +42,14 @@ private ClientPlayNetworkHandlerMixin(WurstClient wurst,
}

@Inject(at = @At("TAIL"),
method = "onServerMetadata(Lnet/minecraft/network/packet/s2c/play/ServerMetadataS2CPacket;)V")
public void onOnServerMetadata(ServerMetadataS2CPacket packet,
CallbackInfo ci)
method = "onGameJoin(Lnet/minecraft/network/packet/s2c/play/GameJoinS2CPacket;)V")
public void onOnGameJoin(GameJoinS2CPacket packet, CallbackInfo ci)
{
if(!WurstClient.INSTANCE.isEnabled())
return;

// Remove Mojang's dishonest warning toast on safe servers
if(!packet.isSecureChatEnforced())
if(!packet.enforcesSecureChat())
{
client.getToastManager().toastQueue.removeIf(toast -> toast
.getType() == SystemToast.Type.UNSECURE_SERVER_WARNING);
Expand Down
27 changes: 19 additions & 8 deletions src/main/java/net/wurstclient/mixin/GameRendererMixin.java
Original file line number Diff line number Diff line change
Expand Up @@ -15,15 +15,19 @@
import org.spongepowered.asm.mixin.injection.callback.CallbackInfo;
import org.spongepowered.asm.mixin.injection.callback.CallbackInfoReturnable;

import com.llamalad7.mixinextras.injector.wrapoperation.Operation;
import com.llamalad7.mixinextras.injector.wrapoperation.WrapOperation;

import net.minecraft.client.render.Camera;
import net.minecraft.client.render.GameRenderer;
import net.minecraft.client.util.math.MatrixStack;
import net.minecraft.entity.Entity;
import net.minecraft.entity.LivingEntity;
import net.minecraft.util.hit.HitResult;
import net.minecraft.util.math.MathHelper;
import net.wurstclient.WurstClient;
import net.wurstclient.event.EventManager;
import net.wurstclient.events.CameraTransformViewBobbingListener.CameraTransformViewBobbingEvent;
import net.wurstclient.events.HitResultRayTraceListener.HitResultRayTraceEvent;
import net.wurstclient.events.RenderListener.RenderEvent;
import net.wurstclient.hacks.FullbrightHack;

Expand Down Expand Up @@ -104,14 +108,21 @@ private void onGetFov(Camera camera, float tickDelta, boolean changingFov,
.changeFovBasedOnZoom(cir.getReturnValueD()));
}

@Inject(at = @At(value = "INVOKE",
target = "Lnet/minecraft/entity/Entity;getCameraPosVec(F)Lnet/minecraft/util/math/Vec3d;",
opcode = Opcodes.INVOKEVIRTUAL,
ordinal = 0), method = "updateTargetedEntity(F)V")
private void onHitResultRayTrace(float tickDelta, CallbackInfo ci)
/**
* This is the part that makes Liquids work.
*/
@WrapOperation(at = @At(value = "INVOKE",
target = "Lnet/minecraft/entity/Entity;raycast(DFZ)Lnet/minecraft/util/hit/HitResult;",
ordinal = 0),
method = "findCrosshairTarget(Lnet/minecraft/entity/Entity;DDF)Lnet/minecraft/util/hit/HitResult;")
private HitResult liquidsRaycast(Entity instance, double maxDistance,
float tickDelta, boolean includeFluids, Operation<HitResult> original)
{
HitResultRayTraceEvent event = new HitResultRayTraceEvent(tickDelta);
EventManager.fire(event);
if(!WurstClient.INSTANCE.getHax().liquidsHack.isEnabled())
return original.call(instance, maxDistance, tickDelta,
includeFluids);

return original.call(instance, maxDistance, tickDelta, true);
}

@Redirect(
Expand Down
4 changes: 2 additions & 2 deletions src/main/java/net/wurstclient/mixin/IngameHudMixin.java
Original file line number Diff line number Diff line change
Expand Up @@ -32,8 +32,8 @@ public class IngameHudMixin
// runs after renderScoreboardSidebar()
// and before playerListHud.setVisible()
@Inject(at = @At("HEAD"),
method = "method_55804(Lnet/minecraft/client/gui/DrawContext;F)V")
private void onMethod_55804(DrawContext context, float tickDelta,
method = "renderPlayerList(Lnet/minecraft/client/gui/DrawContext;F)V")
private void onRenderPlayerList(DrawContext context, float tickDelta,
CallbackInfo ci)
{
if(debugHud.shouldShowDebugHud())
Expand Down
29 changes: 13 additions & 16 deletions src/main/java/net/wurstclient/other_features/VanillaSpoofOtf.java
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,8 @@
*/
package net.wurstclient.other_features;

import net.minecraft.network.packet.BrandCustomPayload;
import net.minecraft.network.packet.c2s.common.CustomPayloadC2SPacket;
import net.minecraft.util.Identifier;
import net.wurstclient.DontBlock;
import net.wurstclient.SearchTags;
import net.wurstclient.events.ConnectionPacketOutputListener;
Expand Down Expand Up @@ -42,23 +42,20 @@ public void onSentConnectionPacket(ConnectionPacketOutputEvent event)
if(!(event.getPacket() instanceof CustomPayloadC2SPacket packet))
return;

Identifier channel = packet.payload().id();

if(channel.getNamespace().equals("minecraft")
&& channel.getPath().equals("register"))
event.cancel();
// change client brand "fabric" back to "vanilla"
if(packet.payload() instanceof BrandCustomPayload)
event.setPacket(
new CustomPayloadC2SPacket(new BrandCustomPayload("vanilla")));

// Apparently the Minecraft client no longer sends its brand to the
// server as of 23w31a

// if(packet.getChannel().getNamespace().equals("minecraft")
// && packet.getChannel().getPath().equals("brand"))
// event.setPacket(new CustomPayloadC2SPacket(
// CustomPayloadC2SPacket.BRAND,
// new PacketByteBuf(Unpooled.buffer()).writeString("vanilla")));
// cancel Fabric's "c:version", "c:register" and
// "fabric:custom_ingredient_sync" packets
// TODO: Something else is needed to prevent the connection from
// hanging when these packets are cancelled.

if(channel.getNamespace().equals("fabric"))
event.cancel();
// Identifier channel = packet.payload().getId().id();
// if(channel.getNamespace().equals("fabric")
// || channel.getNamespace().equals("c"))
// event.cancel();
}

@Override
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,6 @@ public static void reconnect(Screen prevScreen)
return;

ConnectScreen.connect(prevScreen, WurstClient.MC,
ServerAddress.parse(lastServer.address), lastServer, false);
ServerAddress.parse(lastServer.address), lastServer, false, null);
}
}
6 changes: 3 additions & 3 deletions src/main/resources/fabric.mod.json
Original file line number Diff line number Diff line change
Expand Up @@ -29,9 +29,9 @@
"accessWidener" : "wurst.accesswidener",

"depends": {
"fabricloader": ">=0.15.0",
"fabric-api": ">=0.91.4",
"minecraft": "~1.20.5-alpha.23.51.a",
"fabricloader": ">=0.15.3",
"fabric-api": ">=0.91.5",
"minecraft": "~1.20.5-alpha.24.3.a",
"java": ">=17"
},
"suggests": {
Expand Down

0 comments on commit 2e66a9c

Please sign in to comment.