generated from Polyfrost/OneConfigExampleMod
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
2 changed files
with
28 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
23 changes: 23 additions & 0 deletions
23
src/main/java/win/cuteguimc/zombieshelper/utils/Utils.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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; | ||
} | ||
} |