diff options
author | ThatGravyBoat <thatgravyboat@gmail.com> | 2021-07-11 18:57:24 -0230 |
---|---|---|
committer | ThatGravyBoat <thatgravyboat@gmail.com> | 2021-07-11 18:57:24 -0230 |
commit | 3a1917c8a0af4157cc1e6d5f3986e89377f245d8 (patch) | |
tree | 0a25fdc3ad1fc48da3f0d06c501f772ac9cfc353 /src/main/java/com/thatgravyboat/skyblockhud/api/sbentities | |
parent | 5a98a98dfc0009599b90280ae3a1f166de21e6e8 (diff) | |
download | SkyblockHud-Death-Defied-3a1917c8a0af4157cc1e6d5f3986e89377f245d8.tar.gz SkyblockHud-Death-Defied-3a1917c8a0af4157cc1e6d5f3986e89377f245d8.tar.bz2 SkyblockHud-Death-Defied-3a1917c8a0af4157cc1e6d5f3986e89377f245d8.zip |
Added Mining Overlay including drill bar and heat bar
Added mana cost display
Update Location Stuff
Added new mining events
stopped scoreboard logging spam
removed missing location logging as hypixel dumb and sends the wrong thing once and a while causing it to log useless stuff.
Added DEV Commands
Diffstat (limited to 'src/main/java/com/thatgravyboat/skyblockhud/api/sbentities')
3 files changed, 75 insertions, 0 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 new file mode 100644 index 0000000..d1ad8d2 --- /dev/null +++ b/src/main/java/com/thatgravyboat/skyblockhud/api/sbentities/EntityTypeHelper.java @@ -0,0 +1,21 @@ +package com.thatgravyboat.skyblockhud.api.sbentities; + +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.init.Blocks; + +public class EntityTypeHelper { + + public static boolean isZealot(Entity entity) { + if (entity instanceof EntityEnderman) { + EntityEnderman enderman = ((EntityEnderman) entity); + double maxHealthBase = enderman.getAttributeMap().getAttributeInstanceByName("generic.maxHealth").getBaseValue(); + if (maxHealthBase == 13000 || (maxHealthBase == 2000d && enderman.getHeldBlockState().getBlock().equals(Blocks.end_portal_frame))) { + return LocationHandler.getCurrentLocation().equals(Locations.DRAGONSNEST); + } + } + 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 new file mode 100644 index 0000000..995bc9b --- /dev/null +++ b/src/main/java/com/thatgravyboat/skyblockhud/api/sbentities/EntityTypeRegistry.java @@ -0,0 +1,26 @@ +package com.thatgravyboat.skyblockhud.api.sbentities; + +import com.google.common.collect.ImmutableList; +import com.google.common.collect.Maps; +import net.minecraft.entity.Entity; +import net.minecraft.entity.monster.EntityEnderman; + +import java.util.List; +import java.util.Map; + +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))); + } + + public static String getEntityId(Entity entity) { + if (!entities.containsKey(entity.getClass())) return null; + for (SkyBlockEntity skyBlockEntity : entities.get(entity.getClass())) { + if (skyBlockEntity.isEntity(entity)) return skyBlockEntity.getName(); + } + return null; + } +} diff --git a/src/main/java/com/thatgravyboat/skyblockhud/api/sbentities/SkyBlockEntity.java b/src/main/java/com/thatgravyboat/skyblockhud/api/sbentities/SkyBlockEntity.java new file mode 100644 index 0000000..78b48df --- /dev/null +++ b/src/main/java/com/thatgravyboat/skyblockhud/api/sbentities/SkyBlockEntity.java @@ -0,0 +1,28 @@ +package com.thatgravyboat.skyblockhud.api.sbentities; + +import net.minecraft.entity.Entity; + +import java.util.function.Predicate; + +public class SkyBlockEntity { + + private final String name; + private final Predicate<Entity> predicate; + + public static SkyBlockEntity of(String name, Predicate<Entity> predicate) { + return new SkyBlockEntity(name, predicate); + } + + private SkyBlockEntity(String name, Predicate<Entity> predicate) { + this.name = name; + this.predicate = predicate; + } + + public String getName() { + return name; + } + + public boolean isEntity(Entity entity) { + return predicate.test(entity); + } +} |