Skip to content

Commit 7e6f71d

Browse files
committed
Added Glow Outline to MobESP
1 parent 15fc1e5 commit 7e6f71d

3 files changed

Lines changed: 68 additions & 24 deletions

File tree

README.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -296,6 +296,7 @@ Examples:
296296
### MobESP Improvements
297297
- Added rainbow/fixed color options for boxes/lines.
298298
- Added octahedron shapes and set it as the new default.
299+
- Added glow outlines as an option
299300
- Added box color fill option
300301

301302
![Mob](https://i.imgur.com/VXHW4qe.png)

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

Lines changed: 42 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -171,7 +171,8 @@ public void onCameraTransformViewBobbing(
171171
public void onRender(MatrixStack matrixStack, float partialTicks)
172172
{
173173
MobEspStyleSetting.Shape shape = style.getShape();
174-
boolean drawShape = shape != MobEspStyleSetting.Shape.NONE;
174+
boolean glowMode = shape == MobEspStyleSetting.Shape.GLOW;
175+
boolean drawShape = !glowMode && shape != MobEspStyleSetting.Shape.NONE;
175176
boolean drawLines = style.hasLines();
176177
boolean drawFill = drawShape && fillShapes.isChecked();
177178

@@ -211,31 +212,34 @@ public void onRender(MatrixStack matrixStack, float partialTicks)
211212
}
212213
}
213214

214-
if(filledShapes != null && !filledShapes.isEmpty())
215+
if(!glowMode)
215216
{
216-
switch(shape)
217+
if(filledShapes != null && !filledShapes.isEmpty())
217218
{
218-
case BOX -> RenderUtils.drawSolidBoxes(matrixStack,
219-
filledShapes, false);
220-
case OCTAHEDRON -> RenderUtils.drawSolidOctahedrons(matrixStack,
221-
filledShapes, false);
222-
default ->
223-
{
224-
}
219+
switch(shape)
220+
{
221+
case BOX -> RenderUtils.drawSolidBoxes(matrixStack,
222+
filledShapes, false);
223+
case OCTAHEDRON -> RenderUtils
224+
.drawSolidOctahedrons(matrixStack, filledShapes, false);
225+
default ->
226+
{
227+
}
228+
}
225229
}
226-
}
227-
228-
if(outlineShapes != null && !outlineShapes.isEmpty())
229-
{
230-
switch(shape)
230+
231+
if(outlineShapes != null && !outlineShapes.isEmpty())
231232
{
232-
case BOX -> RenderUtils.drawOutlinedBoxes(matrixStack,
233-
outlineShapes, false);
234-
case OCTAHEDRON -> RenderUtils
235-
.drawOutlinedOctahedrons(matrixStack, outlineShapes, false);
236-
default ->
237-
{
238-
}
233+
switch(shape)
234+
{
235+
case BOX -> RenderUtils.drawOutlinedBoxes(matrixStack,
236+
outlineShapes, false);
237+
case OCTAHEDRON -> RenderUtils.drawOutlinedOctahedrons(
238+
matrixStack, outlineShapes, false);
239+
default ->
240+
{
241+
}
242+
}
239243
}
240244
}
241245

@@ -250,6 +254,17 @@ private float[] getColorRgb()
250254
return color.getColorF();
251255
}
252256

257+
public boolean shouldGlow(LivingEntity entity)
258+
{
259+
return isEnabled() && style.getShape() == MobEspStyleSetting.Shape.GLOW
260+
&& mobs.contains(entity);
261+
}
262+
263+
public int getGlowColor()
264+
{
265+
return RenderUtils.toIntColor(getColorRgb(), 1F);
266+
}
267+
253268
private static final class MobEspStyleSetting
254269
extends EnumSetting<MobEspStyleSetting.Style>
255270
{
@@ -272,7 +287,8 @@ enum Shape
272287
{
273288
NONE,
274289
BOX,
275-
OCTAHEDRON;
290+
OCTAHEDRON,
291+
GLOW;
276292
}
277293

278294
private enum Style
@@ -282,7 +298,9 @@ private enum Style
282298
LINES("Lines only", Shape.NONE, true),
283299
LINES_AND_BOXES("Lines and boxes", Shape.BOX, true),
284300
LINES_AND_OCTAHEDRONS("Lines and octahedrons", Shape.OCTAHEDRON,
285-
true);
301+
true),
302+
GLOW("Glow only", Shape.GLOW, false),
303+
LINES_AND_GLOW("Lines and glow", Shape.GLOW, true);
286304

287305
private final String name;
288306
private final Shape shape;

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

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@
1717
import com.llamalad7.mixinextras.injector.v2.WrapWithCondition;
1818

1919
import net.minecraft.entity.Entity;
20+
import net.minecraft.entity.LivingEntity;
2021
import net.minecraft.entity.player.PlayerEntity;
2122
import net.minecraft.server.command.CommandOutput;
2223
import net.minecraft.util.Nameable;
@@ -78,4 +79,28 @@ private void onIsInvisibleTo(PlayerEntity player,
7879
.shouldBeVisible((Entity)(Object)this))
7980
cir.setReturnValue(false);
8081
}
82+
83+
@Inject(at = @At("RETURN"), method = "isGlowing", cancellable = true)
84+
private void onIsGlowing(CallbackInfoReturnable<Boolean> cir)
85+
{
86+
if(cir.getReturnValueZ())
87+
return;
88+
89+
if((Object)this instanceof LivingEntity living
90+
&& WurstClient.INSTANCE.getHax().mobEspHack.shouldGlow(living))
91+
cir.setReturnValue(true);
92+
}
93+
94+
@Inject(at = @At("RETURN"),
95+
method = "getTeamColorValue",
96+
cancellable = true)
97+
private void onGetTeamColorValue(CallbackInfoReturnable<Integer> cir)
98+
{
99+
if(!((Object)this instanceof LivingEntity living))
100+
return;
101+
102+
if(WurstClient.INSTANCE.getHax().mobEspHack.shouldGlow(living))
103+
cir.setReturnValue(
104+
WurstClient.INSTANCE.getHax().mobEspHack.getGlowColor());
105+
}
81106
}

0 commit comments

Comments
 (0)