diff --git a/odinmain/src/main/kotlin/me/odinmain/commands/impl/DevCommand.kt b/odinmain/src/main/kotlin/me/odinmain/commands/impl/DevCommand.kt index 6fac7dd68..2776cd62f 100644 --- a/odinmain/src/main/kotlin/me/odinmain/commands/impl/DevCommand.kt +++ b/odinmain/src/main/kotlin/me/odinmain/commands/impl/DevCommand.kt @@ -40,10 +40,8 @@ val devCommand = commodore("oddev") { } } - literal("reset") { - runs { soft: Boolean? -> - WitherDragonsEnum.reset(soft == true) - } + literal("reset").runs { soft: Boolean? -> + WitherDragonsEnum.reset(soft == true) } literal("status").runs { diff --git a/odinmain/src/main/kotlin/me/odinmain/commands/impl/DungeonWaypointCommand.kt b/odinmain/src/main/kotlin/me/odinmain/commands/impl/DungeonWaypointCommand.kt index 935042328..68eb25626 100644 --- a/odinmain/src/main/kotlin/me/odinmain/commands/impl/DungeonWaypointCommand.kt +++ b/odinmain/src/main/kotlin/me/odinmain/commands/impl/DungeonWaypointCommand.kt @@ -28,6 +28,10 @@ val dungeonWaypointsCommand = commodore("dwp", "dungeonwaypoints") { modMessage("Size changed to: ${DungeonWaypoints.size}") } + literal("distance").runs { reach: Int -> + DungeonWaypoints.distance = reach.toDouble() + } + literal("resetsecrets").runs { resetSecrets() modMessage("§aSecrets have been reset!") diff --git a/odinmain/src/main/kotlin/me/odinmain/commands/impl/PosMsgCommand.kt b/odinmain/src/main/kotlin/me/odinmain/commands/impl/PosMsgCommand.kt index ffaf0b847..b989ad7d4 100644 --- a/odinmain/src/main/kotlin/me/odinmain/commands/impl/PosMsgCommand.kt +++ b/odinmain/src/main/kotlin/me/odinmain/commands/impl/PosMsgCommand.kt @@ -17,6 +17,7 @@ val PosMsgCommand = commodore("posmsg") { val saveData = "x: ${x}, y: ${y}, z: ${z}, delay: ${delay}, distance: ${distance}, message: \"${message}\"" if (posMessageStrings.contains(saveData)) return@runs modMessage("This message already exists!") modMessage("Message \"${message}\" added at $x, $y, $z, with ${delay}ms delay, triggered up to $distance blocks away.") + parsedStrings.add(PosMessages.PosMessage(x, y, z, null, null, null, delay, distance, message.string)) posMessageStrings.add(saveData) Config.save() } diff --git a/odinmain/src/main/kotlin/me/odinmain/features/impl/dungeon/BloodCamp.kt b/odinmain/src/main/kotlin/me/odinmain/features/impl/dungeon/BloodCamp.kt index 038fc6a1b..0e05c1efd 100644 --- a/odinmain/src/main/kotlin/me/odinmain/features/impl/dungeon/BloodCamp.kt +++ b/odinmain/src/main/kotlin/me/odinmain/features/impl/dungeon/BloodCamp.kt @@ -28,6 +28,9 @@ import net.minecraftforge.client.event.RenderGameOverlayEvent import net.minecraftforge.client.event.RenderWorldLastEvent import net.minecraftforge.fml.common.eventhandler.SubscribeEvent import java.util.* +import java.util.concurrent.ConcurrentHashMap +import java.util.concurrent.CopyOnWriteArrayList +import java.util.concurrent.CopyOnWriteArraySet import kotlin.math.roundToInt object BloodCamp : Module( @@ -90,17 +93,17 @@ object BloodCamp : Module( private var tickTime: Long = 0 - private val forRender = hashMapOf() + private val forRender = ConcurrentHashMap() private data class RenderEData( var currVector: Vec3, var endVector: Vec3, var endVecUpdated: Long, var speedVectors: Vec3, var lastEndVector: Vec3? = null, var lastPingPoint: Vec3? = null, var lastEndPoint: Vec3? = null, ) - private val entityList = hashMapOf() + private val entityList = ConcurrentHashMap() private data class EntityData(var startVector: Vec3, val started: Long, var firstSpawns: Boolean = true) private var firstSpawns = true - private var watcher = mutableListOf() + private var watcher = CopyOnWriteArrayList() @SubscribeEvent fun onPostMetadata(event: PostEntityMetadata) { @@ -114,9 +117,7 @@ object BloodCamp : Module( private fun onPacketLookMove(packet: S17PacketEntityLookMove) { val entity = packet.getEntity(mc.theWorld) as? EntityArmorStand ?: return - if (!watcher.any { it.getDistanceToEntity(entity) < 20 }) return - - if (entity.getEquipmentInSlot(4)?.item != Items.skull || !allowedMobSkulls.contains(getSkullValue(entity))) return + if (watcher.none { it.getDistanceToEntity(entity) < 20 } || entity.getEquipmentInSlot(4)?.item != Items.skull || !allowedMobSkulls.contains(getSkullValue(entity))) return val packetVector = Vec3( (entity.serverPosX + packet.func_149062_c()) / 32.0, @@ -124,35 +125,33 @@ object BloodCamp : Module( (entity.serverPosZ + packet.func_149064_e()) / 32.0, ) - if (entity !in entityList) entityList[entity] = EntityData(startVector = packetVector, started = tickTime, firstSpawns = firstSpawns) + if (!entityList.containsKey(entity)) entityList[entity] = EntityData(startVector = packetVector, started = tickTime, firstSpawns = firstSpawns) + val data = entityList[entity] ?: return - if (watcher.none { it.getDistanceToEntity(entity) < 20 }) return - entityList[entity]?.let { data -> - val timeTook = tickTime - data.started - val startVector = data.startVector + val timeTook = tickTime - data.started + val startVector = data.startVector - val speedVectors = Vec3( - (packetVector.xCoord - startVector.xCoord) / timeTook, - (packetVector.yCoord - startVector.yCoord) / timeTook, - (packetVector.zCoord - startVector.zCoord) / timeTook, - ) + val speedVectors = Vec3( + (packetVector.xCoord - startVector.xCoord) / timeTook, + (packetVector.yCoord - startVector.yCoord) / timeTook, + (packetVector.zCoord - startVector.zCoord) / timeTook, + ) - val time = getTime(data.firstSpawns, timeTook) + val time = getTime(data.firstSpawns, timeTook) - val endpoint = Vec3( - packetVector.xCoord + speedVectors.xCoord * time, - packetVector.yCoord + speedVectors.yCoord * time, - packetVector.zCoord + speedVectors.zCoord * time, - ) + val endpoint = Vec3( + packetVector.xCoord + speedVectors.xCoord * time, + packetVector.yCoord + speedVectors.yCoord * time, + packetVector.zCoord + speedVectors.zCoord * time, + ) - if (entity !in forRender) forRender[entity] = RenderEData(packetVector, endpoint, tickTime, speedVectors) - else forRender[entity]?.let { - it.lastEndVector = it.endVector.clone() - it.currVector = packetVector - it.endVector = endpoint - it.endVecUpdated = tickTime - it.speedVectors = speedVectors - } + if (!forRender.containsKey(entity)) forRender[entity] = RenderEData(packetVector, endpoint, tickTime, speedVectors) + else forRender[entity]?.let { + it.lastEndVector = it.endVector.clone() + it.currVector = packetVector + it.endVector = endpoint + it.endVecUpdated = tickTime + it.speedVectors = speedVectors } } @@ -167,15 +166,12 @@ object BloodCamp : Module( if (!bloodHelper) return forRender.forEach { (entity, renderData) -> - if (entity.isDead) return@forEach - val entityData = entityList[entity] ?: return@forEach + val (_, started, firstSpawn) = entityList[entity]?.takeUnless { entity.isDead } ?: return@forEach val (currVector, endVector, endVecUpdated, speedVectors) = renderData - val lastEndVector = renderData.lastEndVector ?: return@forEach - val endVectorUpdated = min(tickTime - endVecUpdated, 100) - val endPoint = calcEndVector(endVector, lastEndVector, endVectorUpdated / 100) + val endPoint = calcEndVector(endVector, renderData.lastEndVector, endVectorUpdated / 100) val pingPoint = Vec3( entity.posX + speedVectors.xCoord * averagePing, @@ -193,7 +189,7 @@ object BloodCamp : Module( val pingAABB = AxisAlignedBB(boxSize,boxSize,boxSize, 0.0, 0.0, 0.0).offset(boxOffset + renderPingPoint) val endAABB = AxisAlignedBB(boxSize,boxSize,boxSize, 0.0, 0.0, 0.0).offset(boxOffset + renderEndPoint) - val time = getTime(entityData.firstSpawns, tickTime - entityData.started) + val time = getTime(firstSpawn, tickTime - started) if (averagePing < time) { Renderer.drawBox(pingAABB, mboxColor, fillAlpha = 0f, outlineAlpha = mboxColor.alpha, depth = true) diff --git a/odinmain/src/main/kotlin/me/odinmain/features/impl/dungeon/SecretClicked.kt b/odinmain/src/main/kotlin/me/odinmain/features/impl/dungeon/SecretClicked.kt index 130aaa24b..582455115 100644 --- a/odinmain/src/main/kotlin/me/odinmain/features/impl/dungeon/SecretClicked.kt +++ b/odinmain/src/main/kotlin/me/odinmain/features/impl/dungeon/SecretClicked.kt @@ -34,6 +34,7 @@ object SecretClicked : Module( private val timeToStay by NumberSetting("Time To Stay (seconds)", 7, 1, 60, 1, description = "The time the chests should remain highlighted.").withDependency { boxesDropdown && boxes } private val useRealSize by BooleanSetting("Use Real Size", true, description = "Whether or not to use the real size of the block.").withDependency { boxesDropdown && boxes } private val boxInBoss by BooleanSetting("Box In Boss", false, description = "Highlight clicks in boss.").withDependency { boxesDropdown && boxes } + private val toggleItems by BooleanSetting("Item Boxes", default = true, description = "Render boxes for collected items.").withDependency { boxesDropdown && boxes } private val chimeDropdownSetting by DropdownSetting("Secret Chime Dropdown") private val chime by BooleanSetting("Secret Chime", true, description = "Whether or not to play a sound when a secret is clicked.").withDependency { chimeDropdownSetting } @@ -65,10 +66,10 @@ object SecretClicked : Module( @SubscribeEvent fun onSecret(event: SecretPickupEvent) { - when (event) { - is SecretPickupEvent.Interact -> secretBox(event.blockPos) - is SecretPickupEvent.Bat -> secretBox(event.packet.positionVector.toBlockPos()) - is SecretPickupEvent.Item -> secretBox(event.entity.positionVector.toBlockPos()) + when { + event is SecretPickupEvent.Interact -> secretBox(event.blockPos) + event is SecretPickupEvent.Bat -> secretBox(event.packet.positionVector.toBlockPos()) + event is SecretPickupEvent.Item && toggleItems -> secretBox(event.entity.positionVector.toBlockPos()) } secretChime() } diff --git a/odinmain/src/main/kotlin/me/odinmain/features/impl/dungeon/dungeonwaypoints/DungeonWaypoints.kt b/odinmain/src/main/kotlin/me/odinmain/features/impl/dungeon/dungeonwaypoints/DungeonWaypoints.kt index c386b45dc..7802bc3dd 100644 --- a/odinmain/src/main/kotlin/me/odinmain/features/impl/dungeon/dungeonwaypoints/DungeonWaypoints.kt +++ b/odinmain/src/main/kotlin/me/odinmain/features/impl/dungeon/dungeonwaypoints/DungeonWaypoints.kt @@ -15,12 +15,9 @@ import me.odinmain.features.settings.Setting.Companion.withDependency import me.odinmain.features.settings.impl.* import me.odinmain.ui.clickgui.util.ColorUtil.withAlpha import me.odinmain.utils.* -import me.odinmain.utils.render.Color -import me.odinmain.utils.render.RenderUtils +import me.odinmain.utils.render.* import me.odinmain.utils.render.RenderUtils.outlineBounds import me.odinmain.utils.render.RenderUtils.renderVec -import me.odinmain.utils.render.Renderer -import me.odinmain.utils.render.scale import me.odinmain.utils.skyblock.* import me.odinmain.utils.skyblock.dungeon.DungeonUtils import me.odinmain.utils.skyblock.dungeon.DungeonUtils.getRealCoords @@ -36,10 +33,13 @@ import net.minecraft.network.play.client.C03PacketPlayer.C06PacketPlayerPosLook import net.minecraft.network.play.server.S08PacketPlayerPosLook import net.minecraft.util.AxisAlignedBB import net.minecraft.util.BlockPos +import net.minecraft.util.MovingObjectPosition.MovingObjectType import net.minecraft.util.Vec3 +import net.minecraftforge.client.event.MouseEvent import net.minecraftforge.client.event.RenderGameOverlayEvent import net.minecraftforge.client.event.RenderWorldLastEvent import net.minecraftforge.fml.common.eventhandler.SubscribeEvent +import kotlin.math.sign /** * Custom Waypoints for Dungeons @@ -52,8 +52,8 @@ object DungeonWaypoints : Module( tag = TagType.NEW ) { private var allowEdits by BooleanSetting("Allow Edits", false, description = "Allows you to edit waypoints.") - private var reachEdits by BooleanSetting("Reach Edits", false, description = "Extends the reach of edit mode.").withDependency { allowEdits } - private var reachColor by ColorSetting("Reach Color", default = Color(0, 255, 213, 0.43f), description = "Color of the reach box highlight.", allowAlpha = true).withDependency { reachEdits && allowEdits } + private var allowMidair by BooleanSetting("Allow Midair", default = false, description = "Allows waypoints to be placed midair if they reach the end of distance without hitting a block.").withDependency { allowEdits} + private var reachColor by ColorSetting("Reach Color", default = Color(0, 255, 213, 0.43f), description = "Color of the reach box highlight.", allowAlpha = true).withDependency { allowEdits } private val allowTextEdit by BooleanSetting("Allow Text Edit", true, description = "Allows you to set the text of a waypoint while sneaking.") var editText by BooleanSetting("Edit Text", false, description = "Displays text under your crosshair telling you when you are editing waypoints.") @@ -83,6 +83,16 @@ object DungeonWaypoints : Module( } private val debugWaypoint by BooleanSetting("Debug Waypoint", false, description = "Shows a waypoint in the middle of every extra room.").withDependency { DevPlayers.isDev } + private val selectedColor get() = when (colorPallet) { + 0 -> color + 1 -> Color.CYAN + 2 -> Color.MAGENTA + 3 -> Color.YELLOW + 4 -> Color.GREEN + 5 -> Color.RED + else -> color + } + var glList = -1 var offset = BlockPos(0.0, 0.0, 0.0) @@ -157,10 +167,13 @@ object DungeonWaypoints : Module( if (!allowEdits) SecretWaypoints.onSecret(event) } - private var reachPos: EtherWarpHelper.EtherPos? = null + var distance = 5.0 var lastEtherPos: EtherWarpHelper.EtherPos? = null var lastEtherTime = 0L + private inline val reachPosition: BlockPos? get() = + mc.objectMouseOver?.takeUnless { it.typeOfHit == MovingObjectType.MISS || (distance <= 4.5 && allowMidair) }?.blockPos ?: EtherWarpHelper.getEtherPos(mc.thePlayer.renderVec, mc.thePlayer.rotationYaw, mc.thePlayer.rotationPitch, distance, allowMidair).pos + @SubscribeEvent fun onRender(event: RenderWorldLastEvent) { if ((DungeonUtils.inBoss || !DungeonUtils.inDungeons) && !LocationUtils.currentArea.isArea(Island.SinglePlayer)) return @@ -181,12 +194,10 @@ object DungeonWaypoints : Module( } endProfile() - if (reachEdits && allowEdits) { - reachPos = EtherWarpHelper.getEtherPos(mc.thePlayer.renderVec, mc.thePlayer.rotationYaw, mc.thePlayer.rotationPitch) - reachPos?.pos?.let { - if (useBlockSize) Renderer.drawStyledBlock(it, reachColor, style = if (filled) 0 else 1, 1, !throughWalls) - else Renderer.drawStyledBox(AxisAlignedBB(it.x + 0.5 - (size / 2), it.y + .5 - (size / 2), it.z + .5 - (size / 2), it.x + .5 + (size / 2), it.y + .5 + (size / 2), it.z + .5 + (size / 2)).outlineBounds(), reachColor, style = if (filled) 0 else 1, 1, !throughWalls) - } + + reachPosition?.takeIf { allowEdits }?.let { + if (useBlockSize) Renderer.drawStyledBlock(it, reachColor, style = if (filled) 0 else 1, 1, !throughWalls) + else Renderer.drawStyledBox(AxisAlignedBB(it.x + 0.5, it.y + .5, it.z + .5, it.x + .5, it.y + .5, it.z + .5).outlineBounds(), reachColor, style = if (filled) 0 else 1, 1, !throughWalls) } } @@ -194,13 +205,32 @@ object DungeonWaypoints : Module( fun onRenderOverlay(event: RenderGameOverlayEvent.Post) { if (mc.currentScreen != null || event.type != RenderGameOverlayEvent.ElementType.ALL || !allowEdits || !editText) return val sr = ScaledResolution(mc) - val stats = "type: ${WaypointType.getByInt(waypointType)}, filled: $filled, depth: $throughWalls" + val pos = reachPosition + val (text, editText) = pos?.add(offset)?.let { + val room = DungeonUtils.currentFullRoom ?: return + val vec = room.getRelativeCoords(it.add(offset).toVec3()) + val waypoint = getWaypoints(room).find { it.toVec3().equal(vec) } + + val text = waypoint?.let {"§fType: §5${waypoint.type?.displayName ?: "None"}${waypoint.timer?.let { "§7, §fTimer: §a${it.displayName}" } ?: ""}" } + ?: "§fType: §5${WaypointType.getByInt(waypointType)?.displayName ?: "None"}§7, §r#${selectedColor.hex}§7, ${if (filled) "§2Filled" else "§3Outline"}§7, ${if (throughWalls) "§cThrough Walls§7, " else ""}${if (useBlockSize) "§2Block Size" else "§3Size: $size"}${TimerType.getType()?.let { "§7, §fTimer: §a${it.displayName}" } ?: ""}" + + + text to "§fEditing Waypoints §8|§f ${waypoint?.let { "Viewing" } ?: "Placing"}" + } ?: ("" to "Editing Waypoints") + scale(2f / sr.scaleFactor, 2f / sr.scaleFactor, 1f) - mc.fontRendererObj.drawString("Editing Waypoints", mc.displayWidth / 4 - mc.fontRendererObj.getStringWidth("Editing Waypoints") / 2, mc.displayHeight / 4 + 10, Color.WHITE.withAlpha(.5f).rgba) - mc.fontRendererObj.drawString(stats, mc.displayWidth / 4 - mc.fontRendererObj.getStringWidth(stats) / 2, mc.displayHeight / 4 + 20, Color.WHITE.withAlpha(.5f).rgba) + mcText(editText, mc.displayWidth / 4, mc.displayHeight / 4 + 10, 1f, Color.WHITE.withAlpha(.8f)) + mcText(text,mc.displayWidth / 4, mc.displayHeight / 4 + 20, 1f, selectedColor) scale(sr.scaleFactor / 2f, sr.scaleFactor / 2f, 1f) } + @SubscribeEvent + fun onMouseInput(event: MouseEvent) { + if (!allowEdits || event.dwheel.sign == 0) return + distance = (distance + event.dwheel.sign).coerceIn(0.0, 100.0) + event.isCanceled = true + } + @SubscribeEvent fun onInteract(event: ClickEvent.RightClickEvent) { if (mc.thePlayer.usingEtherWarp) { @@ -215,10 +245,10 @@ object DungeonWaypoints : Module( } } if (!allowEdits) return - val pos = if (!reachEdits) mc.objectMouseOver?.blockPos ?: return else reachPos?.pos ?: return + val pos = reachPosition ?: return val offsetPos = pos.add(offset) offset = BlockPos(0.0, 0.0, 0.0) - if (isAir(offsetPos)) return + if (isAir(offsetPos) && !allowMidair) return val room = DungeonUtils.currentFullRoom ?: return val vec = room.getRelativeCoords(offsetPos.toVec3()) val block = getBlockAt(offsetPos) @@ -231,20 +261,10 @@ object DungeonWaypoints : Module( val type = WaypointType.getByInt(waypointType) val timer = TimerType.getType() - val color = when (colorPallet) { - 0 -> color - 1 -> Color.CYAN - 2 -> Color.MAGENTA - 3 -> Color.YELLOW - 4 -> Color.GREEN - 5 -> Color.RED - else -> color - } - if (allowTextEdit && mc.thePlayer?.isSneaking == true) { GuiSign.setCallback { enteredText -> waypoints.removeIf { it.toVec3().equal(vec) } - waypoints.add(DungeonWaypoint(vec.xCoord, vec.yCoord, vec.zCoord, color.copy(), filled, !throughWalls, aabb, enteredText, type, timer)) + waypoints.add(DungeonWaypoint(vec.xCoord, vec.yCoord, vec.zCoord, selectedColor.copy(), filled, !throughWalls, aabb, enteredText, type, timer)) DungeonWaypointConfig.saveConfig() setWaypoints(room) glList = -1 @@ -253,7 +273,7 @@ object DungeonWaypoints : Module( } else if (waypoints.removeIf { it.toVec3().equal(vec) }) { devMessage("Removed waypoint at $vec") } else { - waypoints.add(DungeonWaypoint(vec.xCoord, vec.yCoord, vec.zCoord, color.copy(), filled, !throughWalls, aabb, type = type, timer = timer)) + waypoints.add(DungeonWaypoint(vec.xCoord, vec.yCoord, vec.zCoord, selectedColor.copy(), filled, !throughWalls, aabb, type = type, timer = timer)) devMessage("Added waypoint at $vec") } DungeonWaypointConfig.saveConfig() diff --git a/odinmain/src/main/kotlin/me/odinmain/features/impl/dungeon/dungeonwaypoints/SecretWaypoints.kt b/odinmain/src/main/kotlin/me/odinmain/features/impl/dungeon/dungeonwaypoints/SecretWaypoints.kt index d49746dc0..1c12b4ca1 100644 --- a/odinmain/src/main/kotlin/me/odinmain/features/impl/dungeon/dungeonwaypoints/SecretWaypoints.kt +++ b/odinmain/src/main/kotlin/me/odinmain/features/impl/dungeon/dungeonwaypoints/SecretWaypoints.kt @@ -87,6 +87,9 @@ object SecretWaypoints { } fun resetSecrets() { + checkpoints = 0 + routeTimer = null + DungeonWaypointConfig.waypoints.entries.forEach { (_, room) -> room.forEach { it.clicked = false } } diff --git a/odinmain/src/main/kotlin/me/odinmain/features/impl/floor7/DragonCheck.kt b/odinmain/src/main/kotlin/me/odinmain/features/impl/floor7/DragonCheck.kt index 56d7eb6f1..d4a440248 100644 --- a/odinmain/src/main/kotlin/me/odinmain/features/impl/floor7/DragonCheck.kt +++ b/odinmain/src/main/kotlin/me/odinmain/features/impl/floor7/DragonCheck.kt @@ -13,25 +13,24 @@ import net.minecraft.network.play.server.S04PacketEntityEquipment import net.minecraft.network.play.server.S0FPacketSpawnMob import net.minecraft.network.play.server.S1CPacketEntityMetadata import net.minecraft.util.Vec3 +import java.util.concurrent.CopyOnWriteArrayList object DragonCheck { var lastDragonDeath: WitherDragonsEnum = WitherDragonsEnum.None - val dragonEntityList = mutableListOf() + val dragonEntityList = CopyOnWriteArrayList() fun dragonUpdate(packet: S1CPacketEntityMetadata) { val dragon = WitherDragonsEnum.entries.find { it.entityId == packet.entityId } ?: return if (dragon.entity == null) return dragon.updateEntity(packet.entityId) val health = packet.func_149376_c().find { it.dataValueId == 6 }?.`object` as? Float ?: return - if (health > 0 || dragon.state == WitherDragonState.DEAD) return - dragon.setDead() + if (health <= 0 && dragon.state != WitherDragonState.DEAD) dragon.setDead() } fun dragonSpawn(packet: S0FPacketSpawnMob) { - val dragon = WitherDragonsEnum.entries - .find { isVecInXZ(Vec3(packet.x / 32.0, packet.y / 32.0, packet.z / 32.0), it.boxesDimensions) } - ?.takeIf { it.state == WitherDragonState.SPAWNING } ?: return - dragon.setAlive(packet.entityID) + WitherDragonsEnum.entries + .find { isVecInXZ(Vec3(packet.x / 32.0, packet.y / 32.0, packet.z / 32.0), it.boxesDimensions) && it.state == WitherDragonState.SPAWNING } + ?.setAlive(packet.entityID) } fun dragonSprayed(packet: S04PacketEntityEquipment) { diff --git a/odinmain/src/main/kotlin/me/odinmain/features/impl/floor7/WitherDragonEnum.kt b/odinmain/src/main/kotlin/me/odinmain/features/impl/floor7/WitherDragonEnum.kt index b157e63db..0348748b2 100644 --- a/odinmain/src/main/kotlin/me/odinmain/features/impl/floor7/WitherDragonEnum.kt +++ b/odinmain/src/main/kotlin/me/odinmain/features/impl/floor7/WitherDragonEnum.kt @@ -83,11 +83,13 @@ enum class WitherDragonsEnum ( entityId = null entity = null lastDragonDeath = this + if (priorityDragon == this) { + if (sendArrowHit && WitherDragons.enabled) arrowDeath(this) + priorityDragon = None + } if (sendTime && WitherDragons.enabled) dragonPBs.time(ordinal, (System.currentTimeMillis() - spawnedTime) / 1000.0, "s§7!", "§${colorCode}${name} §7was alive for §6", addPBString = true, addOldPBString = true) - - if (sendArrowHit && WitherDragons.enabled) arrowDeath(this) } fun updateEntity(entityId: Int) { @@ -157,8 +159,8 @@ fun handleSpawnPacket(particle: S2APacketParticles) { newSpawned to dragons } - if (dragons.isNotEmpty() && (dragons.size == 2 || spawned >= 2)) - priorityDragon = findPriority(dragons).takeIf { it != priorityDragon }?.also { displaySpawningDragon(it) } ?: priorityDragon + if (dragons.isNotEmpty() && (dragons.size == 2 || spawned >= 2) && (priorityDragon == WitherDragonsEnum.None || priorityDragon.entity?.isDead == false)) + priorityDragon = findPriority(dragons).also { displaySpawningDragon(it) } } private fun checkParticle(event: S2APacketParticles, dragon: WitherDragonsEnum): Boolean { diff --git a/odinmain/src/main/kotlin/me/odinmain/features/impl/floor7/WitherDragons.kt b/odinmain/src/main/kotlin/me/odinmain/features/impl/floor7/WitherDragons.kt index b27654251..a8324de4d 100644 --- a/odinmain/src/main/kotlin/me/odinmain/features/impl/floor7/WitherDragons.kt +++ b/odinmain/src/main/kotlin/me/odinmain/features/impl/floor7/WitherDragons.kt @@ -154,9 +154,8 @@ object WitherDragons : Module( } fun arrowDeath(dragon: WitherDragonsEnum) { - if (priorityDragon == WitherDragonsEnum.None || dragon != priorityDragon) return if (!sendArrowHit || System.currentTimeMillis() - dragon.spawnedTime >= dragon.skipKillTime) return - modMessage("§fYou hit §6$arrowsHit §farrows on §${priorityDragon.colorCode}${priorityDragon.name}.") + modMessage("§fYou hit §6$arrowsHit §farrows on §${dragon.colorCode}${dragon.name}.") arrowsHit = 0 } diff --git a/odinmain/src/main/kotlin/me/odinmain/utils/skyblock/EtherWarpHelper.kt b/odinmain/src/main/kotlin/me/odinmain/utils/skyblock/EtherWarpHelper.kt index f316423a9..30199ac4f 100644 --- a/odinmain/src/main/kotlin/me/odinmain/utils/skyblock/EtherWarpHelper.kt +++ b/odinmain/src/main/kotlin/me/odinmain/utils/skyblock/EtherWarpHelper.kt @@ -24,13 +24,13 @@ object EtherWarpHelper { * @param pitch The pitch angle representing the player's vertical viewing direction. * @return An `EtherPos` representing the calculated position in the "ether" or `EtherPos.NONE` if the player is not present. */ - fun getEtherPos(pos: Vec3, yaw: Float, pitch: Float, distance: Double = 60.0): EtherPos { + fun getEtherPos(pos: Vec3, yaw: Float, pitch: Float, distance: Double = 60.0, returnEnd: Boolean = false): EtherPos { mc.thePlayer ?: return EtherPos.NONE val startPos: Vec3 = getPositionEyes(pos) val endPos = getLook(yaw = yaw, pitch = pitch).normalize().multiply(factor = distance).add(startPos) - return traverseVoxels(startPos, endPos) + return traverseVoxels(startPos, endPos).takeUnless { it == EtherPos.NONE && returnEnd } ?: EtherPos(true, endPos.toBlockPos()) } fun getEtherPos(positionLook: PositionLook = PositionLook(mc.thePlayer.renderVec, mc.thePlayer.rotationYaw, mc.thePlayer.rotationPitch), distance: Double = 60.0): EtherPos { diff --git a/odinmain/src/main/kotlin/me/odinmain/utils/skyblock/dungeon/Dungeon.kt b/odinmain/src/main/kotlin/me/odinmain/utils/skyblock/dungeon/Dungeon.kt index 5cfd8fc38..7128bd5e6 100644 --- a/odinmain/src/main/kotlin/me/odinmain/utils/skyblock/dungeon/Dungeon.kt +++ b/odinmain/src/main/kotlin/me/odinmain/utils/skyblock/dungeon/Dungeon.kt @@ -55,8 +55,7 @@ class Dungeon(val floor: Floor) { fun enterDungeonRoom(event: RoomEnterEvent) { val room = event.fullRoom?.takeUnless { room -> passedRooms.any { it.room.data.name == room.room.data.name } } ?: return - val roomSecrets = ScanUtils.getRoomSecrets(room.room.data.name) - dungeonStats.knownSecrets = dungeonStats.knownSecrets?.plus(roomSecrets) ?: roomSecrets + dungeonStats.knownSecrets = dungeonStats.knownSecrets?.plus(room.room.data.secrets) ?: room.room.data.secrets } fun onPacket(event: PacketReceivedEvent) { diff --git a/odinmain/src/main/kotlin/me/odinmain/utils/skyblock/dungeon/ScanUtils.kt b/odinmain/src/main/kotlin/me/odinmain/utils/skyblock/dungeon/ScanUtils.kt index 1f011e618..e9c7ac873 100644 --- a/odinmain/src/main/kotlin/me/odinmain/utils/skyblock/dungeon/ScanUtils.kt +++ b/odinmain/src/main/kotlin/me/odinmain/utils/skyblock/dungeon/ScanUtils.kt @@ -111,9 +111,6 @@ object ScanUtils { private fun scanRoom(vec2: Vec2): Room? = getCore(vec2).let { core -> getRoomData(core)?.let { Room(vec2.x, vec2.z, it, core) } } - fun getRoomSecrets(name: String): Int = - roomList.find { it.name == name }?.secrets ?: 0 - private fun getRoomData(hash: Int): RoomData? = roomList.find { hash in it.cores } diff --git a/odinmain/src/main/resources/rooms.json b/odinmain/src/main/resources/rooms.json index 5b5812e6c..30c78f237 100644 --- a/odinmain/src/main/resources/rooms.json +++ b/odinmain/src/main/resources/rooms.json @@ -1021,7 +1021,8 @@ "name": "Sarcophagus", "type": "NORMAL", "cores": [ - 1986002687 + 1986002687, + 1907859753 ], "crypts": 1, "secrets": 3