diff options
Diffstat (limited to 'src/main/java/me/Danker/features/HighlightSkeletonMasters.java')
-rw-r--r-- | src/main/java/me/Danker/features/HighlightSkeletonMasters.java | 43 |
1 files changed, 43 insertions, 0 deletions
diff --git a/src/main/java/me/Danker/features/HighlightSkeletonMasters.java b/src/main/java/me/Danker/features/HighlightSkeletonMasters.java new file mode 100644 index 0000000..72259db --- /dev/null +++ b/src/main/java/me/Danker/features/HighlightSkeletonMasters.java @@ -0,0 +1,43 @@ +package me.Danker.features; + +import me.Danker.commands.ToggleCommand; +import me.Danker.utils.RenderUtils; +import me.Danker.utils.Utils; +import net.minecraft.entity.Entity; +import net.minecraft.entity.EntityLivingBase; +import net.minecraft.entity.monster.EntitySkeleton; +import net.minecraft.item.ItemStack; +import net.minecraftforge.client.event.RenderLivingEvent; +import net.minecraftforge.client.event.RenderWorldLastEvent; +import net.minecraftforge.fml.common.eventhandler.SubscribeEvent; + +import java.util.ArrayList; +import java.util.List; + +public class HighlightSkeletonMasters { + + static List<Entity> skeletonMasters = new ArrayList<>(); + public static int SKELETON_MASTER_COLOUR; + + @SubscribeEvent + public void onRenderEntity(RenderLivingEvent.Pre<EntityLivingBase> event) { + if (ToggleCommand.highlightSkeletonMasters && event.entity instanceof EntitySkeleton && Utils.inDungeons) { + ItemStack helmet = event.entity.getCurrentArmor(3); + if (helmet != null && helmet.getDisplayName().endsWith("Skeleton Master Helmet")) { + skeletonMasters.add(event.entity); + } + } + } + + @SubscribeEvent + public void onWorldRender(RenderWorldLastEvent event) { + if (ToggleCommand.highlightSkeletonMasters) { + for (Entity skeletonMaster : skeletonMasters) { + if (!skeletonMaster.isDead) + RenderUtils.draw3DBox(skeletonMaster.getEntityBoundingBox(), SKELETON_MASTER_COLOUR, event.partialTicks); + } + skeletonMasters.clear(); + } + } + +} |