Skip to content

Commit ac81f51

Browse files
committed
MobHealth Added
1 parent fe666ed commit ac81f51

10 files changed

Lines changed: 605 additions & 98 deletions

README.md

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -739,6 +739,16 @@ This hack is still undergoing development and has only been tested in the end. A
739739
- Allows you to setup a list of blocks that can only be broken by the player using a tool that has Silk Touch.
740740
- Perfect for avoiding accidental breakage of Ender Chests and Amethyst Clusters.
741741

742+
### MobHealth
743+
- Two dipslay modes; heart bar or a colored number.
744+
- Uses ```hud/heart/*``` sprite IDs so it will change along with your resource pack.
745+
- Toggles for showing number, names or hostile mobs only.
746+
- Normalised to 10 max hearts.
747+
- Compatible with HealthTags so names don't conflict.
748+
- Conforms to vanilla health status effects (poison, wither, frozen, absorption, hardcore, low health jittering).
749+
750+
![Hearts](https://i.imgur.com/FZ8Z0TK.png)
751+
742752
## What's changed or improved in this fork?
743753

744754
### ChestESP
@@ -939,6 +949,9 @@ Examples:
939949
### AimAssist Improved
940950
- Added lock-on targetting
941951

952+
### HealthTags Improved
953+
- Now optionally uses the same hearts as the new MobHealth hack
954+
942955
### HandNoClip Improved
943956
- Displays a red X on the crosshair when block placement or interaction is blocked while the hack is enabled.
944957
- The red X can also indicate blocks that can be interacted with when On-Target Mode is enabled; in this mode, HandNoClip remains disabled until you are within range of a valid block.

src/main/java/net/wurstclient/hack/HackList.java

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -168,6 +168,7 @@ public final class HackList implements UpdateListener
168168
public final MileyCyrusHack mileyCyrusHack = new MileyCyrusHack();
169169
public final MeasurementEspHack measurementEspHack =
170170
new MeasurementEspHack();
171+
public final MobHealthHack mobHealthHack = new MobHealthHack();
171172
public final MobEspHack mobEspHack = new MobEspHack();
172173
public final WardenEspHack wardenEspHack = new WardenEspHack();
173174
public final MobSearchHack mobSearchHack = new MobSearchHack();

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

Lines changed: 82 additions & 82 deletions
Original file line numberDiff line numberDiff line change
@@ -90,14 +90,14 @@ public final class FlightHack extends Hack implements UpdateListener,
9090
new SliderSetting("Escape Drop Speed",
9191
"description.wurst.setting.flight.escape_drop_speed", 3.9, 0.05,
9292
3.9, 0.05, ValueDisplay.DECIMAL);
93-
private final CheckboxSetting enableNoFallOnFlight = new CheckboxSetting(
94-
"Enable NoFall with Flight",
95-
"description.wurst.setting.flight.enable_nofall_with_flight", false);
96-
97-
private final CheckboxSetting ignoreVinesWithFlight = new CheckboxSetting(
98-
"Ignore vines with Flight",
99-
"Temporarily enables NoSlowdown's \"Ignore vines\" while Flight is enabled.",
100-
false);
93+
private final CheckboxSetting enableNoFallOnFlight = new CheckboxSetting(
94+
"Enable NoFall with Flight",
95+
"description.wurst.setting.flight.enable_nofall_with_flight", false);
96+
97+
private final CheckboxSetting ignoreVinesWithFlight = new CheckboxSetting(
98+
"Ignore vines with Flight",
99+
"Temporarily enables NoSlowdown's \"Ignore vines\" while Flight is enabled.",
100+
false);
101101

102102
private final CheckboxSetting slowSneaking =
103103
new CheckboxSetting("Slow sneaking",
@@ -114,12 +114,12 @@ public final class FlightHack extends Hack implements UpdateListener,
114114
private int tickCounter = 0;
115115
private final PlayerRangeAlertManager alertManager =
116116
WURST.getPlayerRangeAlertManager();
117-
private boolean escapeDropActive;
118-
private double escapeTargetY;
119-
private boolean triggered;
120-
private boolean enabledNoFallByFlight;
121-
private boolean enabledNoFallByEscape;
122-
private boolean managedNoSlowdownVineIgnore;
117+
private boolean escapeDropActive;
118+
private double escapeTargetY;
119+
private boolean triggered;
120+
private boolean enabledNoFallByFlight;
121+
private boolean enabledNoFallByEscape;
122+
private boolean managedNoSlowdownVineIgnore;
123123

124124
public FlightHack()
125125
{
@@ -137,13 +137,13 @@ public FlightHack()
137137
addSetting(antiKickDistance);
138138
addSetting(dontGetCaught);
139139
addSetting(escapeDropSpeed);
140-
addSetting(ignoreNpcs);
141-
addSetting(ignoreFriends);
142-
addSetting(enableNoFallOnFlight);
143-
addSetting(ignoreVinesWithFlight);
144-
addSetting(slowSneaking);
145-
addSetting(ignoreShiftInGuis);
146-
}
140+
addSetting(ignoreNpcs);
141+
addSetting(ignoreFriends);
142+
addSetting(enableNoFallOnFlight);
143+
addSetting(ignoreVinesWithFlight);
144+
addSetting(slowSneaking);
145+
addSetting(ignoreShiftInGuis);
146+
}
147147

148148
@Override
149149
public String getRenderName()
@@ -166,14 +166,14 @@ public String getRenderName()
166166
@Override
167167
protected void onEnable()
168168
{
169-
tickCounter = 0;
170-
escapeDropActive = false;
171-
triggered = false;
172-
managedNoSlowdownVineIgnore = false;
173-
174-
WURST.getHax().creativeFlightHack.setEnabled(false);
175-
WURST.getHax().jetpackHack.setEnabled(false);
176-
syncNoSlowdownVineIgnore();
169+
tickCounter = 0;
170+
escapeDropActive = false;
171+
triggered = false;
172+
managedNoSlowdownVineIgnore = false;
173+
174+
WURST.getHax().creativeFlightHack.setEnabled(false);
175+
WURST.getHax().jetpackHack.setEnabled(false);
176+
syncNoSlowdownVineIgnore();
177177

178178
if(enableNoFallOnFlight.isChecked()
179179
&& !WURST.getHax().noFallHack.isEnabled())
@@ -190,21 +190,21 @@ protected void onEnable()
190190
}
191191

192192
@Override
193-
protected void onDisable()
194-
{
195-
restoreNoSlowdownVineIgnore();
196-
EVENTS.remove(UpdateListener.class, this);
197-
EVENTS.remove(IsPlayerInWaterListener.class, this);
198-
EVENTS.remove(AirStrafingSpeedListener.class, this);
193+
protected void onDisable()
194+
{
195+
restoreNoSlowdownVineIgnore();
196+
EVENTS.remove(UpdateListener.class, this);
197+
EVENTS.remove(IsPlayerInWaterListener.class, this);
198+
EVENTS.remove(AirStrafingSpeedListener.class, this);
199199
alertManager.removeListener(this);
200200
EVENTS.remove(MouseScrollListener.class, this);
201201
}
202202

203203
@Override
204-
public void onUpdate()
205-
{
206-
LocalPlayer player = MC.player;
207-
syncNoSlowdownVineIgnore();
204+
public void onUpdate()
205+
{
206+
LocalPlayer player = MC.player;
207+
syncNoSlowdownVineIgnore();
208208

209209
if(enableNoFallOnFlight.isChecked()
210210
&& !WURST.getHax().noFallHack.isEnabled())
@@ -250,49 +250,49 @@ public void onUpdate()
250250
Vec3 current = player.getDeltaMovement();
251251
player.setDeltaMovement(current.x, alignStep, current.z);
252252
}
253-
}
254-
255-
private void syncNoSlowdownVineIgnore()
256-
{
257-
NoSlowdownHack noSlowdown = WURST.getHax().noSlowdownHack;
258-
if(noSlowdown == null)
259-
return;
260-
261-
if(!ignoreVinesWithFlight.isChecked())
262-
{
263-
if(managedNoSlowdownVineIgnore)
264-
{
265-
noSlowdown.setIgnoreVines(false);
266-
managedNoSlowdownVineIgnore = false;
267-
}
268-
return;
269-
}
270-
271-
if(!managedNoSlowdownVineIgnore)
272-
{
273-
if(noSlowdown.shouldIgnoreVines())
274-
return;
275-
276-
noSlowdown.setIgnoreVines(true);
277-
managedNoSlowdownVineIgnore = true;
278-
return;
279-
}
280-
281-
if(!noSlowdown.shouldIgnoreVines())
282-
noSlowdown.setIgnoreVines(true);
283-
}
284-
285-
private void restoreNoSlowdownVineIgnore()
286-
{
287-
if(!managedNoSlowdownVineIgnore)
288-
return;
289-
290-
NoSlowdownHack noSlowdown = WURST.getHax().noSlowdownHack;
291-
if(noSlowdown != null)
292-
noSlowdown.setIgnoreVines(false);
293-
294-
managedNoSlowdownVineIgnore = false;
295-
}
253+
}
254+
255+
private void syncNoSlowdownVineIgnore()
256+
{
257+
NoSlowdownHack noSlowdown = WURST.getHax().noSlowdownHack;
258+
if(noSlowdown == null)
259+
return;
260+
261+
if(!ignoreVinesWithFlight.isChecked())
262+
{
263+
if(managedNoSlowdownVineIgnore)
264+
{
265+
noSlowdown.setIgnoreVines(false);
266+
managedNoSlowdownVineIgnore = false;
267+
}
268+
return;
269+
}
270+
271+
if(!managedNoSlowdownVineIgnore)
272+
{
273+
if(noSlowdown.shouldIgnoreVines())
274+
return;
275+
276+
noSlowdown.setIgnoreVines(true);
277+
managedNoSlowdownVineIgnore = true;
278+
return;
279+
}
280+
281+
if(!noSlowdown.shouldIgnoreVines())
282+
noSlowdown.setIgnoreVines(true);
283+
}
284+
285+
private void restoreNoSlowdownVineIgnore()
286+
{
287+
if(!managedNoSlowdownVineIgnore)
288+
return;
289+
290+
NoSlowdownHack noSlowdown = WURST.getHax().noSlowdownHack;
291+
if(noSlowdown != null)
292+
noSlowdown.setIgnoreVines(false);
293+
294+
managedNoSlowdownVineIgnore = false;
295+
}
296296

297297
@Override
298298
public void onGetAirStrafingSpeed(AirStrafingSpeedEvent event)

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

Lines changed: 57 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,34 +8,75 @@
88
package net.wurstclient.hacks;
99

1010
import net.minecraft.ChatFormatting;
11+
import net.minecraft.client.gui.GuiGraphics;
1112
import net.minecraft.network.chat.Component;
1213
import net.minecraft.network.chat.MutableComponent;
1314
import net.minecraft.world.entity.LivingEntity;
1415
import net.wurstclient.Category;
1516
import net.wurstclient.SearchTags;
17+
import net.wurstclient.events.GUIRenderListener;
1618
import net.wurstclient.hack.Hack;
19+
import net.wurstclient.settings.CheckboxSetting;
20+
import net.wurstclient.util.EntityHealthRenderer;
1721

1822
@SearchTags({"health tags"})
19-
public final class HealthTagsHack extends Hack
23+
public final class HealthTagsHack extends Hack implements GUIRenderListener
2024
{
25+
private final CheckboxSetting heartsBelowName =
26+
new CheckboxSetting("Hearts below name",
27+
"Shows hearts on a second line below the nametag instead of"
28+
+ " appending a numeric value to the name.",
29+
false);
30+
31+
private final java.util.Set<LivingEntity> entitiesToRender =
32+
java.util.Collections.newSetFromMap(new java.util.WeakHashMap<>());
33+
2134
public HealthTagsHack()
2235
{
2336
super("HealthTags");
2437
setCategory(Category.RENDER);
38+
addSetting(heartsBelowName);
39+
}
40+
41+
@Override
42+
protected void onEnable()
43+
{
44+
EVENTS.add(GUIRenderListener.class, this);
45+
}
46+
47+
@Override
48+
protected void onDisable()
49+
{
50+
EVENTS.remove(GUIRenderListener.class, this);
51+
entitiesToRender.clear();
2552
}
2653

2754
public Component addHealth(LivingEntity entity, MutableComponent nametag)
2855
{
2956
if(!isEnabled())
3057
return nametag;
3158

59+
if(heartsBelowName.isChecked())
60+
return nametag;
61+
3262
int health = (int)entity.getHealth();
3363

3464
MutableComponent formattedHealth = Component.literal(" ")
3565
.append(Integer.toString(health)).withStyle(getColor(health));
3666
return nametag.append(formattedHealth);
3767
}
3868

69+
public boolean shouldRenderHeartsBelowName()
70+
{
71+
return isEnabled() && heartsBelowName.isChecked();
72+
}
73+
74+
public void markForHeartRender(LivingEntity entity)
75+
{
76+
if(shouldRenderHeartsBelowName())
77+
entitiesToRender.add(entity);
78+
}
79+
3980
private ChatFormatting getColor(int health)
4081
{
4182
if(health <= 5)
@@ -50,5 +91,20 @@ private ChatFormatting getColor(int health)
5091
return ChatFormatting.GREEN;
5192
}
5293

94+
@Override
95+
public void onRenderGUI(GuiGraphics context, float partialTicks)
96+
{
97+
for(LivingEntity entity : entitiesToRender)
98+
{
99+
if(entity == null || !entity.isAlive())
100+
continue;
101+
102+
EntityHealthRenderer.drawHeartsAtEntity(context, entity,
103+
partialTicks, -10F);
104+
}
105+
106+
entitiesToRender.clear();
107+
}
108+
53109
// See EntityRendererMixin
54110
}

0 commit comments

Comments
 (0)