add more docs, add fromEntity method

This commit is contained in:
2022-05-18 18:30:51 +02:00
parent 301a358a60
commit b89e332ed4
2 changed files with 32 additions and 3 deletions
+1 -1
View File
@@ -6,7 +6,7 @@
<groupId>me.youhavetrouble</groupId>
<artifactId>Entiddy</artifactId>
<version>1.1.0</version>
<version>1.2.0</version>
<packaging>jar</packaging>
<name>Entiddy</name>
@@ -12,9 +12,27 @@ import org.jetbrains.annotations.NotNull;
public enum Entiddy {
/**
* Killer bunny that attacks players monthy python style
*/
KILLER_BUNNY(EntityType.RABBIT, new KillerBunny()),
/**
* Its wool cycles with interpolation through all dye colors
* Sheep with rgb lighting
*/
JEB_SHEEP(EntityType.SHEEP, new JebSheep()),
/**
* Johnny is hostile to basically every mob with few exceptions
* HERE'S JOHNNY
*/
JOHNNY(EntityType.VINDICATOR, new Johnny()),
/**
* Toast has the appearance of a black dutch, with a large black and white patch and more black fur around the face
* than the natural black and white spotted rabbit.
*/
TOAST(EntityType.RABBIT, new Toast());
private final EntityType entityType;
@@ -47,10 +65,21 @@ public enum Entiddy {
*/
public static boolean isSpecialEntity(@NotNull LivingEntity entity) {
if (entity instanceof Player) return false;
for (Entiddy enTiddy: Entiddy.values()) {
if (enTiddy.entiddy().isInstance(entity)) return true;
for (Entiddy entiddy: Entiddy.values()) {
if (entiddy.entiddy().isInstance(entity)) return true;
}
return false;
}
/**
* @return Special entity type or null
*/
public static Entiddy fromEntity(@NotNull LivingEntity entity) {
if (entity instanceof Player) return null;
for (Entiddy entiddy: Entiddy.values()) {
if (entiddy.entiddy().isInstance(entity)) return entiddy;
}
return null;
}
}