aboutsummaryrefslogtreecommitdiff
path: root/src/main/kotlin
diff options
context:
space:
mode:
authoringlettronald <inglettronald@gmail.com>2023-05-03 02:35:33 -0500
committeringlettronald <inglettronald@gmail.com>2023-05-03 02:35:33 -0500
commit8022824961f4735730bc0041eb47b86addd6ed03 (patch)
treebc4404e287963a50f1a1f5125a31b3abe0d5fa66 /src/main/kotlin
parent160688c66622fdbbd8a42b72ead4206e21391719 (diff)
downloadDulkirMod-8022824961f4735730bc0041eb47b86addd6ed03.tar.gz
DulkirMod-8022824961f4735730bc0041eb47b86addd6ed03.tar.bz2
DulkirMod-8022824961f4735730bc0041eb47b86addd6ed03.zip
Blaze Slayer feature addition
Diffstat (limited to 'src/main/kotlin')
-rw-r--r--src/main/kotlin/dulkirmod/DulkirMod.kt7
-rw-r--r--src/main/kotlin/dulkirmod/config/DulkirConfig.kt16
-rw-r--r--src/main/kotlin/dulkirmod/events/Events.kt2
-rw-r--r--src/main/kotlin/dulkirmod/features/BlazeSlayerFeatures.kt56
-rw-r--r--src/main/kotlin/dulkirmod/utils/WorldRenderUtils.kt8
5 files changed, 84 insertions, 5 deletions
diff --git a/src/main/kotlin/dulkirmod/DulkirMod.kt b/src/main/kotlin/dulkirmod/DulkirMod.kt
index d9aaf53..91335f9 100644
--- a/src/main/kotlin/dulkirmod/DulkirMod.kt
+++ b/src/main/kotlin/dulkirmod/DulkirMod.kt
@@ -5,10 +5,7 @@ import dulkirmod.config.DulkirConfig
import dulkirmod.events.ChatEvent
import dulkirmod.features.*
import dulkirmod.features.chat.AbiphoneDND
-import dulkirmod.utils.ContainerNameUtil
-import dulkirmod.utils.TabListUtils
-import dulkirmod.utils.TextUtils
-import dulkirmod.utils.TitleUtils
+import dulkirmod.utils.*
import kotlinx.coroutines.CoroutineScope
import kotlinx.coroutines.Dispatchers
import kotlinx.coroutines.launch
@@ -80,6 +77,8 @@ class DulkirMod {
mcBus.register(DragonFeatures)
mcBus.register(HideHealerFairy)
mcBus.register(SecretSounds)
+ mcBus.register(BlazeSlayerFeatures)
+ mcBus.register(WorldRenderUtils)
keyBinds.forEach(ClientRegistry::registerKeyBinding)
}
diff --git a/src/main/kotlin/dulkirmod/config/DulkirConfig.kt b/src/main/kotlin/dulkirmod/config/DulkirConfig.kt
index 7318f98..760ba91 100644
--- a/src/main/kotlin/dulkirmod/config/DulkirConfig.kt
+++ b/src/main/kotlin/dulkirmod/config/DulkirConfig.kt
@@ -85,6 +85,22 @@ object DulkirConfig : Config(Mod("DulkirMod", ModType.SKYBLOCK), "dulkirmod-conf
var tooltipSize = 1f
@Switch(
+ name = "Highlight Blaze slayer Minibosses",
+ description = "HITBOXES!",
+ category = "General",
+ subcategory = "Nether"
+ )
+ var minibossHitbox = false
+
+ @Switch(
+ name = "Blaze Slayer Attunement Display",
+ description = "Shows a hit-box to indicate what dagger you should use",
+ category = "General",
+ subcategory = "Nether"
+ )
+ var attunementDisplay = false
+
+ @Switch(
name = "Hide Healer fairy",
description = "Now only runs in dungeons lol",
category = "Dungeons",
diff --git a/src/main/kotlin/dulkirmod/events/Events.kt b/src/main/kotlin/dulkirmod/events/Events.kt
index 45cc8ff..af6c02a 100644
--- a/src/main/kotlin/dulkirmod/events/Events.kt
+++ b/src/main/kotlin/dulkirmod/events/Events.kt
@@ -6,4 +6,4 @@ import net.minecraftforge.fml.common.eventhandler.Event
/**
* Fired when an entity is removed from the world.
*/
-class EntityRemovedEvent(val entity: Entity) : Event() \ No newline at end of file
+class EntityRemovedEvent(val entity: Entity) : Event()
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
diff --git a/src/main/kotlin/dulkirmod/utils/WorldRenderUtils.kt b/src/main/kotlin/dulkirmod/utils/WorldRenderUtils.kt
index 231ab3f..f49ed2c 100644
--- a/src/main/kotlin/dulkirmod/utils/WorldRenderUtils.kt
+++ b/src/main/kotlin/dulkirmod/utils/WorldRenderUtils.kt
@@ -9,6 +9,8 @@ import net.minecraft.client.renderer.WorldRenderer
import net.minecraft.client.renderer.entity.RenderManager
import net.minecraft.client.renderer.vertex.DefaultVertexFormats
import net.minecraft.util.Vec3
+import net.minecraftforge.client.event.RenderWorldLastEvent
+import net.minecraftforge.fml.common.eventhandler.SubscribeEvent
import org.lwjgl.opengl.GL11
import java.awt.Color
@@ -20,6 +22,7 @@ class WorldRenderUtils {
private val tessellator: Tessellator = Tessellator.getInstance()
private val worldRenderer: WorldRenderer = tessellator.worldRenderer
private val renderManager: RenderManager = mc.renderManager
+ var partialTicks: Float = 0f
fun renderString(
location: Vec3,
text: String,
@@ -172,5 +175,10 @@ class WorldRenderUtils {
GlStateManager.popMatrix()
}
+
+ @SubscribeEvent
+ fun grabPartialTicks(event: RenderWorldLastEvent) {
+ this.partialTicks = event.partialTicks
+ }
}
} \ No newline at end of file