aboutsummaryrefslogtreecommitdiff
path: root/src/main/kotlin/features
diff options
context:
space:
mode:
Diffstat (limited to 'src/main/kotlin/features')
-rw-r--r--src/main/kotlin/features/inventory/PetFeatures.kt3
-rw-r--r--src/main/kotlin/features/inventory/WardrobeKeybinds.kt28
-rw-r--r--src/main/kotlin/features/items/BonemerangOverlay.kt101
-rw-r--r--src/main/kotlin/features/items/EtherwarpOverlay.kt4
-rw-r--r--src/main/kotlin/features/world/FairySouls.kt3
-rw-r--r--src/main/kotlin/features/world/TemporaryWaypoints.kt3
-rw-r--r--src/main/kotlin/features/world/Waypoints.kt2
7 files changed, 137 insertions, 7 deletions
diff --git a/src/main/kotlin/features/inventory/PetFeatures.kt b/src/main/kotlin/features/inventory/PetFeatures.kt
index bb39fbc..9393b03 100644
--- a/src/main/kotlin/features/inventory/PetFeatures.kt
+++ b/src/main/kotlin/features/inventory/PetFeatures.kt
@@ -13,6 +13,7 @@ import moe.nea.firmament.gui.config.ManagedConfig
import moe.nea.firmament.util.FirmFormatters.formatPercent
import moe.nea.firmament.util.FirmFormatters.shortFormat
import moe.nea.firmament.util.MC
+import moe.nea.firmament.util.SBData
import moe.nea.firmament.util.petData
import moe.nea.firmament.util.render.drawGuiTexture
import moe.nea.firmament.util.skyblock.Rarity
@@ -52,7 +53,7 @@ object PetFeatures : FirmamentFeature {
@Subscribe
fun onRenderHud(it: HudRenderEvent) {
- if (!TConfig.petOverlay) return
+ if (!TConfig.petOverlay || !SBData.isOnSkyblock) return
val itemStack = petItemStack ?: return
val petData = petItemStack?.petData ?: return
val rarity = Rarity.fromNeuRepo(petData.tier)
diff --git a/src/main/kotlin/features/inventory/WardrobeKeybinds.kt b/src/main/kotlin/features/inventory/WardrobeKeybinds.kt
index d797600..6e2b4a9 100644
--- a/src/main/kotlin/features/inventory/WardrobeKeybinds.kt
+++ b/src/main/kotlin/features/inventory/WardrobeKeybinds.kt
@@ -2,14 +2,12 @@ package moe.nea.firmament.features.inventory
import org.lwjgl.glfw.GLFW
import net.minecraft.item.Items
-import net.minecraft.screen.slot.SlotActionType
import moe.nea.firmament.annotations.Subscribe
import moe.nea.firmament.events.HandledScreenKeyPressedEvent
import moe.nea.firmament.features.FirmamentFeature
import moe.nea.firmament.gui.config.ManagedConfig
import moe.nea.firmament.util.MC
import moe.nea.firmament.util.mc.SlotUtils.clickLeftMouseButton
-import moe.nea.firmament.util.mc.SlotUtils.clickMiddleMouseButton
object WardrobeKeybinds : FirmamentFeature {
override val identifier: String
@@ -17,6 +15,9 @@ object WardrobeKeybinds : FirmamentFeature {
object TConfig : ManagedConfig(identifier, Category.INVENTORY) {
val wardrobeKeybinds by toggle("wardrobe-keybinds") { false }
+ val changePageKeybind by keyBinding("change-page") { GLFW.GLFW_KEY_ENTER }
+ val nextPage by keyBinding("next-page") { GLFW.GLFW_KEY_D }
+ val previousPage by keyBinding("previous-page") { GLFW.GLFW_KEY_A }
val slotKeybinds = (1..9).map {
keyBinding("slot-$it") { GLFW.GLFW_KEY_0 + it }
}
@@ -37,6 +38,29 @@ object WardrobeKeybinds : FirmamentFeature {
if (!regex.matches(event.screen.title.string)) return
if (!TConfig.wardrobeKeybinds) return
+ if (
+ event.matches(TConfig.changePageKeybind) ||
+ event.matches(TConfig.previousPage) ||
+ event.matches(TConfig.nextPage)
+ ) {
+ event.cancel()
+
+ val handler = event.screen.screenHandler
+ val previousSlot = handler.getSlot(45)
+ val nextSlot = handler.getSlot(53)
+
+ val backPressed = event.matches(TConfig.changePageKeybind) || event.matches(TConfig.previousPage)
+ val nextPressed = event.matches(TConfig.changePageKeybind) || event.matches(TConfig.nextPage)
+
+ if (backPressed && previousSlot.stack.item == Items.ARROW) {
+ previousSlot.clickLeftMouseButton(handler)
+ } else if (nextPressed && nextSlot.stack.item == Items.ARROW) {
+ nextSlot.clickLeftMouseButton(handler)
+ }
+ }
+
+
+
val slot =
slotKeybindsWithSlot
.find { event.matches(it.second.get()) }
diff --git a/src/main/kotlin/features/items/BonemerangOverlay.kt b/src/main/kotlin/features/items/BonemerangOverlay.kt
new file mode 100644
index 0000000..ffdffe3
--- /dev/null
+++ b/src/main/kotlin/features/items/BonemerangOverlay.kt
@@ -0,0 +1,101 @@
+package moe.nea.firmament.features.items
+
+import me.shedaniel.math.Color
+import moe.nea.jarvis.api.Point
+import net.minecraft.entity.LivingEntity
+import net.minecraft.entity.decoration.ArmorStandEntity
+import net.minecraft.entity.player.PlayerEntity
+import net.minecraft.util.Formatting
+import net.minecraft.util.math.Box
+import moe.nea.firmament.annotations.Subscribe
+import moe.nea.firmament.events.ClientStartedEvent
+import moe.nea.firmament.events.EntityRenderTintEvent
+import moe.nea.firmament.events.HudRenderEvent
+import moe.nea.firmament.features.FirmamentFeature
+import moe.nea.firmament.gui.config.ManagedConfig
+import moe.nea.firmament.util.MC
+import moe.nea.firmament.util.render.TintedOverlayTexture
+import moe.nea.firmament.util.skyBlockId
+import moe.nea.firmament.util.skyblock.SkyBlockItems
+import moe.nea.firmament.util.tr
+
+object BonemerangOverlay : FirmamentFeature {
+ override val identifier: String
+ get() = "bonemerang-overlay"
+
+ object TConfig : ManagedConfig(identifier, Category.ITEMS) {
+ var bonemerangOverlay by toggle("bonemerang-overlay") { false }
+ val bonemerangOverlayHud by position("bonemerang-overlay-hud", 80, 10) { Point(0.1, 1.0) }
+ var highlightHitEntities by toggle("highlight-hit-entities") { false }
+ }
+
+ @Subscribe
+ fun onInit(event: ClientStartedEvent) {
+ }
+
+ override val config: ManagedConfig
+ get() = TConfig
+
+ fun getEntities(): MutableSet<LivingEntity> {
+ val entities = mutableSetOf<LivingEntity>()
+ val camera = MC.camera as? PlayerEntity ?: return entities
+ val player = MC.player ?: return entities
+ val world = player.world ?: return entities
+
+ val cameraPos = camera.eyePos
+ val rayDirection = camera.rotationVector.normalize()
+ val endPos = cameraPos.add(rayDirection.multiply(15.0))
+ val foundEntities = world.getOtherEntities(camera, Box(cameraPos, endPos).expand(1.0))
+
+ for (entity in foundEntities) {
+ if (entity !is LivingEntity || entity is ArmorStandEntity || entity.isInvisible) continue
+ val hitResult = entity.boundingBox.expand(0.35).raycast(cameraPos, endPos).orElse(null)
+ if (hitResult != null) entities.add(entity)
+ }
+
+ return entities
+ }
+
+
+ val throwableWeapons = listOf(
+ SkyBlockItems.BONE_BOOMERANG, SkyBlockItems.STARRED_BONE_BOOMERANG,
+ SkyBlockItems.TRIBAL_SPEAR,
+ )
+
+
+ @Subscribe
+ fun onEntityRender(event: EntityRenderTintEvent) {
+ if (!TConfig.highlightHitEntities) return
+ if (MC.stackInHand.skyBlockId !in throwableWeapons) return
+
+ val entities = getEntities()
+ if (entities.isEmpty()) return
+ if (event.entity !in entities) return
+
+ val tintOverlay by lazy {
+ TintedOverlayTexture().setColor(Color.ofOpaque(Formatting.BLUE.colorValue!!))
+ }
+
+ event.renderState.overlayTexture_firmament = tintOverlay
+ }
+
+
+ @Subscribe
+ fun onRenderHud(it: HudRenderEvent) {
+ if (!TConfig.bonemerangOverlay) return
+ if (MC.stackInHand.skyBlockId !in throwableWeapons) return
+
+ val entities = getEntities()
+
+ it.context.matrices.push()
+ TConfig.bonemerangOverlayHud.applyTransformations(it.context.matrices)
+ it.context.drawText(
+ MC.font, String.format(
+ tr(
+ "firmament.bonemerang-overlay.bonemerang-overlay.display", "Bonemerang Targets: %s"
+ ).string, entities.size
+ ), 0, 0, -1, true
+ )
+ it.context.matrices.pop()
+ }
+}
diff --git a/src/main/kotlin/features/items/EtherwarpOverlay.kt b/src/main/kotlin/features/items/EtherwarpOverlay.kt
index 83e533c..2de2159 100644
--- a/src/main/kotlin/features/items/EtherwarpOverlay.kt
+++ b/src/main/kotlin/features/items/EtherwarpOverlay.kt
@@ -1,5 +1,6 @@
package moe.nea.firmament.features.items
+import me.shedaniel.math.Color
import moe.nea.firmament.annotations.Subscribe
import moe.nea.firmament.features.FirmamentFeature
import moe.nea.firmament.gui.config.ManagedConfig
@@ -29,6 +30,7 @@ object EtherwarpOverlay : FirmamentFeature {
fun renderEtherwarpOverlay(event: WorldRenderLastEvent) {
if (!TConfig.etherwarpOverlay) return
val player = MC.player ?: return
+ if (!player.isSneaking) return
val world = player.world
val camera = MC.camera ?: return
val heldItem = MC.stackInHand
@@ -42,7 +44,7 @@ object EtherwarpOverlay : FirmamentFeature {
if (!world.getBlockState(blockPos.up()).isAir) return
if (!world.getBlockState(blockPos.up(2)).isAir) return
RenderInWorldContext.renderInWorld(event) {
- if (TConfig.cube) block(blockPos, 0xFFFFFF00.toInt())
+ if (TConfig.cube) block(blockPos, Color.ofRGBA(172, 0, 255, 60).color)
if (TConfig.wireframe) wireframeCube(blockPos, 10f)
}
}
diff --git a/src/main/kotlin/features/world/FairySouls.kt b/src/main/kotlin/features/world/FairySouls.kt
index 1263074..d4bf560 100644
--- a/src/main/kotlin/features/world/FairySouls.kt
+++ b/src/main/kotlin/features/world/FairySouls.kt
@@ -3,6 +3,7 @@
package moe.nea.firmament.features.world
import io.github.moulberry.repo.data.Coordinate
+import me.shedaniel.math.Color
import kotlinx.serialization.Serializable
import kotlinx.serialization.serializer
import net.minecraft.text.Text
@@ -100,7 +101,7 @@ object FairySouls : FirmamentFeature {
if (!TConfig.displaySouls) return
renderInWorld(it) {
currentMissingSouls.forEach {
- block(it.blockPos, 0x80FFFF00.toInt())
+ block(it.blockPos, Color.ofRGBA(176, 0, 255, 128).color)
}
color(1f, 0f, 1f, 1f)
currentLocationSouls.forEach {
diff --git a/src/main/kotlin/features/world/TemporaryWaypoints.kt b/src/main/kotlin/features/world/TemporaryWaypoints.kt
index b36c49d..3c8e895 100644
--- a/src/main/kotlin/features/world/TemporaryWaypoints.kt
+++ b/src/main/kotlin/features/world/TemporaryWaypoints.kt
@@ -1,5 +1,6 @@
package moe.nea.firmament.features.world
+import me.shedaniel.math.Color
import kotlin.compareTo
import kotlin.text.clear
import kotlin.time.Duration.Companion.seconds
@@ -38,7 +39,7 @@ object TemporaryWaypoints {
if (temporaryPlayerWaypointList.isEmpty()) return
RenderInWorldContext.renderInWorld(event) {
temporaryPlayerWaypointList.forEach { (_, waypoint) ->
- block(waypoint.pos, 0xFFFFFF00.toInt())
+ block(waypoint.pos, Color.ofRGBA(255, 255, 0, 128).color)
}
temporaryPlayerWaypointList.forEach { (player, waypoint) ->
val skin =
diff --git a/src/main/kotlin/features/world/Waypoints.kt b/src/main/kotlin/features/world/Waypoints.kt
index b5c2b66..b4f91b0 100644
--- a/src/main/kotlin/features/world/Waypoints.kt
+++ b/src/main/kotlin/features/world/Waypoints.kt
@@ -45,7 +45,7 @@ object Waypoints : FirmamentFeature {
RenderInWorldContext.renderInWorld(event) {
if (!w.isOrdered) {
w.waypoints.withIndex().forEach {
- block(it.value.blockPos, 0x800050A0.toInt())
+ block(it.value.blockPos, Color.ofRGBA(0, 80, 160, 128).color)
if (TConfig.showIndex) withFacingThePlayer(it.value.blockPos.toCenterPos()) {
text(Text.literal(it.index.toString()))
}