aboutsummaryrefslogtreecommitdiff
path: root/src/main
diff options
context:
space:
mode:
authorMy-Name-Is-Jeff <37018278+My-Name-Is-Jeff@users.noreply.github.com>2021-09-18 12:51:29 -0400
committerMy-Name-Is-Jeff <37018278+My-Name-Is-Jeff@users.noreply.github.com>2021-09-18 12:51:29 -0400
commitf9226946737829db33920fb0695e80e42347fa2d (patch)
tree398acbfec2feea8f35cab077978f81107f98852c /src/main
parent622866fd7c528199520cd64dcdc670e3962ccfdd (diff)
downloadSkytilsMod-f9226946737829db33920fb0695e80e42347fa2d.tar.gz
SkytilsMod-f9226946737829db33920fb0695e80e42347fa2d.tar.bz2
SkytilsMod-f9226946737829db33920fb0695e80e42347fa2d.zip
some random glyph detection that im not going to test
Diffstat (limited to 'src/main')
-rw-r--r--src/main/kotlin/skytils/skytilsmod/core/Config.kt8
-rw-r--r--src/main/kotlin/skytils/skytilsmod/features/impl/misc/SlayerFeatures.kt53
2 files changed, 53 insertions, 8 deletions
diff --git a/src/main/kotlin/skytils/skytilsmod/core/Config.kt b/src/main/kotlin/skytils/skytilsmod/core/Config.kt
index 247e71a3..7e6a8513 100644
--- a/src/main/kotlin/skytils/skytilsmod/core/Config.kt
+++ b/src/main/kotlin/skytils/skytilsmod/core/Config.kt
@@ -1708,6 +1708,14 @@ object Config : Vigilant(File("./config/skytils/config.toml"), "Skytils", sortin
)
var showSeraphDisplay = false
+
+ @Property(
+ PropertyType.SWITCH, name = "Experimental Yang Glyph Detection",
+ description = "Testing new detection for Yang Glyphs. Give us feedback on Discord!",
+ category = "Slayer", subcategory = "Voidgloom Seraph"
+ )
+ var experimentalYangGlyphDetection = false
+
@Property(
PropertyType.SWITCH, name = "Yang Glyph Ping",
description = "Alerts you when the Voidgloom Seraph throws down a Yang Glyph(beacon).",
diff --git a/src/main/kotlin/skytils/skytilsmod/features/impl/misc/SlayerFeatures.kt b/src/main/kotlin/skytils/skytilsmod/features/impl/misc/SlayerFeatures.kt
index ac819246..ca4e2bfa 100644
--- a/src/main/kotlin/skytils/skytilsmod/features/impl/misc/SlayerFeatures.kt
+++ b/src/main/kotlin/skytils/skytilsmod/features/impl/misc/SlayerFeatures.kt
@@ -22,7 +22,6 @@ import gg.essential.elementa.utils.withAlpha
import gg.essential.universal.UResolution
import net.minecraft.block.*
import net.minecraft.block.state.IBlockState
-import net.minecraft.client.Minecraft
import net.minecraft.client.renderer.GlStateManager
import net.minecraft.client.renderer.Tessellator
import net.minecraft.client.renderer.vertex.DefaultVertexFormats
@@ -56,6 +55,7 @@ import net.minecraftforge.fml.common.gameevent.TickEvent
import net.minecraftforge.fml.common.gameevent.TickEvent.ClientTickEvent
import org.lwjgl.opengl.GL11
import skytils.skytilsmod.Skytils
+import skytils.skytilsmod.Skytils.Companion.mc
import skytils.skytilsmod.core.GuiManager
import skytils.skytilsmod.core.GuiManager.Companion.createTitle
import skytils.skytilsmod.core.TickTask
@@ -76,6 +76,7 @@ import skytils.skytilsmod.utils.graphics.ScreenRenderer
import skytils.skytilsmod.utils.graphics.SmartFontRenderer
import skytils.skytilsmod.utils.graphics.colors.CommonColors
import java.awt.Color
+import kotlin.math.abs
import kotlin.math.floor
@@ -93,6 +94,28 @@ class SlayerFeatures {
?: ""
expectedMaxHp = BossHealths["Voidgloom"]?.get(currentTier)?.asInt
}
+ if (lastYangGlyphSwitchTicks >= 0) lastYangGlyphSwitchTicks++
+ if (Skytils.config.experimentalYangGlyphDetection && yangGlyphEntity == null && yangGlyph == null && slayerEntity != null) {
+ val suspect = mc.theWorld.getEntitiesWithinAABB(
+ EntityArmorStand::class.java,
+ slayerEntity!!.entityBoundingBox.expand(20.69, 20.69, 20.69)
+ ) { e ->
+ e as EntityArmorStand
+ e.ticksExisted <= 300 && lastYangGlyphSwitchTicks + 5 > e.ticksExisted && e.inventory[4]?.item == Item.getItemFromBlock(
+ Blocks.beacon
+ )
+ }.minByOrNull { abs(lastYangGlyphSwitchTicks - it.ticksExisted) + slayerEntity!!.getDistanceSqToEntity(it) }
+ if (suspect != null) {
+ printDevMessage(
+ "Found suspect glyph, ${lastYangGlyphSwitchTicks} switched, ${suspect.ticksExisted} existed, ${
+ slayerEntity!!.getDistanceSqToEntity(
+ suspect
+ )
+ } distance", "slayer", "seraph", "seraphGlyph"
+ )
+ yangGlyphEntity = suspect
+ }
+ }
if (ticks % 4 == 0) {
if (Skytils.config.rev5TNTPing) {
if (hasSlayerText) {
@@ -241,6 +264,7 @@ class SlayerFeatures {
.and(4095) == 0
) {
lastYangGlyphSwitch = System.currentTimeMillis()
+ lastYangGlyphSwitchTicks = 0
thrownBoundingBox = entityBoundingBox
createTitle("§cYang Glyph!", 30)
}
@@ -293,12 +317,22 @@ class SlayerFeatures {
return
}
if (slayerEntity == null) return
- if (yangGlyphEntity != null) {
- printDevMessage("Glyph Entity exists", "slayer", "seraph", "seraphGlyph")
- if (event.update.block is BlockBeacon && yangGlyphEntity!!.position.distanceSq(event.pos) < 9) {
- printDevMessage("Beacon entity near beacon block!", "slayer", "seraph", "seraphGlyph")
- yangGlyph = event.pos
- yangGlyphEntity = null
+ if (event.update.block is BlockBeacon) {
+ if (yangGlyphEntity != null) {
+ printDevMessage("Glyph Entity exists", "slayer", "seraph", "seraphGlyph")
+ if (event.update.block is BlockBeacon && yangGlyphEntity!!.position.distanceSq(event.pos) <= 3.5 * 3.5) {
+ printDevMessage("Beacon entity near beacon block!", "slayer", "seraph", "seraphGlyph")
+ yangGlyph = event.pos
+ yangGlyphEntity = null
+ }
+ }
+ if (Skytils.config.experimentalYangGlyphDetection && yangGlyph == null && slayerEntity != null) {
+ if (lastYangGlyphSwitchTicks <= 5 && slayerEntity!!.getDistanceSq(event.pos) <= 5 * 5) {
+ printDevMessage(
+ "Beacon was close to slayer, $lastYangGlyphSwitchTicks", "slayer", "seraph", "seraphGlyph"
+ )
+ yangGlyph = event.pos
+ }
}
}
}
@@ -370,6 +404,7 @@ class SlayerFeatures {
)
yangGlyphEntity = e
lastYangGlyphSwitch = -1L
+ lastYangGlyphSwitchTicks = -1
}
} else if (e.entityBoundingBox.expand(2.0, 3.0, 2.0)
.intersectsWith(slayerEntity!!.entityBoundingBox)
@@ -538,6 +573,8 @@ class SlayerFeatures {
}
slayerEntity = null
nukekebiHeads.clear()
+ lastYangGlyphSwitch = -1L
+ lastYangGlyphSwitchTicks = -1
}
}
}
@@ -803,7 +840,6 @@ class SlayerFeatures {
}
companion object {
- private val mc = Minecraft.getMinecraft()
private var ticks = 0
private val ZOMBIE_MINIBOSSES = arrayOf(
"§cRevenant Sycophant",
@@ -826,6 +862,7 @@ class SlayerFeatures {
private val hitMap = HashMap<EntityEnderman, Int>()
var yangGlyph: BlockPos? = null
var lastYangGlyphSwitch: Long = -1L
+ var lastYangGlyphSwitchTicks = -1
var thrownBoundingBox: AxisAlignedBB? = null
private val nukekebiHeads = arrayListOf<EntityArmorStand>()
var BossHealths = HashMap<String, JsonObject>()