2 Commits

Author SHA1 Message Date
YouHaveTrouble b89e332ed4 add more docs, add fromEntity method 2022-05-18 18:30:51 +02:00
YouHaveTrouble 301a358a60 well, that's awkward 2022-05-12 19:15:38 +02:00
2 changed files with 33 additions and 4 deletions
+2 -2
View File
@@ -6,14 +6,14 @@
<groupId>me.youhavetrouble</groupId> <groupId>me.youhavetrouble</groupId>
<artifactId>Entiddy</artifactId> <artifactId>Entiddy</artifactId>
<version>1.1.0</version> <version>1.2.0</version>
<packaging>jar</packaging> <packaging>jar</packaging>
<name>Entiddy</name> <name>Entiddy</name>
<description>A very serious library concerning entities</description> <description>A very serious library concerning entities</description>
<properties> <properties>
<java.version>1.8</java.version> <java.version>17</java.version>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding> <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
</properties> </properties>
@@ -12,9 +12,27 @@ import org.jetbrains.annotations.NotNull;
public enum Entiddy { public enum Entiddy {
/**
* Killer bunny that attacks players monthy python style
*/
KILLER_BUNNY(EntityType.RABBIT, new KillerBunny()), 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()), JEB_SHEEP(EntityType.SHEEP, new JebSheep()),
/**
* Johnny is hostile to basically every mob with few exceptions
* HERE'S JOHNNY
*/
JOHNNY(EntityType.VINDICATOR, new 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()); TOAST(EntityType.RABBIT, new Toast());
private final EntityType entityType; private final EntityType entityType;
@@ -47,10 +65,21 @@ public enum Entiddy {
*/ */
public static boolean isSpecialEntity(@NotNull LivingEntity entity) { public static boolean isSpecialEntity(@NotNull LivingEntity entity) {
if (entity instanceof Player) return false; if (entity instanceof Player) return false;
for (Entiddy enTiddy: Entiddy.values()) { for (Entiddy entiddy: Entiddy.values()) {
if (enTiddy.entiddy().isInstance(entity)) return true; if (entiddy.entiddy().isInstance(entity)) return true;
} }
return false; 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;
}
} }