Skip to content

Commit 0a9089f

Browse files
committed
Updated Friends
1 parent 9ee181a commit 0a9089f

3 files changed

Lines changed: 40 additions & 13 deletions

File tree

src/main/java/net/wurstclient/FriendsList.java

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -126,9 +126,15 @@ public void middleClick(Entity entity)
126126
String name = entity.getName().getString();
127127

128128
if(contains(name))
129+
{
129130
removeAndSave(name);
130-
else
131+
ChatUtils
132+
.message("Removed \"" + name + "\" from your friends list.");
133+
}else
134+
{
131135
addAndSave(name);
136+
ChatUtils.message("Added \"" + name + "\" to your friends list.");
137+
}
132138
}
133139

134140
public boolean contains(String name)

src/main/java/net/wurstclient/hacks/MaceDmgHack.java

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -26,18 +26,18 @@ public final class MaceDmgHack extends Hack
2626
private static final double DEFAULT_HEIGHT = Math.sqrt(500);
2727
private static final double MIN_FALL = 1.6;
2828
private static final double SCAN_STEP = 0.25;
29-
29+
3030
private final SliderSetting height = new SliderSetting("Height",
3131
"How high to fake before slamming. Height determines the damage boost.",
3232
DEFAULT_HEIGHT, 1.6, 50, 0.1, ValueDisplay.DECIMAL);
33-
33+
3434
private final CheckboxSetting caveMode = new CheckboxSetting("Cave mode",
3535
"Scans for an air gap above you to fall through, so smashes work under"
3636
+ " a ceiling. Fully sealed spaces still can't be smashed.",
3737
true);
38-
38+
3939
private long lastSmashTick = -1;
40-
40+
4141
public MaceDmgHack()
4242
{
4343
super("MaceDMG");
@@ -83,23 +83,23 @@ public void doSmash()
8383
sendFakeY(findFallOffset());
8484
sendFakeY(0);
8585
}
86-
86+
8787
private double findFallOffset()
8888
{
8989
double cap = height.getValue();
9090
if(!caveMode.isChecked() || MC.level == null)
9191
return cap;
92-
92+
9393
for(double off = cap; off >= MIN_FALL; off -= SCAN_STEP)
9494
{
9595
AABB box = MC.player.getBoundingBox().move(0, off, 0);
9696
if(MC.level.noCollision(MC.player, box))
9797
return off;
9898
}
99-
99+
100100
return cap;
101101
}
102-
102+
103103
private void sendFakeY(double offset)
104104
{
105105
MC.player.connection

src/main/java/net/wurstclient/mixin/MinecraftMixin.java

Lines changed: 25 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -30,8 +30,11 @@
3030
import net.minecraft.client.multiplayer.ProfileKeyPairManager;
3131
import net.minecraft.client.player.LocalPlayer;
3232
import net.minecraft.util.thread.ReentrantBlockableEventLoop;
33+
import net.minecraft.world.entity.player.Player;
34+
import net.minecraft.world.entity.projectile.ProjectileUtil;
35+
import net.minecraft.world.phys.AABB;
3336
import net.minecraft.world.phys.EntityHitResult;
34-
import net.minecraft.world.phys.HitResult;
37+
import net.minecraft.world.phys.Vec3;
3538
import net.wurstclient.WurstClient;
3639
import net.wurstclient.event.EventManager;
3740
import net.wurstclient.events.HandleBlockBreakingListener.HandleBlockBreakingEvent;
@@ -131,12 +134,30 @@ private void onDoItemPick(CallbackInfo ci)
131134
{
132135
if(!WurstClient.INSTANCE.isEnabled())
133136
return;
137+
138+
// Do a custom long-range entity raycast to find players
139+
// at greater distances than the vanilla reach limit
140+
LocalPlayer localPlayer = WurstClient.MC.player;
141+
if(localPlayer == null)
142+
return;
143+
144+
double reach = 64.0;
145+
Vec3 eyePos = localPlayer.getEyePosition(1.0F);
146+
Vec3 lookVec = localPlayer.getViewVector(1.0F);
147+
Vec3 endPos =
148+
eyePos.add(lookVec.x * reach, lookVec.y * reach, lookVec.z * reach);
149+
150+
AABB searchBox = localPlayer.getBoundingBox()
151+
.expandTowards(lookVec.scale(reach)).inflate(1.0);
152+
153+
EntityHitResult hit = ProjectileUtil.getEntityHitResult(localPlayer,
154+
eyePos, endPos, searchBox,
155+
e -> e instanceof Player && !e.isSpectator(), reach * reach);
134156

135-
HitResult hitResult = WurstClient.MC.hitResult;
136-
if(!(hitResult instanceof EntityHitResult eHitResult))
157+
if(hit == null)
137158
return;
138159

139-
WurstClient.INSTANCE.getFriends().middleClick(eHitResult.getEntity());
160+
WurstClient.INSTANCE.getFriends().middleClick(hit.getEntity());
140161
}
141162

142163
/**

0 commit comments

Comments
 (0)