Compare commits

...

20 Commits

Author SHA1 Message Date
1eb2e5ee6c No idea what this is 2025-04-22 00:15:58 -06:00
b6c4223da5 Update build 2025-04-22 00:15:04 -06:00
e10f66a0c0 Try to get things working 2025-04-22 00:12:59 -06:00
c3f5be60ed chore: add changelog gen settings 2025-04-09 13:25:14 -06:00
3373405b9c feat: add base for farmer feature 2025-04-09 13:24:43 -06:00
13e816401b chore: cleanup old settings from template 2025-04-09 13:24:11 -06:00
82c40c3047 build: auto increment jar build names 2025-04-09 13:23:41 -06:00
91d881392e Delete .kotlin/errors/errors-1721778737330.log 2024-08-23 07:34:52 -06:00
illyum
89dcc87487 docs: add CONTRIBUTING.md and developer notice 2024-08-23 07:34:18 -06:00
illyum
3ed286c0f9 (Chore): Version Bump to 1.4.4 2024-08-23 06:47:30 -06:00
illyum
ebfbd6fc74 (BugFix): Fix powder chest being registered while in opening animation 2024-08-23 06:47:05 -06:00
illyum
9749a3199a (BugFix): Recheck chest locations to remove ghost chest highlights 2024-08-22 13:13:08 -06:00
illyum
fab0790e58 (Chore): Bump version to 1.4.3 2024-08-22 12:54:24 -06:00
illyum
98eb315142 (BugFix): Fixes powder chest click not being detected correctly 2024-08-22 12:53:56 -06:00
illyum
ed04c31578 (Chore): Bump version 2024-08-19 19:06:19 -06:00
illyum
7aff986e3c (Chore): Update readme to explain config and commands 2024-08-19 19:05:49 -06:00
illyum
043aab18dd Merge #1 2024-08-19 19:03:32 -06:00
illyum
1db0e3b7a4 (Chore): Fix conflict? 2024-08-19 19:02:12 -06:00
illyum
3b8d715efb so try to group hitboxes but I'm doing something wront. this doesn't work 2024-08-12 16:36:50 -06:00
illyum
d7a5a2913e Make the gem finder mesh all hitboxes into 1 big hitbox 2024-08-12 16:24:47 -06:00
22 changed files with 830 additions and 191 deletions

View File

@ -1,73 +0,0 @@
kotlin version: 2.0.0
error message: Daemon compilation failed: null
java.lang.Exception
at org.jetbrains.kotlin.daemon.common.CompileService$CallResult$Error.get(CompileService.kt:69)
at org.jetbrains.kotlin.daemon.common.CompileService$CallResult$Error.get(CompileService.kt:65)
at org.jetbrains.kotlin.compilerRunner.GradleKotlinCompilerWork.compileWithDaemon(GradleKotlinCompilerWork.kt:240)
at org.jetbrains.kotlin.compilerRunner.GradleKotlinCompilerWork.compileWithDaemonOrFallbackImpl(GradleKotlinCompilerWork.kt:159)
at org.jetbrains.kotlin.compilerRunner.GradleKotlinCompilerWork.run(GradleKotlinCompilerWork.kt:111)
at org.jetbrains.kotlin.compilerRunner.GradleCompilerRunnerWithWorkers$GradleKotlinCompilerWorkAction.execute(GradleCompilerRunnerWithWorkers.kt:76)
at org.gradle.workers.internal.DefaultWorkerServer.execute(DefaultWorkerServer.java:63)
at org.gradle.workers.internal.NoIsolationWorkerFactory$1$1.create(NoIsolationWorkerFactory.java:66)
at org.gradle.workers.internal.NoIsolationWorkerFactory$1$1.create(NoIsolationWorkerFactory.java:62)
at org.gradle.internal.classloader.ClassLoaderUtils.executeInClassloader(ClassLoaderUtils.java:100)
at org.gradle.workers.internal.NoIsolationWorkerFactory$1.lambda$execute$0(NoIsolationWorkerFactory.java:62)
at org.gradle.workers.internal.AbstractWorker$1.call(AbstractWorker.java:44)
at org.gradle.workers.internal.AbstractWorker$1.call(AbstractWorker.java:41)
at org.gradle.internal.operations.DefaultBuildOperationRunner$CallableBuildOperationWorker.execute(DefaultBuildOperationRunner.java:209)
at org.gradle.internal.operations.DefaultBuildOperationRunner$CallableBuildOperationWorker.execute(DefaultBuildOperationRunner.java:204)
at org.gradle.internal.operations.DefaultBuildOperationRunner$2.execute(DefaultBuildOperationRunner.java:66)
at org.gradle.internal.operations.DefaultBuildOperationRunner$2.execute(DefaultBuildOperationRunner.java:59)
at org.gradle.internal.operations.DefaultBuildOperationRunner.execute(DefaultBuildOperationRunner.java:166)
at org.gradle.internal.operations.DefaultBuildOperationRunner.execute(DefaultBuildOperationRunner.java:59)
at org.gradle.internal.operations.DefaultBuildOperationRunner.call(DefaultBuildOperationRunner.java:53)
at org.gradle.workers.internal.AbstractWorker.executeWrappedInBuildOperation(AbstractWorker.java:41)
at org.gradle.workers.internal.NoIsolationWorkerFactory$1.execute(NoIsolationWorkerFactory.java:59)
at org.gradle.workers.internal.DefaultWorkerExecutor.lambda$submitWork$0(DefaultWorkerExecutor.java:174)
at java.base/java.util.concurrent.FutureTask.run(FutureTask.java:264)
at org.gradle.internal.work.DefaultConditionalExecutionQueue$ExecutionRunner.runExecution(DefaultConditionalExecutionQueue.java:187)
at org.gradle.internal.work.DefaultConditionalExecutionQueue$ExecutionRunner.access$700(DefaultConditionalExecutionQueue.java:120)
at org.gradle.internal.work.DefaultConditionalExecutionQueue$ExecutionRunner$1.run(DefaultConditionalExecutionQueue.java:162)
at org.gradle.internal.Factories$1.create(Factories.java:31)
at org.gradle.internal.work.DefaultWorkerLeaseService.withLocks(DefaultWorkerLeaseService.java:264)
at org.gradle.internal.work.DefaultWorkerLeaseService.runAsWorkerThread(DefaultWorkerLeaseService.java:128)
at org.gradle.internal.work.DefaultWorkerLeaseService.runAsWorkerThread(DefaultWorkerLeaseService.java:133)
at org.gradle.internal.work.DefaultConditionalExecutionQueue$ExecutionRunner.runBatch(DefaultConditionalExecutionQueue.java:157)
at org.gradle.internal.work.DefaultConditionalExecutionQueue$ExecutionRunner.run(DefaultConditionalExecutionQueue.java:126)
at java.base/java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:539)
at java.base/java.util.concurrent.FutureTask.run(FutureTask.java:264)
at org.gradle.internal.concurrent.ExecutorPolicy$CatchAndRecordFailures.onExecute(ExecutorPolicy.java:64)
at org.gradle.internal.concurrent.AbstractManagedExecutor$1.run(AbstractManagedExecutor.java:47)
at java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1136)
at java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:635)
at java.base/java.lang.Thread.run(Thread.java:833)
Caused by: java.nio.file.NoSuchFileException: C:\Users\illyum\AppData\Local\Temp\kotlin-backups14211537242402827334\7.backup -> O:\Kotlin Programming\sbt\build\classes\java\main\com\github\itzilly\sbt\KeyInputHandler.class
at java.base/sun.nio.fs.WindowsException.translateToIOException(WindowsException.java:85)
at java.base/sun.nio.fs.WindowsException.rethrowAsIOException(WindowsException.java:103)
at java.base/sun.nio.fs.WindowsFileCopy.move(WindowsFileCopy.java:403)
at java.base/sun.nio.fs.WindowsFileSystemProvider.move(WindowsFileSystemProvider.java:293)
at java.base/java.nio.file.Files.move(Files.java:1432)
at org.jetbrains.kotlin.incremental.RecoverableCompilationTransaction.revertChanges(CompilationTransaction.kt:231)
at org.jetbrains.kotlin.incremental.RecoverableCompilationTransaction.close(CompilationTransaction.kt:256)
at org.jetbrains.kotlin.incremental.IncrementalCompilerRunner.tryCompileIncrementally(IncrementalCompilerRunner.kt:747)
at org.jetbrains.kotlin.incremental.IncrementalCompilerRunner.compile(IncrementalCompilerRunner.kt:120)
at org.jetbrains.kotlin.daemon.CompileServiceImplBase.execIncrementalCompiler(CompileServiceImpl.kt:676)
at org.jetbrains.kotlin.daemon.CompileServiceImplBase.access$execIncrementalCompiler(CompileServiceImpl.kt:92)
at org.jetbrains.kotlin.daemon.CompileServiceImpl.compile(CompileServiceImpl.kt:1661)
at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:77)
at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.base/java.lang.reflect.Method.invoke(Method.java:568)
at java.rmi/sun.rmi.server.UnicastServerRef.dispatch(UnicastServerRef.java:360)
at java.rmi/sun.rmi.transport.Transport$1.run(Transport.java:200)
at java.rmi/sun.rmi.transport.Transport$1.run(Transport.java:197)
at java.base/java.security.AccessController.doPrivileged(AccessController.java:712)
at java.rmi/sun.rmi.transport.Transport.serviceCall(Transport.java:196)
at java.rmi/sun.rmi.transport.tcp.TCPTransport.handleMessages(TCPTransport.java:587)
at java.rmi/sun.rmi.transport.tcp.TCPTransport$ConnectionHandler.run0(TCPTransport.java:828)
at java.rmi/sun.rmi.transport.tcp.TCPTransport$ConnectionHandler.lambda$run$0(TCPTransport.java:705)
at java.base/java.security.AccessController.doPrivileged(AccessController.java:399)
at java.rmi/sun.rmi.transport.tcp.TCPTransport$ConnectionHandler.run(TCPTransport.java:704)
... 3 more

10
CHANGELOG.md Normal file
View File

@ -0,0 +1,10 @@
## [1.4.0] - 2024-07-23
### Chore
- Remove comments
### Feat
- *(chestesp)* Add initial implementation, halfway done

View File

@ -7,3 +7,10 @@ My QOL mod for Hypixel Skyblock
- Gemstone Finder
- Powder ChestESP
- Route Builder
## Config
You can configure the gemstone search radius, and also toggle the powder chest esp
## Commands:
- /sbt gemstonesearchradius <number>
- /sbt powderchest [disable/enable]

View File

@ -1,4 +1,5 @@
import org.apache.commons.lang3.SystemUtils
import java.util.Properties
plugins {
idea
@ -9,25 +10,24 @@ plugins {
kotlin("jvm") version "2.0.0"
}
//Constants:
val baseGroup: String by project
val mcVersion: String by project
val version: String by project
val mixinGroup = "$baseGroup.mixin"
val versionBase: String by project
val buildNumber: String by project
val modid: String by project
val mixinGroup = "$baseGroup.mixin"
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,7 +35,6 @@ loom {
runConfigs {
"client" {
if (SystemUtils.IS_OS_MAC_OSX) {
// This argument causes a crash on macOS
vmArgs.remove("-XstartOnFirstThread")
}
}
@ -43,10 +42,8 @@ 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")
}
@ -62,12 +59,9 @@ 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")
}
@ -82,30 +76,24 @@ 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"
}
@ -124,7 +112,6 @@ tasks.processResources {
rename("(.+_at.cfg)", "META-INF/$1")
}
val remapJar by tasks.named<net.fabricmc.loom.task.RemapJarTask>("remapJar") {
archiveClassifier.set("")
from(tasks.shadowJar)
@ -145,12 +132,13 @@ 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.get().dependsOn(tasks.remapJar)
tasks.assemble {
dependsOn(tasks.remapJar)
dependsOn("incrementBuildNumber")
}
tasks.register<Copy>("illyExtractMappings") {
from("O:/.gradle")
@ -160,7 +148,6 @@ 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)
@ -176,3 +163,19 @@ tasks.withType<JavaCompile> {
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 Normal file
View File

@ -0,0 +1,36 @@
# 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

33
docs/CONTRIBUTING.md Normal file
View File

@ -0,0 +1,33 @@
# Contributing to This Project
Thank you for your interest in contributing to this project! Please read the following guidelines to understand how you can contribute.
## Private Repository
This is a **private repository**. While you're welcome to file issues and suggest ideas, please note that this project is primarily a personal endeavor. Contributions from the community are appreciated, but they might not always be incorporated.
## Filing Issues
If you encounter any issues or have suggestions for improvements, feel free to [open an issue](https://github.com/your-repo/issues) (or email me). Please be as detailed as possible when describing the problem or idea. I appreciate your input!
## Contributing Fixes
If you have a fix that you'd like to contribute:
- Please do **not** submit a pull request directly.
- Instead, email the developer at [developer@itzilly.com](mailto:developer@itzilly.com) with details about your fix.
- If the fix aligns with the project's goals and standards, you'll receive guidance on how to proceed.
## Suggesting Ideas
I welcome ideas and suggestions! However, please keep in mind:
- This project is more of a personal project, so while all ideas are welcome, not every suggestion will be implemented.
- Feel free to suggest ideas by [opening an issue](https://github.com/404) and detailing your thoughts.
## Code of Conduct
Please remember to be respectful and constructive when engaging with this project. At the end of the day, this is just my project.
Thank you for your understanding and for contributing to this project!
# Note for persons with a Gitea account
If you have access to an account with elevated permissions on this repo, you're welcome to commit code/make pull requests.

55
docs/DEVELOPER_NOTICE.md Normal file
View File

@ -0,0 +1,55 @@
# Developer Notice
Welcome to my project! This is primarily a personal project, and while I'm happy to have others take an interest, it's important to follow the guidelines below to ensure consistency and maintainability. (This is mostly for my reference)
## Conventional Commits
I use [Conventional Commits](https://www.conventionalcommits.org/) for all commit messages. This means that every commit should follow this format:
```
<type>(<scope>): <description>
```
- **Type:** The type of change you're committing. Common types include `feat` (new feature), `fix` (bug fix), `docs` (documentation only changes), `style` (code style, formatting, etc.), `refactor` (refactoring code), `test` (adding or updating tests), and `chore` (other changes that don't modify src or test files).
- **Scope:** An optional field that describes the part of the codebase the change affects (e.g., `api`, `config`, `ui`).
- **Description:** A brief description of the change.
Example commit message:
```
feat(api): add new endpoint for user data
```
```
chore(release): bump version to 1.4.3
```
```
style(ui): clean up redundant CSS classes in header component
```
```
fix(auth): resolve login redirect loop issue
```
```
merge(pr-45): integrate feature-x from pull request #45
```
## Branching Strategy
Branches are primarily for adding new features. However, while the project is in pre-release, it's okay to work on minor features directly on the `main` branch. Just make sure you:
- Commit all changes for the feature at once.
- Avoid having partial changes spread across multiple commits. Each commit should represent a complete and functional piece of work.
## Versioning
The versioning scheme I use is simple:
- **Patch version:** Bumped when small, incremental changes or bug fixes are made. For example, `x.x.y` to `x.x.y + 1`.
- **Minor version:** Typically, if a feature is added or updated, the version may stay the same until the project exits pre-release. Version `2.x.x` will be used if the project ever gets out of pre-release.
- **Major version:** Reserved for significant changes, like command updates, configuration overhauls, or substantial new features.
Remember, this is my project, so while I'm open to contributions and suggestions, I maintain the final say on what gets merged or included. Thanks for your understanding and contributions!

View File

@ -1,6 +1,8 @@
#Sat Apr 19 14:54:37 MDT 2025
versionBase=1.5.0
loom.platform=forge
org.gradle.jvmargs=-Xmx2g
baseGroup=com.github.itzilly.sbt
mcVersion=1.8.9
org.gradle.jvmargs=-Xmx2g
buildNumber=107
modid=sbt
version = 1.4.1

View File

@ -7,7 +7,7 @@ pluginManagement {
maven("https://maven.fabricmc.net")
maven("https://maven.minecraftforge.net/")
maven("https://repo.spongepowered.org/maven/")
maven("https://repo.sk1er.club/repository/maven-releases/")
maven("https://repo.essential.gg/repository/maven-releases/")
}
resolutionStrategy {
eachPlugin {

View File

@ -12,6 +12,13 @@ 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)
@ -30,5 +37,23 @@ 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)
}
}

View File

@ -1,6 +1,7 @@
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
@ -41,6 +42,7 @@ 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())
}

View File

@ -13,6 +13,7 @@ import net.minecraft.client.renderer.GlStateManager
import net.minecraft.init.Blocks
import net.minecraft.util.BlockPos
import net.minecraft.entity.Entity
import net.minecraft.tileentity.TileEntityChest
import net.minecraft.util.AxisAlignedBB
import net.minecraft.util.MovingObjectPosition
import net.minecraftforge.client.event.ClientChatReceivedEvent
@ -60,29 +61,20 @@ object ChestEsp {
fun rightClickEvent(event: PlayerInteractEvent) {
if (!enabled) return
if (event.action == PlayerInteractEvent.Action.RIGHT_CLICK_BLOCK) {
val player = event.entityPlayer
val reachDistance = 5.0
val eyePosition = player.getPositionEyes(1.0f)
val lookVec = player.getLook(1.0f)
val reachVec = eyePosition.addVector(
lookVec.xCoord * reachDistance,
lookVec.yCoord * reachDistance,
lookVec.zCoord * reachDistance
)
val rayTraceResult = event.world.rayTraceBlocks(eyePosition, reachVec, false, false, false)
if (rayTraceResult != null && rayTraceResult.typeOfHit == MovingObjectPosition.MovingObjectType.BLOCK) {
val pos = rayTraceResult.blockPos
val x = pos.x
val y = pos.y
val z = pos.z
if (chestNodeExists(x, y, z)) {
chestList.removeIf { it.x == x && it.y == y && it.z == z }
val pos = event.pos
if (chestNodeExists(pos.x, pos.y, pos.z)) {
chestList.removeIf { it.x == pos.x && it.y == pos.y && it.z == pos.z }
checkChestLocations()
}
}
}
fun checkChestLocations() {
for (chest in chestList) {
if (chestNodeExists(chest.x, chest.y, chest.z)) {
chestList.removeIf { it.x == chest.x && it.y == chest.y && it.z == chest.z }
}
}
}
fun highlightChests() {
@ -107,6 +99,9 @@ object ChestEsp {
for (z in boundZMin.toInt()..boundZMax.toInt()) {
val block = world.getBlockState(BlockPos(x, y, z)).block
if (block == Blocks.chest || block == Blocks.trapped_chest || block == Blocks.ender_chest) {
val tileEntity = world.getTileEntity(BlockPos(x, y, z))
if (tileEntity is TileEntityChest) {
if (tileEntity.numPlayersUsing != 0) {
val point = ChestNode(x, y, z)
if (!chestNodeExists(x, y, z)) {
chestList.add(point)
@ -116,6 +111,9 @@ object ChestEsp {
}
}
}
}
checkChestLocations()
}
private fun drawChestOutline(entity: Entity, blockPos: BlockPos, partialTicks: Float) {

View File

@ -1,37 +1,105 @@
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.TickEvent.PlayerTickEvent
import net.minecraftforge.fml.common.gameevent.InputEvent
import net.minecraftforge.fml.common.gameevent.TickEvent
import org.lwjgl.input.Keyboard
object FarmHelper {
// 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
// }
// }
// }
//
// @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
// }
// }
// }
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
//
// 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
}
}
}

View File

@ -18,13 +18,13 @@ enum class GemstoneColors(val color: Int) {
TOPAZ(0xFFFF55), // Yellow
JASPER(0xFF55FF) // Magenta
}
object GemstoneFinder {
private var gemstoneClusters: ArrayList<GemstoneCluster> = ArrayList()
private var gemstoneList: ArrayList<GemstoneBlock> = ArrayList()
var radius = SkyBlockTweaks.config.getCategory(Configuration.CATEGORY_GENERAL)?.get("gemstonesearchradius")?.int?: 16
fun clear() {
gemstoneList.clear()
gemstoneClusters.clear()
}
fun find() {
@ -43,11 +43,12 @@ object GemstoneFinder {
)
val world = Minecraft.getMinecraft().thePlayer.worldObj
val gemstonesMap = mutableMapOf<GemstoneColors, MutableList<BlockPos>>()
for (chunkX in minBounds.x / 16..maxBounds.x / 16) {
for (chunkZ in minBounds.z / 16..maxBounds.z / 16) {
val chunk = world.getChunkFromChunkCoords(chunkX, chunkZ)
// Iterate through the chunk's blocks within the world bounds
for (x in 0..15) {
for (y in minBounds.y..maxBounds.y) {
for (z in 0..15) {
@ -58,7 +59,7 @@ object GemstoneFinder {
val blockPos = BlockPos(worldX, y, worldZ)
val blockState = chunk.getBlockState(blockPos)
val block = blockState.block
if (block == Blocks.air) { continue }
if (block == Blocks.air) continue
val meta = block.getMetaFromState(blockState)
val gemstoneColor = when {
@ -71,14 +72,14 @@ object GemstoneFinder {
5 -> GemstoneColors.JADE // Lime
14 -> GemstoneColors.RUBY // Red
10 -> GemstoneColors.AMETHYST // Purple
else -> null
}
}
else -> null
}
else -> null
}
}
else -> null
}
if (gemstoneColor != null && !gemstonesList(blockPos.x, blockPos.y, blockPos.z)) {
gemstoneList.add(GemstoneBlock(blockPos.x, blockPos.y, blockPos.z, gemstoneColor))
if (gemstoneColor != null) {
gemstonesMap.getOrPut(gemstoneColor) { mutableListOf() }.add(blockPos)
}
}
}
@ -86,26 +87,72 @@ object GemstoneFinder {
}
}
}
for ((color, positions) in gemstonesMap) {
val clusters = clusterGemstones(positions)
for (cluster in clusters) {
gemstoneClusters.add(GemstoneCluster(cluster, color))
}
}
}
private fun clusterGemstones(positions: List<BlockPos>): List<List<BlockPos>> {
val clusters = mutableListOf<List<BlockPos>>()
val visited = mutableSetOf<BlockPos>()
fun dfs(start: BlockPos, cluster: MutableList<BlockPos>) {
val stack = ArrayDeque<BlockPos>()
stack.add(start)
while (stack.isNotEmpty()) {
val pos = stack.removeLast()
if (pos in visited) continue
visited.add(pos)
cluster.add(pos)
// Check adjacent blocks in all six directions
for (offset in listOf(BlockPos(1, 0, 0), BlockPos(-1, 0, 0), BlockPos(0, 1, 0), BlockPos(0, -1, 0), BlockPos(0, 0, 1), BlockPos(0, 0, -1))) {
val neighbor = pos.add(offset)
if (neighbor in positions && neighbor !in visited) {
stack.add(neighbor)
}
}
}
}
for (pos in positions) {
if (pos !in visited) {
val cluster = mutableListOf<BlockPos>()
dfs(pos, cluster)
clusters.add(cluster)
}
}
return clusters
}
@SubscribeEvent
fun renderBlockOverlay(event: RenderWorldLastEvent) {
val player = Minecraft.getMinecraft().thePlayer
for (gemstone: GemstoneBlock in gemstoneList) {
val pos = BlockPos(gemstone.x, gemstone.y, gemstone.z)
RenderFuncs.drawBlockOutline(player, pos, event.partialTicks, gemstone.color.color)
for (cluster in gemstoneClusters) {
RenderFuncs.drawClusterOutline(player, cluster.positions, event.partialTicks, cluster.color.color)
}
}
data class GemstoneCluster(
val positions: List<BlockPos>,
val color: GemstoneColors
)
data class GemstoneBlock(
val x: Int,
val y: Int,
val z: Int,
val color: GemstoneColors
val color: GemstoneColors,
val maxX: Int = x,
val maxY: Int = y,
val maxZ: Int = z
)
fun gemstonesList(x: Int, y: Int, z: Int): Boolean {
return gemstoneList.any { it.x == x && it.y == y && it.z == z }
}
}

View File

@ -0,0 +1,20 @@
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
}
}

View File

@ -0,0 +1,83 @@
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()
val allowedScreens = listOf(GuiChat::class.java)
@SubscribeEvent
fun onTick(event: ClientTickEvent) {
if (event.phase != TickEvent.Phase.END) return
if (!isMacroToggled) return
val currentScreen = mc.currentScreen
if (currentScreen != null && allowedScreens.none { it.isInstance(currentScreen) }) {
Chatterbox.say("Macro stopped: Invalid screen")
stop()
return
}
val mop = mc.objectMouseOver
if (mop == null || mop.typeOfHit?.name != "BLOCK") return
val blockPos = mop.blockPos
val facing = mop.sideHit
val player = mc.thePlayer
val blockCenter = blockPos.add(0.5, 0.5, 0.5)
val distanceSq = player.getDistanceSq(blockCenter.x.toDouble(), blockCenter.y.toDouble(), blockCenter.z.toDouble())
if (distanceSq > 25) {
Chatterbox.say("Macro stopped: Too far from block")
stop()
return
}
if (isEntityBlockingView()) {
Chatterbox.say("Macro stopped: Entity in the way")
stop()
return
}
pressKey(mc.gameSettings.keyBindForward.keyCode)
mc.playerController.onPlayerDamageBlock(blockPos, facing)
player.swingItem()
}
fun stop() {
KeyBinding.setKeyBindState(mc.gameSettings.keyBindForward.keyCode, false)
KeyBinding.setKeyBindState(mc.gameSettings.keyBindAttack.keyCode, false)
isMacroToggled = false
}
private fun pressKey(keyCode: Int) {
KeyBinding.setKeyBindState(keyCode, true)
}
private fun isEntityBlockingView(): Boolean {
val lookVec = mc.thePlayer.lookVec
val eyePos = mc.thePlayer.getPositionEyes(1f)
val entities = mc.theWorld.getEntitiesWithinAABBExcludingEntity(
mc.thePlayer,
mc.thePlayer.entityBoundingBox.expand(lookVec.xCoord * 5, lookVec.yCoord * 5, lookVec.zCoord * 5)
)
return entities.any {
it.canBeCollidedWith() &&
it.entityBoundingBox.isVecInside(eyePos)
}
}
}

View File

@ -0,0 +1,199 @@
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()
)

View File

@ -0,0 +1,11 @@
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);
}

View File

@ -1,16 +0,0 @@
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!");
}
}

View File

@ -7,6 +7,7 @@ import net.minecraft.client.renderer.GlStateManager
import net.minecraft.entity.Entity
import net.minecraft.util.AxisAlignedBB
import net.minecraft.util.BlockPos
import net.minecraft.util.EnumFacing
import org.lwjgl.opengl.GL11
import java.awt.Color
@ -116,4 +117,72 @@ object RenderFuncs {
val lineColor = Color(0xe310d5)
RenderUtils.drawLine(pos1, pos2, lineColor, 2, false, partialTicks)
}
fun drawClusterOutline(entity: Entity, positions: List<BlockPos>, partialTicks: Float, outlineColor: Int) {
val padding = 0.0020000000949949026
// Correctly calculate the player's interpolated position
val entityX = entity.lastTickPosX + (entity.posX - entity.lastTickPosX) * partialTicks
val entityY = entity.lastTickPosY + (entity.posY - entity.lastTickPosY) * partialTicks
val entityZ = entity.lastTickPosZ + (entity.posZ - entity.lastTickPosZ) * partialTicks
val world = Minecraft.getMinecraft().theWorld
GL11.glPushMatrix()
GlStateManager.disableTexture2D()
GlStateManager.depthMask(false)
GlStateManager.disableDepth()
GL11.glEnable(GL11.GL_BLEND)
GL11.glBlendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA)
GL11.glEnable(GL11.GL_LINE_SMOOTH)
GL11.glHint(GL11.GL_LINE_SMOOTH_HINT, GL11.GL_NICEST)
GL11.glLineWidth(2.0f)
// Convert integer color to r, g, b, a values
val r = (outlineColor shr 16 and 0xFF) / 255.0f
val g = (outlineColor shr 8 and 0xFF) / 255.0f
val b = (outlineColor and 0xFF) / 255.0f
val a = (outlineColor shr 24 and 0xFF) / 255.0f
// Set the color with alpha
GL11.glColor4f(r, g, b, a)
// Iterate over the positions and draw the outline around each block
for (pos in positions) {
val blockState = world.getBlockState(pos)
val boundingBox = blockState.block.getCollisionBoundingBox(world, pos, blockState)
?: AxisAlignedBB(pos.x.toDouble(), pos.y.toDouble(), pos.z.toDouble(), pos.x + 1.0, pos.y + 1.0, pos.z + 1.0).expand(padding, padding, padding)
// Offset the bounding box by the interpolated player position
val offsetBoundingBox = boundingBox.offset(-entityX, -entityY, -entityZ)
// Check adjacent blocks and only draw faces that are exposed (not adjacent to another gemstone block)
if (!positions.contains(pos.add(1, 0, 0))) {
RenderUtils.drawBlockFace(offsetBoundingBox, EnumFacing.EAST, outlineColor)
}
if (!positions.contains(pos.add(-1, 0, 0))) {
RenderUtils.drawBlockFace(offsetBoundingBox, EnumFacing.WEST, outlineColor)
}
if (!positions.contains(pos.add(0, 1, 0))) {
RenderUtils.drawBlockFace(offsetBoundingBox, EnumFacing.UP, outlineColor)
}
if (!positions.contains(pos.add(0, -1, 0))) {
RenderUtils.drawBlockFace(offsetBoundingBox, EnumFacing.DOWN, outlineColor)
}
if (!positions.contains(pos.add(0, 0, 1))) {
RenderUtils.drawBlockFace(offsetBoundingBox, EnumFacing.SOUTH, outlineColor)
}
if (!positions.contains(pos.add(0, 0, -1))) {
RenderUtils.drawBlockFace(offsetBoundingBox, EnumFacing.NORTH, outlineColor)
}
}
GL11.glDisable(GL11.GL_LINE_SMOOTH)
GL11.glDisable(GL11.GL_BLEND)
GlStateManager.enableDepth()
GlStateManager.depthMask(true)
GlStateManager.enableAlpha()
GlStateManager.enableTexture2D()
GL11.glPopMatrix()
}
}

View File

@ -8,6 +8,7 @@ import net.minecraft.client.renderer.Tessellator
import net.minecraft.client.renderer.WorldRenderer
import net.minecraft.client.renderer.vertex.DefaultVertexFormats
import net.minecraft.util.AxisAlignedBB
import net.minecraft.util.EnumFacing
import org.lwjgl.opengl.GL11
import java.awt.Color
@ -256,4 +257,63 @@ object RenderUtils {
.color(outlineEndColor.red, outlineEndColor.green, outlineEndColor.blue, outlineEndColor.alpha).endVertex()
TESSELLATOR.draw()
}
fun drawBlockFace(box: AxisAlignedBB, face: EnumFacing, color: Int) {
WORLD_RENDERER.begin(GL11.GL_LINE_STRIP, DefaultVertexFormats.POSITION_COLOR)
val r = (color shr 16 and 0xFF) / 255.0f
val g = (color shr 8 and 0xFF) / 255.0f
val b = (color and 0xFF) / 255.0f
val a = (color shr 24 and 0xFF) / 255.0f
GL11.glColor4f(r, g, b, a)
when (face) {
EnumFacing.UP -> {
WORLD_RENDERER.pos(box.minX, box.maxY, box.minZ).endVertex()
WORLD_RENDERER.pos(box.maxX, box.maxY, box.minZ).endVertex()
WORLD_RENDERER.pos(box.maxX, box.maxY, box.maxZ).endVertex()
WORLD_RENDERER.pos(box.minX, box.maxY, box.maxZ).endVertex()
WORLD_RENDERER.pos(box.minX, box.maxY, box.minZ).endVertex()
}
EnumFacing.DOWN -> {
WORLD_RENDERER.pos(box.minX, box.minY, box.minZ).endVertex()
WORLD_RENDERER.pos(box.maxX, box.minY, box.minZ).endVertex()
WORLD_RENDERER.pos(box.maxX, box.minY, box.maxZ).endVertex()
WORLD_RENDERER.pos(box.minX, box.minY, box.maxZ).endVertex()
WORLD_RENDERER.pos(box.minX, box.minY, box.minZ).endVertex()
}
EnumFacing.NORTH -> {
WORLD_RENDERER.pos(box.minX, box.minY, box.minZ).endVertex()
WORLD_RENDERER.pos(box.maxX, box.minY, box.minZ).endVertex()
WORLD_RENDERER.pos(box.maxX, box.maxY, box.minZ).endVertex()
WORLD_RENDERER.pos(box.minX, box.maxY, box.minZ).endVertex()
WORLD_RENDERER.pos(box.minX, box.minY, box.minZ).endVertex()
}
EnumFacing.SOUTH -> {
WORLD_RENDERER.pos(box.minX, box.minY, box.maxZ).endVertex()
WORLD_RENDERER.pos(box.maxX, box.minY, box.maxZ).endVertex()
WORLD_RENDERER.pos(box.maxX, box.maxY, box.maxZ).endVertex()
WORLD_RENDERER.pos(box.minX, box.maxY, box.maxZ).endVertex()
WORLD_RENDERER.pos(box.minX, box.minY, box.maxZ).endVertex()
}
EnumFacing.WEST -> {
WORLD_RENDERER.pos(box.minX, box.minY, box.minZ).endVertex()
WORLD_RENDERER.pos(box.minX, box.minY, box.maxZ).endVertex()
WORLD_RENDERER.pos(box.minX, box.maxY, box.maxZ).endVertex()
WORLD_RENDERER.pos(box.minX, box.maxY, box.minZ).endVertex()
WORLD_RENDERER.pos(box.minX, box.minY, box.minZ).endVertex()
}
EnumFacing.EAST -> {
WORLD_RENDERER.pos(box.maxX, box.minY, box.minZ).endVertex()
WORLD_RENDERER.pos(box.maxX, box.minY, box.maxZ).endVertex()
WORLD_RENDERER.pos(box.maxX, box.maxY, box.maxZ).endVertex()
WORLD_RENDERER.pos(box.maxX, box.maxY, box.minZ).endVertex()
WORLD_RENDERER.pos(box.maxX, box.minY, box.minZ).endVertex()
}
else -> {}
}
TESSELLATOR.draw()
}
}

View File

@ -1,14 +1,14 @@
[
{
"modid": "${modid}",
"name": "Xample Mod",
"description": "A mod that is used as an example.",
"name": "SkyBlock Tweaks",
"description": "Utilities for making Hypixel Skyblock more bearable",
"version": "${version}",
"mcversion": "${mcversion}",
"url": "https://github.com/romangraef/Forge1.8.9Template/",
"url": "http://itzilly.com/illyum/illyum/sbt-stash/",
"updateUrl": "",
"authorList": [
"You"
"itzilly"
],
"credits": "",
"logoFile": "",