From 8022824961f4735730bc0041eb47b86addd6ed03 Mon Sep 17 00:00:00 2001 From: inglettronald Date: Wed, 3 May 2023 02:35:33 -0500 Subject: Blaze Slayer feature addition --- .../dulkirmod/features/BlazeSlayerFeatures.kt | 56 ++++++++++++++++++++++ 1 file changed, 56 insertions(+) create mode 100644 src/main/kotlin/dulkirmod/features/BlazeSlayerFeatures.kt (limited to 'src/main/kotlin/dulkirmod/features/BlazeSlayerFeatures.kt') diff --git a/src/main/kotlin/dulkirmod/features/BlazeSlayerFeatures.kt b/src/main/kotlin/dulkirmod/features/BlazeSlayerFeatures.kt new file mode 100644 index 0000000..9ad1597 --- /dev/null +++ b/src/main/kotlin/dulkirmod/features/BlazeSlayerFeatures.kt @@ -0,0 +1,56 @@ +package dulkirmod.features + +import dulkirmod.config.DulkirConfig +import dulkirmod.utils.TabListUtils +import dulkirmod.utils.Utils +import dulkirmod.utils.WorldRenderUtils +import net.minecraft.entity.item.EntityArmorStand +import net.minecraftforge.client.event.RenderLivingEvent +import net.minecraftforge.fml.common.eventhandler.SubscribeEvent +import java.awt.Color + +object BlazeSlayerFeatures { + + private val minibosses = "(Flare Demon)|(Kindleheart Demon)|(Burningsoul Demon)|(Smoldering Blaze)".toRegex() + + @SubscribeEvent + fun onRenderLiving(event: RenderLivingEvent.Post<*>) { + if (!(DulkirConfig.attunementDisplay || DulkirConfig.minibossHitbox)) return + if (TabListUtils.area != "Crimson Isle") return + + if (DulkirConfig.attunementDisplay) { + if (event.entity is EntityArmorStand && event.entity.hasCustomName()) { + val name = Utils.stripColorCodes(event.entity.customNameTag) + val x = event.entity.lastTickPosX + (event.entity.posX - event.entity.lastTickPosX) * WorldRenderUtils.partialTicks + val y = event.entity.lastTickPosY + (event.entity.posY - event.entity.lastTickPosY) * WorldRenderUtils.partialTicks + val z = event.entity.lastTickPosZ + (event.entity.posZ - event.entity.lastTickPosZ) * WorldRenderUtils.partialTicks + when { + name.contains("CRYSTAL ♨") -> { + WorldRenderUtils.drawCustomBox(x -.5, 1.0, y -2, 1.5, z -.5, 1.0, Color(15, 247, 236, 255), 3f, phase = false) + } + name.contains("ASHEN ♨") -> { + WorldRenderUtils.drawCustomBox(x -.5, 1.0, y -2, 1.5, z -.5, 1.0, Color(84, 84, 84, 255), 3f, phase = false) + } + name.contains("AURIC ♨") -> { + WorldRenderUtils.drawCustomBox(x -.5, 1.0, y -2, 1.5, z -.5, 1.0, Color(206, 219, 57, 255), 3f, phase = false) + } + name.contains("SPIRIT ♨") -> { + WorldRenderUtils.drawCustomBox(x -.5, 1.0, y -2, 1.5, z -.5, 1.0, Color(255, 255, 255, 255), 3f, phase = false) + } + } + } + } + + if (DulkirConfig.minibossHitbox) { + if (event.entity is EntityArmorStand && event.entity.hasCustomName()) { + val name = Utils.stripColorCodes(event.entity.customNameTag) + val x = event.entity.lastTickPosX + (event.entity.posX - event.entity.lastTickPosX) * WorldRenderUtils.partialTicks + val y = event.entity.lastTickPosY + (event.entity.posY - event.entity.lastTickPosY) * WorldRenderUtils.partialTicks + val z = event.entity.lastTickPosZ + (event.entity.posZ - event.entity.lastTickPosZ) * WorldRenderUtils.partialTicks + if (name.contains(minibosses)) { + WorldRenderUtils.drawCustomBox(x-.5, 1.0, y - 1.5, 1.5, z-.5, 1.0, Color(7, 227, 21, 255), 3f, phase = false) + } + } + } + } +} \ No newline at end of file -- cgit