Compare commits
No commits in common. "c3f5be60ed36ef322a17899e9abf198e0d848833" and "91d881392edf1c3d93fbaae8bc222033cac6209a" have entirely different histories.
c3f5be60ed
...
91d881392e
@ -1,5 +1,4 @@
|
||||
import org.apache.commons.lang3.SystemUtils
|
||||
import java.util.Properties
|
||||
|
||||
plugins {
|
||||
idea
|
||||
@ -10,24 +9,25 @@ plugins {
|
||||
kotlin("jvm") version "2.0.0"
|
||||
}
|
||||
|
||||
//Constants:
|
||||
|
||||
val baseGroup: String by project
|
||||
val mcVersion: String by project
|
||||
val versionBase: String by project
|
||||
val buildNumber: String by project
|
||||
val modid: String by project
|
||||
val version: String by project
|
||||
val mixinGroup = "$baseGroup.mixin"
|
||||
val modid: String by project
|
||||
|
||||
group = baseGroup
|
||||
version = "$versionBase-b$buildNumber"
|
||||
|
||||
// Toolchains:
|
||||
java {
|
||||
toolchain.languageVersion.set(JavaLanguageVersion.of(8))
|
||||
}
|
||||
|
||||
// Minecraft configuration:
|
||||
loom {
|
||||
log4jConfigs.from(file("log4j2.xml"))
|
||||
launchConfigs {
|
||||
"client" {
|
||||
// If you don't want mixins, remove these lines
|
||||
property("mixin.debug", "true")
|
||||
arg("--tweakClass", "org.spongepowered.asm.launch.MixinTweaker")
|
||||
}
|
||||
@ -35,6 +35,7 @@ loom {
|
||||
runConfigs {
|
||||
"client" {
|
||||
if (SystemUtils.IS_OS_MAC_OSX) {
|
||||
// This argument causes a crash on macOS
|
||||
vmArgs.remove("-XstartOnFirstThread")
|
||||
}
|
||||
}
|
||||
@ -42,8 +43,10 @@ loom {
|
||||
}
|
||||
forge {
|
||||
pack200Provider.set(dev.architectury.pack200.java.Pack200Adapter())
|
||||
// If you don't want mixins, remove this lines
|
||||
mixinConfig("mixins.$modid.json")
|
||||
}
|
||||
// If you don't want mixins, remove these lines
|
||||
mixin {
|
||||
defaultRefmapName.set("mixins.$modid.refmap.json")
|
||||
}
|
||||
@ -59,9 +62,12 @@ sourceSets.main {
|
||||
kotlin.destinationDirectory.set(java.destinationDirectory)
|
||||
}
|
||||
|
||||
// Dependencies:
|
||||
|
||||
repositories {
|
||||
mavenCentral()
|
||||
maven("https://repo.spongepowered.org/maven/")
|
||||
// If you don't want to log in with your real minecraft account, remove this line
|
||||
maven("https://pkgs.dev.azure.com/djtheredstoner/DevAuth/_packaging/public/maven/v1")
|
||||
}
|
||||
|
||||
@ -76,24 +82,30 @@ dependencies {
|
||||
|
||||
shadowImpl(kotlin("stdlib-jdk8"))
|
||||
|
||||
// If you don't want mixins, remove these lines
|
||||
shadowImpl("org.spongepowered:mixin:0.7.11-SNAPSHOT") {
|
||||
isTransitive = false
|
||||
}
|
||||
annotationProcessor("org.spongepowered:mixin:0.8.5-SNAPSHOT")
|
||||
|
||||
// If you don't want to log in with your real minecraft account, remove this line
|
||||
runtimeOnly("me.djtheredstoner:DevAuth-forge-legacy:1.2.1")
|
||||
|
||||
}
|
||||
|
||||
// Tasks:
|
||||
|
||||
tasks.withType(JavaCompile::class) {
|
||||
options.encoding = "UTF-8"
|
||||
}
|
||||
|
||||
tasks.withType(org.gradle.jvm.tasks.Jar::class) {
|
||||
archiveBaseName.set(modid)
|
||||
archiveVersion.set("$version")
|
||||
manifest.attributes.run {
|
||||
this["FMLCorePluginContainsFMLMod"] = "true"
|
||||
this["ForceLoadAsMod"] = "true"
|
||||
|
||||
// If you don't want mixins, remove these lines
|
||||
this["TweakClass"] = "org.spongepowered.asm.launch.MixinTweaker"
|
||||
this["MixinConfigs"] = "mixins.$modid.json"
|
||||
}
|
||||
@ -112,6 +124,7 @@ tasks.processResources {
|
||||
rename("(.+_at.cfg)", "META-INF/$1")
|
||||
}
|
||||
|
||||
|
||||
val remapJar by tasks.named<net.fabricmc.loom.task.RemapJarTask>("remapJar") {
|
||||
archiveClassifier.set("")
|
||||
from(tasks.shadowJar)
|
||||
@ -132,13 +145,12 @@ tasks.shadowJar {
|
||||
println("Copying dependencies into mod: ${it.files}")
|
||||
}
|
||||
}
|
||||
|
||||
// If you want to include other dependencies and shadow them, you can relocate them in here
|
||||
fun relocate(name: String) = relocate(name, "$baseGroup.deps.$name")
|
||||
}
|
||||
|
||||
tasks.assemble {
|
||||
dependsOn(tasks.remapJar)
|
||||
dependsOn("incrementBuildNumber")
|
||||
}
|
||||
tasks.assemble.get().dependsOn(tasks.remapJar)
|
||||
|
||||
tasks.register<Copy>("illyExtractMappings") {
|
||||
from("O:/.gradle")
|
||||
@ -148,6 +160,7 @@ tasks.register<Copy>("illyExtractMappings") {
|
||||
tasks.register("illyApplyMappings") {
|
||||
dependsOn("illyExtractMappings")
|
||||
doLast {
|
||||
// throw GradleException("${layout.buildDirectory.d}/mcp_mappings")
|
||||
val mappingsDir = file("O:/Kotlin Programming/sbt/build/mcp_mappings")
|
||||
if (mappingsDir.exists()) {
|
||||
project.ext.set("mappingsPath", mappingsDir.absolutePath)
|
||||
@ -162,20 +175,4 @@ tasks.withType<JavaCompile> {
|
||||
doLast {
|
||||
options.compilerArgs.add("-Amap=O:/Kotlin Programming/sbt/build/mcp_mappings")
|
||||
}
|
||||
}
|
||||
|
||||
// 🔁 Auto-increment build number each assemble
|
||||
tasks.register("incrementBuildNumber") {
|
||||
doLast {
|
||||
val propsFile = file("gradle.properties")
|
||||
val props = Properties()
|
||||
props.load(propsFile.inputStream())
|
||||
|
||||
val current = props.getProperty("buildNumber")?.toIntOrNull() ?: 1
|
||||
val next = current + 1
|
||||
props.setProperty("buildNumber", next.toString())
|
||||
props.store(propsFile.outputStream(), null)
|
||||
|
||||
println("🔢 Build number incremented to $next")
|
||||
}
|
||||
}
|
||||
}
|
36
cliff.toml
36
cliff.toml
@ -1,36 +0,0 @@
|
||||
# cliff.toml
|
||||
|
||||
[changelog]
|
||||
title = "Changelog"
|
||||
description = "All notable changes to this project will be documented in this file."
|
||||
repository_url = "http://localhost:3001/illyum/sbt-stash"
|
||||
template = """
|
||||
# {{version}} - {{date}}
|
||||
{% for group, commits in commits | group_by(attribute="group") %}
|
||||
### {{group | upper_first}}
|
||||
{% for commit in commits %}
|
||||
- {{ commit.message | upper_first }} ({% if commit.breaking %}! {% endif %}{{ commit.hash }})
|
||||
{% endfor %}
|
||||
{% endfor %}
|
||||
"""
|
||||
|
||||
[git]
|
||||
commit_parsers = [
|
||||
{ message = "^\\(Chore\\)", group = "Chore" },
|
||||
{ message = "^\\(BugFix\\)", group = "Bug Fixes" },
|
||||
{ message = "^\\(Feat\\)", group = "Features" },
|
||||
{ message = "^\\(Docs\\)", group = "Documentation" },
|
||||
{ message = "^\\(Refactor\\)", group = "Refactor" },
|
||||
{ message = "^\\(Test\\)", group = "Tests" },
|
||||
{ message = "^\\(Style\\)", group = "Styling" },
|
||||
{ message = "^\\(Perf\\)", group = "Performance" },
|
||||
]
|
||||
|
||||
[git.tag]
|
||||
pattern = "^v[0-9]+"
|
||||
|
||||
[git.commit]
|
||||
conventional = false
|
||||
|
||||
[git.filters]
|
||||
exclude_merge_commits = true
|
@ -1,8 +1,6 @@
|
||||
#Sun Apr 06 20:00:32 MDT 2025
|
||||
versionBase=1.5.0
|
||||
loom.platform=forge
|
||||
baseGroup=com.github.itzilly.sbt
|
||||
mcVersion=1.8.9
|
||||
org.gradle.jvmargs=-Xmx2g
|
||||
buildNumber=106
|
||||
modid=sbt
|
||||
baseGroup = com.github.itzilly.sbt
|
||||
mcVersion = 1.8.9
|
||||
modid = sbt
|
||||
version = 1.4.4
|
||||
|
@ -7,7 +7,7 @@ pluginManagement {
|
||||
maven("https://maven.fabricmc.net")
|
||||
maven("https://maven.minecraftforge.net/")
|
||||
maven("https://repo.spongepowered.org/maven/")
|
||||
maven("https://repo.essential.gg/repository/maven-releases/")
|
||||
maven("https://repo.sk1er.club/repository/maven-releases/")
|
||||
}
|
||||
resolutionStrategy {
|
||||
eachPlugin {
|
||||
|
@ -12,13 +12,6 @@ object STBKeyBinds {
|
||||
lateinit var findGemstones: KeyBinding
|
||||
lateinit var clearGemstones: KeyBinding
|
||||
|
||||
lateinit var toggleLeftWalk: KeyBinding
|
||||
lateinit var toggleRightWalk: KeyBinding
|
||||
lateinit var toggleForwardWalk: KeyBinding
|
||||
lateinit var toggleBackwardWalk: KeyBinding
|
||||
|
||||
lateinit var toggleLeftMouse: KeyBinding
|
||||
|
||||
fun init() {
|
||||
searchForChests = KeyBinding("key.xraySearch", Keyboard.KEY_F10, "key.categories.sbt")
|
||||
ClientRegistry.registerKeyBinding(searchForChests)
|
||||
@ -37,23 +30,5 @@ object STBKeyBinds {
|
||||
|
||||
clearGemstones = KeyBinding("key.clearGemstones", Keyboard.KEY_K, "key.categories.sbt")
|
||||
ClientRegistry.registerKeyBinding(clearGemstones)
|
||||
|
||||
// -----------------------
|
||||
// Macro Toggle
|
||||
// -----------------------
|
||||
toggleLeftWalk = KeyBinding("key.toggleLeftWalk", Keyboard.KEY_LEFT, "key.categories.sbt")
|
||||
ClientRegistry.registerKeyBinding(toggleLeftWalk)
|
||||
|
||||
toggleRightWalk = KeyBinding("key.toggleRightWalk", Keyboard.KEY_RIGHT, "key.categories.sbt")
|
||||
ClientRegistry.registerKeyBinding(toggleRightWalk)
|
||||
|
||||
toggleForwardWalk = KeyBinding("key.toggleForwardWalk", Keyboard.KEY_UP, "key.categories.sbt")
|
||||
ClientRegistry.registerKeyBinding(toggleForwardWalk)
|
||||
|
||||
toggleBackwardWalk = KeyBinding("key.toggleBackwardWalk", Keyboard.KEY_DOWN, "key.categories.sbt")
|
||||
ClientRegistry.registerKeyBinding(toggleBackwardWalk)
|
||||
|
||||
toggleLeftMouse = KeyBinding("key.toggleLeftMouse", Keyboard.KEY_PRIOR, "key.categories.sbt")
|
||||
ClientRegistry.registerKeyBinding(toggleLeftMouse)
|
||||
}
|
||||
}
|
@ -1,7 +1,6 @@
|
||||
package com.github.itzilly.sbt
|
||||
|
||||
import com.github.itzilly.sbt.features.ChestEsp
|
||||
import com.github.itzilly.sbt.features.FarmHelper
|
||||
import com.github.itzilly.sbt.features.GemstoneFinder
|
||||
import com.github.itzilly.sbt.features.GrottoFinder
|
||||
import com.github.itzilly.sbt.features.router.RouteBuilder
|
||||
@ -42,7 +41,6 @@ class SkyBlockTweaks {
|
||||
MinecraftForge.EVENT_BUS.register(GrottoFinder)
|
||||
MinecraftForge.EVENT_BUS.register(ChestEsp)
|
||||
MinecraftForge.EVENT_BUS.register(GemstoneFinder)
|
||||
MinecraftForge.EVENT_BUS.register(FarmHelper)
|
||||
|
||||
ClientCommandHandler.instance.registerCommand(SBTCommand())
|
||||
}
|
||||
|
@ -1,105 +1,37 @@
|
||||
package com.github.itzilly.sbt.features
|
||||
|
||||
import com.github.itzilly.sbt.STBKeyBinds.toggleLeftWalk;
|
||||
import com.github.itzilly.sbt.features.gardener.CaneMacroer
|
||||
import com.github.itzilly.sbt.util.Chatterbox
|
||||
import net.minecraft.client.Minecraft
|
||||
import net.minecraft.client.gui.Gui
|
||||
import net.minecraft.client.gui.GuiChat
|
||||
import net.minecraftforge.client.event.RenderGameOverlayEvent
|
||||
import net.minecraftforge.common.MinecraftForge
|
||||
import net.minecraftforge.fml.common.eventhandler.SubscribeEvent
|
||||
import net.minecraftforge.fml.common.gameevent.InputEvent
|
||||
import net.minecraftforge.fml.common.gameevent.TickEvent
|
||||
import org.lwjgl.input.Keyboard
|
||||
import net.minecraftforge.fml.common.gameevent.TickEvent.PlayerTickEvent
|
||||
|
||||
|
||||
object FarmHelper {
|
||||
|
||||
private val mc: Minecraft = Minecraft.getMinecraft()
|
||||
|
||||
private var isToggledLeft = false
|
||||
private var isToggledRight = false
|
||||
private var isToggledForward = false
|
||||
private var isToggledBack = false
|
||||
private var isToggledAttack = false
|
||||
|
||||
private var ignoreNextKeyUp = false
|
||||
private var lastToggleKeyCode = -1
|
||||
|
||||
@SubscribeEvent
|
||||
fun onTick(event: TickEvent.ClientTickEvent) {
|
||||
if (mc.gameSettings.keyBindForward.isKeyDown) isToggledForward = false
|
||||
if (mc.gameSettings.keyBindLeft.isKeyDown) isToggledLeft = false
|
||||
if (mc.gameSettings.keyBindRight.isKeyDown) isToggledRight = false
|
||||
if (mc.gameSettings.keyBindBack.isKeyDown) isToggledBack = false
|
||||
if (mc.gameSettings.keyBindAttack.isKeyDown) isToggledAttack = false
|
||||
}
|
||||
|
||||
@SubscribeEvent
|
||||
fun onKeyInput(event: InputEvent.KeyInputEvent) {
|
||||
val key = Keyboard.getEventKey()
|
||||
val isPressed = Keyboard.getEventKeyState()
|
||||
|
||||
if (toggleLeftWalk.isPressed) {
|
||||
Chatterbox.say("Enabled macro!")
|
||||
CaneMacroer.isMacroToggled = true
|
||||
MinecraftForge.EVENT_BUS.register(CaneMacroer)
|
||||
CaneMacroer.mc.displayGuiScreen(GuiChat(""))
|
||||
|
||||
lastToggleKeyCode = key
|
||||
ignoreNextKeyUp = true
|
||||
return
|
||||
}
|
||||
|
||||
if (!isPressed && ignoreNextKeyUp && key == lastToggleKeyCode) {
|
||||
ignoreNextKeyUp = false
|
||||
return
|
||||
}
|
||||
|
||||
if (CaneMacroer.isMacroToggled) {
|
||||
Chatterbox.say("Macro disabled by input!")
|
||||
CaneMacroer.isMacroToggled = false
|
||||
CaneMacroer.stop()
|
||||
MinecraftForge.EVENT_BUS.unregister(CaneMacroer)
|
||||
}
|
||||
|
||||
|
||||
// if (toggleLeftWalk.isPressed) isToggledLeft = !isToggledLeft
|
||||
// if (toggleRightWalk.isPressed) isToggledRight = !isToggledRight
|
||||
// if (toggleForwardWalk.isPressed) isToggledForward = !isToggledForward
|
||||
// if (toggleBackwardWalk.isPressed) isToggledBack = !isToggledBack
|
||||
// if (toggleLeftMouse.isPressed) isToggledAttack = !isToggledAttack
|
||||
// private val mc: Minecraft = Minecraft.getMinecraft()
|
||||
// private var isPressingD = false
|
||||
// private var isPressingMouse = false
|
||||
// @SubscribeEvent
|
||||
// fun onPlayerTick(event: PlayerTickEvent) {
|
||||
// if (event.player === mc.thePlayer) {
|
||||
// if (isPressingD) {
|
||||
// mc.thePlayer.moveStrafing = 1.0f // Simulate holding 'd'
|
||||
// }
|
||||
// if (isPressingMouse) {
|
||||
// mc.gameSettings.keyBindAttack.setPressed(true) // Simulate mouse button down
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
//
|
||||
// if (isToggledLeft) (mc.gameSettings.keyBindLeft as KeyBindingAccessor).setPressed(true)
|
||||
// if (isToggledRight) (mc.gameSettings.keyBindRight as KeyBindingAccessor).setPressed(true)
|
||||
// if (isToggledForward) (mc.gameSettings.keyBindForward as KeyBindingAccessor).setPressed(true)
|
||||
// if (isToggledBack) (mc.gameSettings.keyBindBack as KeyBindingAccessor).setPressed(true)
|
||||
// if (isToggledAttack) (mc.gameSettings.keyBindAttack as KeyBindingAccessor).setPressed(true)
|
||||
}
|
||||
|
||||
@SubscribeEvent
|
||||
fun onRenderOverlay(event: RenderGameOverlayEvent.Text) {
|
||||
val x = 10f
|
||||
var y = 10f
|
||||
|
||||
val toggledKeys = mutableListOf<String>()
|
||||
if (isToggledForward) toggledKeys.add("W")
|
||||
if (isToggledLeft) toggledKeys.add("A")
|
||||
if (isToggledBack) toggledKeys.add("S")
|
||||
if (isToggledRight) toggledKeys.add("D")
|
||||
if (isToggledAttack) toggledKeys.add("Attack")
|
||||
|
||||
if (toggledKeys.isEmpty()) return
|
||||
|
||||
val boxWidth = 60
|
||||
val boxHeight = 10 + toggledKeys.size * 10
|
||||
|
||||
Gui.drawRect((x - 2).toInt(), (y - 2).toInt(), (x + boxWidth).toInt(), (y + boxHeight).toInt(), 0x90000000.toInt())
|
||||
|
||||
for (label in toggledKeys) {
|
||||
mc.fontRendererObj.drawStringWithShadow("[$label]", x, y, 0xFFFFFF)
|
||||
y += 10f
|
||||
}
|
||||
}
|
||||
}
|
||||
// @SubscribeEvent
|
||||
// fun onKeyInput(event: KeyInputEvent) {
|
||||
// if (mc.currentScreen == null) {
|
||||
// if (event.getKey() === GLFW.GLFW_KEY_P && event.getAction() === GLFW.GLFW_PRESS) {
|
||||
// isPressingD = !isPressingD // Toggle 'd' key
|
||||
// }
|
||||
// if (event.getKey() === GLFW.GLFW_KEY_O && event.getAction() === GLFW.GLFW_PRESS) {
|
||||
// isPressingMouse = !isPressingMouse // Toggle mouse button
|
||||
// mc.gameSettings.keyBindAttack.setPressed(isPressingMouse) // Set initial state
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
}
|
@ -1,20 +0,0 @@
|
||||
package com.github.itzilly.sbt.features
|
||||
|
||||
import net.minecraft.client.Minecraft
|
||||
import net.minecraft.client.settings.GameSettings
|
||||
import net.minecraftforge.fml.common.eventhandler.SubscribeEvent
|
||||
import net.minecraftforge.fml.common.gameevent.TickEvent
|
||||
|
||||
object MacroInterface {
|
||||
private val gs: GameSettings = Minecraft.getMinecraft().gameSettings
|
||||
private var running: Boolean = false
|
||||
|
||||
@SubscribeEvent
|
||||
private fun onClientTick(event: TickEvent.PlayerTickEvent) {
|
||||
|
||||
}
|
||||
|
||||
fun stop() {
|
||||
running = false
|
||||
}
|
||||
}
|
@ -1,48 +0,0 @@
|
||||
package com.github.itzilly.sbt.features.gardener
|
||||
|
||||
import com.github.itzilly.sbt.mixin.KeyBindingAccessor
|
||||
import com.github.itzilly.sbt.util.Chatterbox
|
||||
import net.minecraft.client.Minecraft
|
||||
import net.minecraft.client.gui.GuiChat
|
||||
import net.minecraft.client.settings.KeyBinding
|
||||
import net.minecraftforge.fml.common.eventhandler.SubscribeEvent
|
||||
import net.minecraftforge.fml.common.gameevent.TickEvent
|
||||
import net.minecraftforge.fml.common.gameevent.TickEvent.ClientTickEvent
|
||||
|
||||
|
||||
object CaneMacroer {
|
||||
var isMacroToggled: Boolean = false
|
||||
val mc = Minecraft.getMinecraft()
|
||||
var activeKeys: MutableList<KeyBindingAccessor> = mutableListOf()
|
||||
|
||||
@SubscribeEvent
|
||||
fun onTick(event: ClientTickEvent) {
|
||||
if (event.phase != TickEvent.Phase.END) return
|
||||
|
||||
if (!isMacroToggled) return
|
||||
|
||||
val canRunMacro = mc.currentScreen == null || mc.currentScreen is GuiChat
|
||||
if (!canRunMacro) {
|
||||
isMacroToggled = false
|
||||
Chatterbox.say("Disabled macro!")
|
||||
stop()
|
||||
}
|
||||
|
||||
val myKey = mc.gameSettings.keyBindForward as KeyBindingAccessor
|
||||
pressKey(mc.gameSettings.keyBindForward.keyCode)
|
||||
}
|
||||
|
||||
fun stop() {
|
||||
KeyBinding.setKeyBindState(mc.gameSettings.keyBindForward.keyCode, false)
|
||||
KeyBinding.setKeyBindState(mc.gameSettings.keyBindAttack.keyCode, false)
|
||||
}
|
||||
|
||||
// private fun pressKey(key: KeyBindingAccessor) {
|
||||
// key.setPressed(true)
|
||||
// activeKeys.add(key)
|
||||
// }
|
||||
|
||||
private fun pressKey(keyCode: Int) {
|
||||
KeyBinding.setKeyBindState(keyCode, true)
|
||||
}
|
||||
}
|
@ -1,199 +0,0 @@
|
||||
package com.github.itzilly.sbt.features.gardener
|
||||
|
||||
import com.github.itzilly.sbt.util.Chatterbox
|
||||
import net.minecraft.client.gui.*
|
||||
|
||||
class MacroMakerGui : GuiScreen() {
|
||||
private var selectedTaskIndex: Int = -1
|
||||
private var draggedTaskIndex: Int = -1
|
||||
private var dragOffsetY: Int = 0
|
||||
|
||||
private val macro = Macro("Example Macro")
|
||||
|
||||
enum class ButtonId(val id: Int) {
|
||||
SAVE_MACRO(0),
|
||||
CANCEL(1)
|
||||
}
|
||||
|
||||
override fun initGui() {
|
||||
this.buttonList.clear()
|
||||
buttonList.add(GuiButton(ButtonId.SAVE_MACRO.id, width / 2 - 100, height - 40, 90, 20, "Save Macro"))
|
||||
buttonList.add(GuiButton(ButtonId.CANCEL.id, width / 2 + 10, height - 40, 90, 20, "Cancel"))
|
||||
|
||||
macro.tasks.add(MoveTask("W", true))
|
||||
macro.tasks.add(MouseTask("Left Click"))
|
||||
macro.tasks.add(ChatCommandTask("/spawn"))
|
||||
}
|
||||
|
||||
override fun actionPerformed(button: GuiButton) {
|
||||
when (button.id) {
|
||||
ButtonId.SAVE_MACRO.id -> {
|
||||
Chatterbox.say("Saved macro!")
|
||||
Close()
|
||||
}
|
||||
ButtonId.CANCEL.id -> Close()
|
||||
}
|
||||
}
|
||||
|
||||
override fun drawScreen(mouseX: Int, mouseY: Int, partialTicks: Float) {
|
||||
drawDefaultBackground()
|
||||
|
||||
val thirdWidth = width / 3
|
||||
drawRect(0, 0, thirdWidth, height, 0xFF202020.toInt())
|
||||
drawRect(thirdWidth, 0, thirdWidth * 2, height, 0xFF303030.toInt())
|
||||
drawRect(thirdWidth * 2, 0, width, height, 0xFF202020.toInt())
|
||||
|
||||
drawCenteredString(fontRendererObj, "Macro Maker", width / 2, 10, 0xFFFFFF)
|
||||
|
||||
drawLeftPanel(mouseX, mouseY)
|
||||
drawMiddlePanel(mouseX, mouseY)
|
||||
drawRightPanel()
|
||||
|
||||
super.drawScreen(mouseX, mouseY, partialTicks)
|
||||
}
|
||||
|
||||
private fun drawLeftPanel(mouseX: Int, mouseY: Int) {
|
||||
drawString(fontRendererObj, "Editing: ${macro.name}", 10, 20, 0xFFFFFF)
|
||||
drawString(fontRendererObj, "Add Task:", 10, 40, 0xAAAAAA)
|
||||
|
||||
val taskButtons = listOf(
|
||||
Triple("+ Move", 60, { macro.tasks.add(MoveTask("W", false)) }),
|
||||
Triple("+ Mouse", 80, { macro.tasks.add(MouseTask("Right Click")) }),
|
||||
Triple("+ Command", 100, { macro.tasks.add(ChatCommandTask("/say Hello")) })
|
||||
)
|
||||
|
||||
for ((label, y, _) in taskButtons) {
|
||||
drawString(fontRendererObj, label, 10, y, 0x00FF00)
|
||||
}
|
||||
|
||||
if (mouseClickedX in 10..100 && mouseClickedY != -1) {
|
||||
for ((_, y, action) in taskButtons) {
|
||||
if (mouseClickedY in y..(y + 10)) {
|
||||
action.invoke()
|
||||
break
|
||||
}
|
||||
}
|
||||
mouseClickedX = -1
|
||||
mouseClickedY = -1
|
||||
}
|
||||
}
|
||||
|
||||
private fun drawMiddlePanel(mouseX: Int, mouseY: Int) {
|
||||
val thirdWidth = width / 3
|
||||
val taskStartY = 40
|
||||
val taskHeight = 20
|
||||
|
||||
for ((index, task) in macro.tasks.withIndex()) {
|
||||
val y = taskStartY + index * (taskHeight + 5)
|
||||
if (draggedTaskIndex == index) continue // skip rendering the dragged one
|
||||
val color = if (index == selectedTaskIndex) 0xFF4444 else 0xFFFFFF
|
||||
drawRect(thirdWidth + 10, y, thirdWidth * 2 - 10, y + taskHeight, 0xFF404040.toInt())
|
||||
drawString(fontRendererObj, "${task.name} - ${task.getPreview()}", thirdWidth + 15, y + 6, color)
|
||||
}
|
||||
|
||||
// Draw the dragged task following the mouse
|
||||
if (draggedTaskIndex != -1) {
|
||||
val task = macro.tasks[draggedTaskIndex]
|
||||
val y = mouseY - dragOffsetY
|
||||
drawRect(thirdWidth + 10, y, thirdWidth * 2 - 10, y + taskHeight, 0xFF606060.toInt())
|
||||
drawString(fontRendererObj, "${task.name} - ${task.getPreview()}", thirdWidth + 15, y + 6, 0xFFFF00)
|
||||
}
|
||||
}
|
||||
|
||||
private fun drawRightPanel() {
|
||||
val selected = macro.tasks.getOrNull(selectedTaskIndex) ?: return
|
||||
val startX = width - 180
|
||||
val startY = 20
|
||||
val boxWidth = 160
|
||||
val boxHeight = 80
|
||||
|
||||
// Box with outline
|
||||
drawRect(startX - 2, startY - 2, startX + boxWidth + 2, startY + boxHeight + 2, 0xFFFFFFFF.toInt())
|
||||
drawRect(startX, startY, startX + boxWidth, startY + boxHeight, 0xFF101010.toInt())
|
||||
|
||||
drawString(fontRendererObj, "Task Properties", startX + 5, startY + 5, 0xFFFFFF)
|
||||
|
||||
when (selected) {
|
||||
is MoveTask -> {
|
||||
drawString(fontRendererObj, "Direction: ${selected.direction}", startX + 5, startY + 25, 0xCCCCCC)
|
||||
drawString(fontRendererObj, "Hold: ${selected.hold}", startX + 5, startY + 40, 0xCCCCCC)
|
||||
}
|
||||
is MouseTask -> {
|
||||
drawString(fontRendererObj, "Action: ${selected.action}", startX + 5, startY + 25, 0xCCCCCC)
|
||||
}
|
||||
is ChatCommandTask -> {
|
||||
drawString(fontRendererObj, "Command:", startX + 5, startY + 25, 0xCCCCCC)
|
||||
drawString(fontRendererObj, selected.command, startX + 5, startY + 40, 0x00FFAA)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private var mouseClickedX = -1
|
||||
private var mouseClickedY = -1
|
||||
|
||||
override fun mouseClicked(mouseX: Int, mouseY: Int, mouseButton: Int) {
|
||||
mouseClickedX = mouseX
|
||||
mouseClickedY = mouseY
|
||||
|
||||
val thirdWidth = width / 3
|
||||
val taskStartY = 40
|
||||
val taskHeight = 25
|
||||
|
||||
for ((index, _) in macro.tasks.withIndex()) {
|
||||
val y = taskStartY + index * taskHeight
|
||||
if (mouseX in (thirdWidth + 10)..(thirdWidth * 2 - 10) && mouseY in y..(y + 20)) {
|
||||
selectedTaskIndex = index
|
||||
draggedTaskIndex = index
|
||||
dragOffsetY = mouseY - y
|
||||
}
|
||||
}
|
||||
|
||||
super.mouseClicked(mouseX, mouseY, mouseButton)
|
||||
}
|
||||
|
||||
override fun mouseClickMove(mouseX: Int, mouseY: Int, clickedMouseButton: Int, timeSinceLastClick: Long) {
|
||||
super.mouseClickMove(mouseX, mouseY, clickedMouseButton, timeSinceLastClick)
|
||||
}
|
||||
|
||||
override fun mouseReleased(mouseX: Int, mouseY: Int, state: Int) {
|
||||
if (draggedTaskIndex != -1) {
|
||||
val thirdWidth = width / 3
|
||||
val taskStartY = 40
|
||||
val taskHeight = 25
|
||||
val newIndex = ((mouseY - taskStartY) / taskHeight).coerceIn(0, macro.tasks.size - 1)
|
||||
if (newIndex != draggedTaskIndex) {
|
||||
val task = macro.tasks.removeAt(draggedTaskIndex)
|
||||
macro.tasks.add(newIndex, task)
|
||||
selectedTaskIndex = newIndex
|
||||
}
|
||||
draggedTaskIndex = -1
|
||||
}
|
||||
|
||||
super.mouseReleased(mouseX, mouseY, state)
|
||||
}
|
||||
|
||||
fun Close() {
|
||||
mc.displayGuiScreen(null)
|
||||
}
|
||||
}
|
||||
|
||||
sealed class MacroTask(val name: String) {
|
||||
abstract fun getPreview(): String
|
||||
}
|
||||
|
||||
class MoveTask(var direction: String, var hold: Boolean) : MacroTask("Move") {
|
||||
override fun getPreview(): String = if (hold) "Hold $direction" else "Tap $direction"
|
||||
}
|
||||
|
||||
class MouseTask(val action: String) : MacroTask("Mouse") {
|
||||
override fun getPreview(): String = action
|
||||
}
|
||||
|
||||
class ChatCommandTask(var command: String) : MacroTask("Command") {
|
||||
override fun getPreview(): String = command
|
||||
}
|
||||
|
||||
data class Macro(
|
||||
val name: String,
|
||||
val tasks: MutableList<MacroTask> = mutableListOf()
|
||||
)
|
@ -1,11 +0,0 @@
|
||||
package com.github.itzilly.sbt.mixin;
|
||||
|
||||
import net.minecraft.client.settings.KeyBinding;
|
||||
import org.spongepowered.asm.mixin.Mixin;
|
||||
import org.spongepowered.asm.mixin.gen.Accessor;
|
||||
|
||||
@Mixin(KeyBinding.class)
|
||||
public interface KeyBindingAccessor {
|
||||
@Accessor("pressed")
|
||||
void setPressed(boolean pressed);
|
||||
}
|
@ -0,0 +1,16 @@
|
||||
package com.github.itzilly.sbt.mixin;
|
||||
|
||||
import net.minecraft.client.gui.GuiMainMenu;
|
||||
import org.spongepowered.asm.mixin.Mixin;
|
||||
import org.spongepowered.asm.mixin.injection.At;
|
||||
import org.spongepowered.asm.mixin.injection.Inject;
|
||||
import org.spongepowered.asm.mixin.injection.callback.CallbackInfo;
|
||||
|
||||
@Mixin(GuiMainMenu.class)
|
||||
public class MixinGuiMainMenu {
|
||||
|
||||
@Inject(method = "initGui", at = @At("HEAD"))
|
||||
public void onInitGui(CallbackInfo ci) {
|
||||
System.out.println("Hello from Main Menu!");
|
||||
}
|
||||
}
|
@ -1,14 +1,14 @@
|
||||
[
|
||||
{
|
||||
"modid": "${modid}",
|
||||
"name": "SkyBlock Tweaks",
|
||||
"description": "Utilities for making Hypixel Skyblock more bearable",
|
||||
"name": "Xample Mod",
|
||||
"description": "A mod that is used as an example.",
|
||||
"version": "${version}",
|
||||
"mcversion": "${mcversion}",
|
||||
"url": "http://itzilly.com/illyum/illyum/sbt-stash/",
|
||||
"url": "https://github.com/romangraef/Forge1.8.9Template/",
|
||||
"updateUrl": "",
|
||||
"authorList": [
|
||||
"itzilly"
|
||||
"You"
|
||||
],
|
||||
"credits": "",
|
||||
"logoFile": "",
|
||||
|
Loading…
x
Reference in New Issue
Block a user