diff options
Diffstat (limited to 'src/main/java/com/thatgravyboat/skyblockhud/api/sbentities')
-rw-r--r-- | src/main/java/com/thatgravyboat/skyblockhud/api/sbentities/EntityTypeHelper.java | 18 | ||||
-rw-r--r-- | src/main/java/com/thatgravyboat/skyblockhud/api/sbentities/EntityTypeRegistry.java | 4 |
2 files changed, 21 insertions, 1 deletions
diff --git a/src/main/java/com/thatgravyboat/skyblockhud/api/sbentities/EntityTypeHelper.java b/src/main/java/com/thatgravyboat/skyblockhud/api/sbentities/EntityTypeHelper.java index d1ad8d2..8dc63c8 100644 --- a/src/main/java/com/thatgravyboat/skyblockhud/api/sbentities/EntityTypeHelper.java +++ b/src/main/java/com/thatgravyboat/skyblockhud/api/sbentities/EntityTypeHelper.java @@ -4,7 +4,9 @@ import com.thatgravyboat.skyblockhud.location.LocationHandler; import com.thatgravyboat.skyblockhud.location.Locations; import net.minecraft.entity.Entity; import net.minecraft.entity.monster.EntityEnderman; +import net.minecraft.entity.monster.EntityZombie; import net.minecraft.init.Blocks; +import net.minecraft.init.Items; public class EntityTypeHelper { @@ -18,4 +20,20 @@ public class EntityTypeHelper { } return false; } + + public static boolean isCrypt(Entity entity){ + if (entity instanceof EntityZombie) { + EntityZombie zombie = ((EntityZombie) entity); + double maxHealthBase = zombie.getAttributeMap().getAttributeInstanceByName("generic.maxHealth").getBaseValue(); + if (maxHealthBase != 2000d) return false; + if (zombie.getEquipmentInSlot(0) == null || !zombie.getEquipmentInSlot(0).getItem().equals(Items.iron_sword)) + return false; + if (zombie.getEquipmentInSlot(1) == null || !zombie.getEquipmentInSlot(1).getItem().equals(Items.chainmail_boots)) + return false; + if (zombie.getEquipmentInSlot(2) == null || !zombie.getEquipmentInSlot(2).getItem().equals(Items.chainmail_leggings)) + return false; + return zombie.getEquipmentInSlot(3) != null && zombie.getEquipmentInSlot(3).getItem().equals(Items.chainmail_chestplate); + } + return false; + } } diff --git a/src/main/java/com/thatgravyboat/skyblockhud/api/sbentities/EntityTypeRegistry.java b/src/main/java/com/thatgravyboat/skyblockhud/api/sbentities/EntityTypeRegistry.java index 952aaa7..6ff88fa 100644 --- a/src/main/java/com/thatgravyboat/skyblockhud/api/sbentities/EntityTypeRegistry.java +++ b/src/main/java/com/thatgravyboat/skyblockhud/api/sbentities/EntityTypeRegistry.java @@ -6,13 +6,15 @@ import java.util.List; import java.util.Map; import net.minecraft.entity.Entity; import net.minecraft.entity.monster.EntityEnderman; +import net.minecraft.entity.monster.EntityZombie; public class EntityTypeRegistry { private static final Map<Class<? extends Entity>, List<SkyBlockEntity>> entities = Maps.newHashMap(); static { - entities.put(EntityEnderman.class, ImmutableList.of(SkyBlockEntity.of("zealot", EntityTypeHelper::isZealot))); + entities.put(EntityEnderman.class, ImmutableList.of(SkyBlockEntity.of("ZEALOT", EntityTypeHelper::isZealot))); + entities.put(EntityZombie.class, ImmutableList.of(SkyBlockEntity.of("CRYPT_GHOUL", EntityTypeHelper::isCrypt))); } public static String getEntityId(Entity entity) { |