Skip to content

Commit

Permalink
Merge branch 'main' into mimic-fix
Browse files Browse the repository at this point in the history
  • Loading branch information
odtheking authored Dec 11, 2024
2 parents 2d68cb3 + 8fc8e23 commit 2e8aaaf
Show file tree
Hide file tree
Showing 16 changed files with 77 additions and 95 deletions.
1 change: 1 addition & 0 deletions build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,7 @@ allprojects {
}

loom {
log4jConfigs.from(file("log4j2.xml"))
forge.pack200Provider.set(Pack200Adapter())
}

Expand Down
1 change: 0 additions & 1 deletion odin/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,6 @@ dependencies {
}

loom {
log4jConfigs.from(file("log4j2.xml"))
runConfigs {
getByName("client") {
programArgs("--tweakClass", "gg.essential.loader.stage0.EssentialSetupTweaker")
Expand Down
15 changes: 0 additions & 15 deletions odin/log4j2.xml

This file was deleted.

41 changes: 21 additions & 20 deletions odin/src/main/kotlin/me/odin/features/impl/floor7/p3/SimonSays.kt
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,10 @@ import me.odinmain.events.impl.BlockChangeEvent
import me.odinmain.events.impl.PostEntityMetadata
import me.odinmain.features.Category
import me.odinmain.features.Module
import me.odinmain.features.settings.impl.*
import me.odinmain.features.settings.impl.BooleanSetting
import me.odinmain.features.settings.impl.ColorSetting
import me.odinmain.features.settings.impl.NumberSetting
import me.odinmain.features.settings.impl.SelectorSetting
import me.odinmain.ui.clickgui.util.ColorUtil.withAlpha
import me.odinmain.utils.clock.Clock
import me.odinmain.utils.floor
Expand All @@ -27,36 +30,39 @@ object SimonSays : Module(
description = "Shows a solution for the Simon Says device.",
category = Category.FLOOR7,
) {
private val firstColor by ColorSetting("First Color", Color.GREEN.withAlpha(0.5f), allowAlpha = true, description = "The color of the first button.")
private val secondColor by ColorSetting("Second Color", Color.ORANGE.withAlpha(0.5f), allowAlpha = true, description = "The color of the second button.")
private val thirdColor by ColorSetting("Third Color", Color.RED.withAlpha(0.5f), allowAlpha = true, description = "The color of the buttons after the second.")
private val style by SelectorSetting("Style", Renderer.DEFAULT_STYLE, Renderer.styles, description = Renderer.STYLE_DESCRIPTION)
private val lineWidth by NumberSetting("Line Width", 2f, 0.1f, 10f, 0.1f, description = "The width of the box's lines.")
private val depthCheck by BooleanSetting("Depth check", false, description = "Boxes show through walls.")
private val clearAfter by BooleanSetting("Clear After", false, description = "Clears the clicks when showing next, should work better with ss skip, but will be less consistent.")

private val firstButton = BlockPos(110, 121, 91)
private val clickInOrder = ArrayList<BlockPos>()
private var clickNeeded = 0
private var currentPhase = 0
private val phaseClock = Clock(500)
private var currentPhase = 0
private var clickNeeded = 0

init {
onWorldLoad {
clickInOrder.clear()
clickNeeded = 0
currentPhase = 0
clickNeeded = 0
}
}

@SubscribeEvent
fun onBlockChange(event: BlockChangeEvent) {
if (DungeonUtils.getF7Phase() != M7Phases.P3) return
val state = event.update
val pos = event.pos
val old = event.old
val state = event.update

if (pos == firstButton && state.block == Blocks.stone_button && state.getValue(BlockButtonStone.POWERED)) {
clickInOrder.clear()
clickNeeded = 0
currentPhase = 0
clickNeeded = 0
return
}

Expand All @@ -83,10 +89,8 @@ object SimonSays : Module(

@SubscribeEvent
fun onPostMetadata(event: PostEntityMetadata) {
val entity = mc.theWorld?.getEntityByID(event.packet.entityId) as? EntityItem ?: return
if (Item.getIdFromItem(entity.entityItem.item) != 77) return
val pos = BlockPos(entity.posX.floor().toDouble(), entity.posY.floor().toDouble(), entity.posZ.floor().toDouble()).east()
val index = clickInOrder.indexOf(pos)
val entity = (mc.theWorld?.getEntityByID(event.packet.entityId) as? EntityItem)?.takeIf { Item.getIdFromItem(it.entityItem?.item) == 77 } ?: return
val index = clickInOrder.indexOf(BlockPos(entity.posX.floor(), entity.posY.floor(), entity.posZ.floor()).east())
if (index == 2 && clickInOrder.size == 3) clickInOrder.removeFirst()
else if (index == 0 && clickInOrder.size == 2) clickInOrder.reverse()
}
Expand All @@ -96,16 +100,13 @@ object SimonSays : Module(
if (clickNeeded >= clickInOrder.size) return

for (index in clickNeeded until clickInOrder.size) {
val position = clickInOrder[index]
val x = position.x - .125
val y = position.y + .3125
val z = position.z + .25
val color = when (index) {
clickNeeded -> Color(0, 170, 0)
clickNeeded + 1 -> Color(255, 170, 0)
else -> Color(170, 0, 0)
}.withAlpha(.5f)
Renderer.drawStyledBox(AxisAlignedBB(x, y, z, x + .25, y + .375, z + .5), color, style, lineWidth, depthCheck)
with(clickInOrder[index]) {
Renderer.drawStyledBox(AxisAlignedBB(x + 0.05, y + 0.37, z + 0.3, x - 0.15, y + 0.63, z + 0.7), when (index) {
clickNeeded -> firstColor
clickNeeded + 1 -> secondColor
else -> thirdColor
}, style, lineWidth, depthCheck)
}
}
}
}
7 changes: 5 additions & 2 deletions odin/src/main/kotlin/me/odin/features/impl/render/Camera.kt
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ package me.odin.features.impl.render

import me.odinmain.features.Category
import me.odinmain.features.Module
import me.odinmain.features.settings.Setting.Companion.withDependency
import me.odinmain.features.settings.impl.BooleanSetting
import me.odinmain.features.settings.impl.NumberSetting
import net.minecraftforge.fml.common.eventhandler.SubscribeEvent
Expand All @@ -13,7 +14,8 @@ object Camera : Module(
description = "Allows you to change camera settings."
) {
private val frontCamera by BooleanSetting("No Front Camera", description = "Disables the front camera.")
private val fov by NumberSetting("FOV", mc.gameSettings.fovSetting, 1f, 180f, 1f, description = "Changes the FOV.")
private val customFOV by BooleanSetting("Custom FOV", description = "Allows you to change the FOV.")
private val fov by NumberSetting("FOV", mc.gameSettings.fovSetting, 1f, 180f, 1f, description = "Changes the FOV.").withDependency { customFOV }

private var previousFov = mc.gameSettings.fovSetting

Expand All @@ -29,7 +31,8 @@ object Camera : Module(

@SubscribeEvent
fun onTick(event: TickEvent.ClientTickEvent) {
if (mc.gameSettings.fovSetting != fov)
if (event.phase != TickEvent.Phase.END) return
if (customFOV && mc.gameSettings.fovSetting != fov)
mc.gameSettings.fovSetting = fov

if (frontCamera && mc.gameSettings.thirdPersonView == 2)
Expand Down
1 change: 0 additions & 1 deletion odinclient/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,6 @@ dependencies {
}

loom {
log4jConfigs.from(file("log4j2.xml"))
runConfigs {
getByName("client") {
programArgs("--tweakClass", "gg.essential.loader.stage0.EssentialSetupTweaker")
Expand Down
15 changes: 0 additions & 15 deletions odinclient/log4j2.xml

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -7,19 +7,22 @@ import me.odinmain.features.Category
import me.odinmain.features.Module
import me.odinmain.features.settings.Setting.Companion.withDependency
import me.odinmain.features.settings.impl.BooleanSetting
import me.odinmain.features.settings.impl.ColorSetting
import me.odinmain.features.settings.impl.NumberSetting
import me.odinmain.features.settings.impl.SelectorSetting
import me.odinmain.ui.clickgui.util.ColorUtil.withAlpha
import me.odinmain.utils.*
import me.odinmain.utils.clock.Clock
import me.odinmain.utils.render.Color
import me.odinmain.utils.render.Renderer
import me.odinmain.utils.skyblock.*
import me.odinmain.utils.skyblock.devMessage
import me.odinmain.utils.skyblock.dungeon.DungeonUtils
import me.odinmain.utils.skyblock.dungeon.M7Phases
import me.odinmain.utils.skyblock.getBlockIdAt
import me.odinmain.utils.skyblock.modMessage
import net.minecraft.block.BlockButtonStone
import net.minecraft.entity.item.EntityItem
import net.minecraft.init.Blocks
import net.minecraft.item.Item
import net.minecraft.util.AxisAlignedBB
import net.minecraft.util.BlockPos
import net.minecraft.util.Vec3
Expand All @@ -33,6 +36,12 @@ object SimonSays : Module(
category = Category.FLOOR7,
tag = TagType.RISKY
) {
private val firstColor by ColorSetting("First Color", Color.GREEN.withAlpha(0.5f), allowAlpha = true, description = "The color of the first button.")
private val secondColor by ColorSetting("Second Color", Color.ORANGE.withAlpha(0.5f), allowAlpha = true, description = "The color of the second button.")
private val thirdColor by ColorSetting("Third Color", Color.RED.withAlpha(0.5f), allowAlpha = true, description = "The color of the buttons after the second.")
private val style by SelectorSetting("Style", Renderer.DEFAULT_STYLE, Renderer.styles, description = Renderer.STYLE_DESCRIPTION)
private val lineWidth by NumberSetting("Line Width", 2f, 0.1f, 10f, 0.1f, description = "The width of the box's lines.")
private val depthCheck by BooleanSetting("Depth check", false, description = "Boxes show through walls.")
private val start by BooleanSetting("Start", default = true, description = "Automatically starts the device when it can be started.")
private val startClicks by NumberSetting("Start Clicks", 3, 1, 10, description = "Amount of clicks to start the device.").withDependency { start }
private val startClickDelay by NumberSetting("Start Click Delay", 3, 1, 5, description = "Delay between each start click.").withDependency { start }
Expand Down Expand Up @@ -83,9 +92,9 @@ object SimonSays : Module(
@SubscribeEvent
fun onBlockChange(event: BlockChangeEvent) {
if (DungeonUtils.getF7Phase() != M7Phases.P3) return
val state = event.update
val pos = event.pos
val old = event.old
val state = event.update

if (pos == firstButton && state.block == Blocks.stone_button && state.getValue(BlockButtonStone.POWERED)) {
clickInOrder.clear()
Expand Down Expand Up @@ -118,8 +127,7 @@ object SimonSays : Module(
@SubscribeEvent
fun onPostMetadata(event: PostEntityMetadata) {
val entity = mc.theWorld?.getEntityByID(event.packet.entityId) as? EntityItem ?: return
if (Item.getIdFromItem(entity.entityItem.item) != 77) return
val index = clickInOrder.indexOf(BlockPos(entity.posX.floor().toDouble(), entity.posY.floor().toDouble(), entity.posZ.floor().toDouble()).east())
val index = clickInOrder.indexOf(BlockPos(entity.posX.floor(), entity.posY.floor(), entity.posZ.floor()).east())
if (index == 2 && clickInOrder.size == 3) clickInOrder.removeFirst()
else if (index == 0 && clickInOrder.size == 2) clickInOrder.reverse()
}
Expand All @@ -130,12 +138,12 @@ object SimonSays : Module(
if (clickInOrder[clickNeeded] != pos.east()) return
if (clickNeeded == 0) { // Stops spamming the first button and breaking the puzzle.
if (!firstClickClock.hasTimePassed()) return
rightClick()
firstClickClock.update()
rightClick()
return
}
rightClick()
triggerBotClock.update()
rightClick()
}

private fun autoSS() {
Expand All @@ -155,15 +163,14 @@ object SimonSays : Module(
!autoSSLastClickClock.hasTimePassed()
) return

val buttonToClick = clickInOrder[clickNeeded]
if (getBlockIdAt(buttonToClick.west()) != 77) return
val buttonToClick = clickInOrder[clickNeeded].takeIf { getBlockIdAt(it.west()) == 77 } ?: return
val (_, yaw, pitch) = getDirectionToVec3(buttonToClick.toVec3().addVec(x = -0.1, y = .5, z = .5))
autoSSClickInQueue = true
smoothRotateTo(yaw, pitch, autoSSRotateTime) {
if (clickNeeded == 4) autoSSLastClickClock.update()
rightClick()
autoSSClock.update()
autoSSClickInQueue = false
autoSSClock.update()
rightClick()
}
}

Expand All @@ -189,16 +196,13 @@ object SimonSays : Module(
if (triggerBot) triggerBot()

for (index in clickNeeded until clickInOrder.size) {
val pos = clickInOrder[index]
val x = pos.x - .125
val y = pos.y + .3125
val z = pos.z + .25
val color = when (index) {
clickNeeded -> Color(0, 170, 0)
clickNeeded + 1 -> Color(255, 170, 0)
else -> Color(170, 0, 0)
}.withAlpha(.5f)
Renderer.drawBox(AxisAlignedBB(x, y, z, x + .25, y + .375, z + .5), color, outlineAlpha = 1f, fillAlpha = 0.6f)
with(clickInOrder[index]) {
Renderer.drawStyledBox(AxisAlignedBB(x + 0.05, y + 0.37, z + 0.3, x - 0.15, y + 0.63, z + 0.7), when (index) {
clickNeeded -> firstColor
clickNeeded + 1 -> secondColor
else -> thirdColor
}, style, lineWidth, depthCheck)
}
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,8 @@ object Camera : Module(
private val frontCamera by BooleanSetting("No Front Camera", false, description = "Disables front camera.")
private val cameraClip by BooleanSetting("Camera Clip", false, description = "Allows the camera to clip through blocks.")
private val cameraDist by NumberSetting("Distance", 4f, 3.0, 12.0, 0.1, description = "The distance of the camera from the player.")
private val fov by NumberSetting("FOV", mc.gameSettings.fovSetting, 1f, 180f, 1f, description = "The field of view of the camera.")
private val customFOV by BooleanSetting("Custom FOV", description = "Allows you to change the FOV.")
private val fov by NumberSetting("FOV", mc.gameSettings.fovSetting, 1f, 180f, 1f, description = "The field of view of the camera.").withDependency { customFOV }
private val freelookDropdown by DropdownSetting("Freelook")
private val toggle by BooleanSetting("Type", false, description = "The type of freelook (Hold/Toggle).").withDependency { freelookDropdown }
private val freelookKeybind by KeybindSetting("Freelook Key", Keyboard.KEY_NONE, description = "Keybind to toggle/ hold for freelook.")
Expand Down Expand Up @@ -64,7 +65,8 @@ object Camera : Module(

@SubscribeEvent
fun onTick(event: TickEvent.ClientTickEvent) {
if (mc.gameSettings.fovSetting != fov)
if (event.phase != TickEvent.Phase.END) return
if (customFOV && mc.gameSettings.fovSetting != fov)
mc.gameSettings.fovSetting = fov

if (frontCamera && mc.gameSettings.thirdPersonView == 2)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -94,9 +94,9 @@ object ChocolateFactory : Module(
var maxValue = 0
repeat (7) {
val worker = workers[it]
if (worker.contains("climbed as far")) return
val index = worker.indexOfFirst { it?.contains("Cost") == true } ?: return
val cost = worker[index + 1]?.noControlCodes?.replace(Regex("\\D"), "")?.toIntOrNull() ?: return
if (worker.contains("climbed as far")) return@repeat
val index = worker.indexOfFirst { it?.contains("Cost") == true }.takeIf { workerIndex -> workerIndex != -1 } ?: return@repeat
val cost = worker[index + 1]?.noControlCodes?.replace(Regex("\\D"), "")?.toIntOrNull() ?: return@repeat
val value = cost / (it + 1).toFloat()
if (value < maxValue || !found) {
bestWorker = 28 + it
Expand Down
2 changes: 1 addition & 1 deletion src/main/kotlin/me/odinmain/commands/impl/DevCommand.kt
Original file line number Diff line number Diff line change
Expand Up @@ -162,7 +162,7 @@ val devCommand = commodore("oddev") {
"""
${getChatBreak()}
Middle: $block
Relative Coords: ${DungeonUtils.currentRoom?.getRelativeCoords(block.toVec3())?.toString()}
Relative Coords: ${DungeonUtils.currentRoom?.getRelativeCoords(block)?.toString()}
${getChatBreak()}
""".trimIndent(), "")
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ object TerracottaTimer : Module(

@SubscribeEvent
fun onBlockPacket(event: BlockChangeEvent) {
if (DungeonUtils.isFloor(6) && DungeonUtils.inBoss && event.update.block.isFlowerPot && !terracottaSpawning.any { it.pos.equal(event.pos.toVec3().addVec(0.5, 1.5, 0.5)) })
if (DungeonUtils.isFloor(6) && DungeonUtils.inBoss && event.update.block.isFlowerPot && terracottaSpawning.none { it.pos.equal(event.pos.toVec3().addVec(0.5, 1.5, 0.5)) })
terracottaSpawning.add(Terracotta(event.pos.toVec3().addVec(0.5, 1.5, 0.5), if (DungeonUtils.floor.isMM) 12.0 else 15.0))
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -40,8 +40,8 @@ object BlazeSolver {
blazes.removeAll { mc.theWorld?.getEntityByID(it.entityId) == null }
if (blazes.isEmpty() && lastBlazeCount == 1) {
LocationUtils.currentDungeon?.puzzles?.find { it.name == Puzzle.Blaze.name }?.status = PuzzleStatus.Completed
if (blazeSendComplete) partyMessage("Blaze puzzle solved!")
onPuzzleComplete(if (DungeonUtils.currentRoomName == "Higher Blaze") "Higher Blaze" else "Lower Blaze")
if (blazeSendComplete) partyMessage("Blaze puzzle solved!")
lastBlazeCount = 0
return
}
Expand Down
Loading

0 comments on commit 2e8aaaf

Please sign in to comment.