Skip to content

Commit

Permalink
update
Browse files Browse the repository at this point in the history
  • Loading branch information
guimc233 committed Aug 14, 2024
1 parent a31db01 commit 8d4964a
Show file tree
Hide file tree
Showing 2 changed files with 28 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@

import java.awt.*;
import java.util.List;
import java.util.Objects;
import java.util.stream.Collectors;

@Mixin(EntityRenderer.class)
Expand All @@ -31,9 +32,12 @@ private void renderWorldPass(int pass, float partialTicks, long finishTimeNano,
Color color = new Color(255, 43, 28);
float[] colors = new float[]{(float) color.getRed(), color.getGreen(), color.getBlue()};
for (Entity entity : Minecraft.getMinecraft().theWorld.getLoadedEntityList()) {
if (entity instanceof IAnimals && !(entity instanceof EntityVillager) && Minecraft.getMinecraft().thePlayer.getDistanceToEntity(entity) <= ZombiesHelperConfig.espRange) {
if (Utils.isTarget(entity) && Minecraft.getMinecraft().thePlayer.getDistanceToEntity(entity) <= ZombiesHelperConfig.espRange) {
RenderUtils.drawEntityBox(entity, (Minecraft.getMinecraft().thePlayer.getDistanceToEntity(entity) <= 8) ? color : targetcolor);
}
if (Utils.isPowerUP(entity)) {
RenderUtils.drawEntityBox(entity, Objects.requireNonNull(Utils.getPowerUPColor(entity)));
}
}

for (Entity entity : Minecraft.getMinecraft().theWorld.loadedEntityList.stream().filter(entity -> Utils.isTarget(entity) && Minecraft.getMinecraft().thePlayer.getDistanceToEntity(entity) <= 8).collect(Collectors.toList())) {
Expand Down
23 changes: 23 additions & 0 deletions src/main/java/win/cuteguimc/zombieshelper/utils/Utils.java
Original file line number Diff line number Diff line change
@@ -1,12 +1,35 @@
package win.cuteguimc.zombieshelper.utils;

import kotlin.text.Regex;
import net.minecraft.entity.Entity;
import net.minecraft.entity.item.EntityArmorStand;
import net.minecraft.entity.monster.IMob;
import net.minecraft.entity.passive.EntityVillager;
import net.minecraft.entity.passive.IAnimals;

import java.awt.*;
import java.util.Locale;

public class Utils {
private static Regex regex = new Regex("(?:§.)*(SHOPPING SPREE|DOUBLE GOLD|MAX AMMO|INSTA KILL|CARPENTER|BONUS GOLD)");

public static boolean isTarget(Entity entity) {
return entity instanceof IAnimals && !(entity instanceof EntityVillager);
}

public static boolean isPowerUP(Entity entity) {
return entity instanceof EntityArmorStand && regex.containsMatchIn(entity.getName());
}

public static Color getPowerUPColor(Entity entity) {
Color color = Color.WHITE;
if (!(entity instanceof EntityArmorStand)) return null;
String name = entity.getName().toLowerCase(Locale.ROOT);
if (name.contains("shopping")) color = new Color(106, 0, 255);
else if (name.contains("double")) color = new Color(255, 217, 0);
else if (name.contains("max ammo")) color = Color.BLUE;
else if (name.contains("carpenter")) color = Color.GREEN;
else if (name.contains("bonus")) color = new Color(255, 128, 0);
return color;
}
}

0 comments on commit 8d4964a

Please sign in to comment.