aboutsummaryrefslogtreecommitdiff
path: root/src/main/java/com/thatgravyboat/skyblockhud/api
diff options
context:
space:
mode:
Diffstat (limited to 'src/main/java/com/thatgravyboat/skyblockhud/api')
-rw-r--r--src/main/java/com/thatgravyboat/skyblockhud/api/KillTracking.java5
-rw-r--r--src/main/java/com/thatgravyboat/skyblockhud/api/events/SkyBlockEntityKilled.java4
-rw-r--r--src/main/java/com/thatgravyboat/skyblockhud/api/sbentities/EntityTypeHelper.java18
-rw-r--r--src/main/java/com/thatgravyboat/skyblockhud/api/sbentities/EntityTypeRegistry.java4
4 files changed, 28 insertions, 3 deletions
diff --git a/src/main/java/com/thatgravyboat/skyblockhud/api/KillTracking.java b/src/main/java/com/thatgravyboat/skyblockhud/api/KillTracking.java
index 32feb1b..c13a7b8 100644
--- a/src/main/java/com/thatgravyboat/skyblockhud/api/KillTracking.java
+++ b/src/main/java/com/thatgravyboat/skyblockhud/api/KillTracking.java
@@ -7,6 +7,7 @@ import java.util.HashSet;
import java.util.Set;
import java.util.UUID;
import net.minecraft.client.Minecraft;
+import net.minecraft.nbt.NBTTagCompound;
import net.minecraft.util.DamageSource;
import net.minecraftforge.common.MinecraftForge;
import net.minecraftforge.event.entity.EntityJoinWorldEvent;
@@ -32,7 +33,9 @@ public class KillTracking {
System.out.println("----------------------------------------------------------------------------------------------------------------");
System.out.println("Name : " + event.entity.getName());
System.out.println("UUID : " + event.entity.getUniqueID());
- System.out.println("Tag : " + event.entity.serializeNBT());
+ NBTTagCompound compound = new NBTTagCompound();
+ event.entity.writeToNBT(compound);
+ System.out.println("Tag : " + compound);
System.out.println("Damage : " + getDamageSourceString(event.source));
System.out.println("SBH Entity ID: " + EntityTypeRegistry.getEntityId(event.entity));
System.out.println("----------------------------------------------------------------------------------------------------------------");
diff --git a/src/main/java/com/thatgravyboat/skyblockhud/api/events/SkyBlockEntityKilled.java b/src/main/java/com/thatgravyboat/skyblockhud/api/events/SkyBlockEntityKilled.java
index 325781c..15fb01a 100644
--- a/src/main/java/com/thatgravyboat/skyblockhud/api/events/SkyBlockEntityKilled.java
+++ b/src/main/java/com/thatgravyboat/skyblockhud/api/events/SkyBlockEntityKilled.java
@@ -1,14 +1,16 @@
package com.thatgravyboat.skyblockhud.api.events;
+import javax.annotation.Nullable;
import net.minecraft.entity.Entity;
import net.minecraftforge.fml.common.eventhandler.Event;
public class SkyBlockEntityKilled extends Event {
public String id;
+ @Nullable
public Entity entity;
- public SkyBlockEntityKilled(String id, Entity entity) {
+ public SkyBlockEntityKilled(String id, @Nullable Entity entity) {
this.id = id;
this.entity = entity;
}
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) {