diff options
author | Jacob <55346310+Kathund@users.noreply.github.com> | 2025-07-03 20:00:17 +0800 |
---|---|---|
committer | GitHub <noreply@github.com> | 2025-07-03 14:00:17 +0200 |
commit | 07464087671ba52aacd71fc6c276460ed77e3612 (patch) | |
tree | 21896b32dd8295705f449563c85f87f9fa661b1e /src | |
parent | 5147d1b953fc60e1cecea112f56e63e61e25a7d6 (diff) | |
download | Firmament-master.tar.gz Firmament-master.tar.bz2 Firmament-master.zip |
Diffstat (limited to 'src')
-rw-r--r-- | src/main/kotlin/features/items/EtherwarpOverlay.kt | 3 | ||||
-rw-r--r-- | src/main/kotlin/features/world/FairySouls.kt | 3 | ||||
-rw-r--r-- | src/main/kotlin/features/world/TemporaryWaypoints.kt | 3 | ||||
-rw-r--r-- | src/main/kotlin/features/world/Waypoints.kt | 2 | ||||
-rw-r--r-- | src/main/kotlin/util/IntUtil.kt | 12 | ||||
-rw-r--r-- | src/main/kotlin/util/render/CustomRenderLayers.kt | 1 | ||||
-rw-r--r-- | src/main/kotlin/util/render/RenderInWorldContext.kt | 53 |
7 files changed, 48 insertions, 29 deletions
diff --git a/src/main/kotlin/features/items/EtherwarpOverlay.kt b/src/main/kotlin/features/items/EtherwarpOverlay.kt index d560ad6..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 @@ -43,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())) } diff --git a/src/main/kotlin/util/IntUtil.kt b/src/main/kotlin/util/IntUtil.kt new file mode 100644 index 0000000..2695906 --- /dev/null +++ b/src/main/kotlin/util/IntUtil.kt @@ -0,0 +1,12 @@ +package moe.nea.firmament.util + +object IntUtil { + data class RGBA(val r: Int, val g: Int, val b: Int, val a: Int) + + fun Int.toRGBA(): RGBA { + return RGBA( + r = (this shr 16) and 0xFF, g = (this shr 8) and 0xFF, b = this and 0xFF, a = (this shr 24) and 0xFF + ) + } + +} diff --git a/src/main/kotlin/util/render/CustomRenderLayers.kt b/src/main/kotlin/util/render/CustomRenderLayers.kt index 3d9e598..f713a81 100644 --- a/src/main/kotlin/util/render/CustomRenderLayers.kt +++ b/src/main/kotlin/util/render/CustomRenderLayers.kt @@ -39,6 +39,7 @@ object CustomRenderPipelines { .withDepthTestFunction(DepthTestFunction.NO_DEPTH_TEST) .withCull(false) .withDepthWrite(false) + .withBlend(BlendFunction.TRANSLUCENT) .build() val CIRCLE_FILTER_TRANSLUCENT_GUI_TRIS = diff --git a/src/main/kotlin/util/render/RenderInWorldContext.kt b/src/main/kotlin/util/render/RenderInWorldContext.kt index 98b10ca..4963920 100644 --- a/src/main/kotlin/util/render/RenderInWorldContext.kt +++ b/src/main/kotlin/util/render/RenderInWorldContext.kt @@ -20,6 +20,7 @@ import net.minecraft.util.math.BlockPos import net.minecraft.util.math.Vec3d import moe.nea.firmament.events.WorldRenderLastEvent import moe.nea.firmament.util.FirmFormatters +import moe.nea.firmament.util.IntUtil.toRGBA import moe.nea.firmament.util.MC @RenderContextDSL @@ -204,37 +205,39 @@ class RenderInWorldContext private constructor( } } - private fun buildCube(matrix: Matrix4f, buf: VertexConsumer, color: Int) { + private fun buildCube(matrix: Matrix4f, buf: VertexConsumer, colorInt: Int) { + val (r, g, b, a) = colorInt.toRGBA() + // Y- - buf.vertex(matrix, 0F, 0F, 0F).color(color) - buf.vertex(matrix, 0F, 0F, 1F).color(color) - buf.vertex(matrix, 1F, 0F, 1F).color(color) - buf.vertex(matrix, 1F, 0F, 0F).color(color) + buf.vertex(matrix, 0F, 0F, 0F).color(r, g, b, a) + buf.vertex(matrix, 0F, 0F, 1F).color(r, g, b, a) + buf.vertex(matrix, 1F, 0F, 1F).color(r, g, b, a) + buf.vertex(matrix, 1F, 0F, 0F).color(r, g, b, a) // Y+ - buf.vertex(matrix, 0F, 1F, 0F).color(color) - buf.vertex(matrix, 1F, 1F, 0F).color(color) - buf.vertex(matrix, 1F, 1F, 1F).color(color) - buf.vertex(matrix, 0F, 1F, 1F).color(color) + buf.vertex(matrix, 0F, 1F, 0F).color(r, g, b, a) + buf.vertex(matrix, 1F, 1F, 0F).color(r, g, b, a) + buf.vertex(matrix, 1F, 1F, 1F).color(r, g, b, a) + buf.vertex(matrix, 0F, 1F, 1F).color(r, g, b, a) // X- - buf.vertex(matrix, 0F, 0F, 0F).color(color) - buf.vertex(matrix, 0F, 0F, 1F).color(color) - buf.vertex(matrix, 0F, 1F, 1F).color(color) - buf.vertex(matrix, 0F, 1F, 0F).color(color) + buf.vertex(matrix, 0F, 0F, 0F).color(r, g, b, a) + buf.vertex(matrix, 0F, 0F, 1F).color(r, g, b, a) + buf.vertex(matrix, 0F, 1F, 1F).color(r, g, b, a) + buf.vertex(matrix, 0F, 1F, 0F).color(r, g, b, a) // X+ - buf.vertex(matrix, 1F, 0F, 0F).color(color) - buf.vertex(matrix, 1F, 1F, 0F).color(color) - buf.vertex(matrix, 1F, 1F, 1F).color(color) - buf.vertex(matrix, 1F, 0F, 1F).color(color) + buf.vertex(matrix, 1F, 0F, 0F).color(r, g, b, a) + buf.vertex(matrix, 1F, 1F, 0F).color(r, g, b, a) + buf.vertex(matrix, 1F, 1F, 1F).color(r, g, b, a) + buf.vertex(matrix, 1F, 0F, 1F).color(r, g, b, a) // Z- - buf.vertex(matrix, 0F, 0F, 0F).color(color) - buf.vertex(matrix, 1F, 0F, 0F).color(color) - buf.vertex(matrix, 1F, 1F, 0F).color(color) - buf.vertex(matrix, 0F, 1F, 0F).color(color) + buf.vertex(matrix, 0F, 0F, 0F).color(r, g, b, a) + buf.vertex(matrix, 1F, 0F, 0F).color(r, g, b, a) + buf.vertex(matrix, 1F, 1F, 0F).color(r, g, b, a) + buf.vertex(matrix, 0F, 1F, 0F).color(r, g, b, a) // Z+ - buf.vertex(matrix, 0F, 0F, 1F).color(color) - buf.vertex(matrix, 0F, 1F, 1F).color(color) - buf.vertex(matrix, 1F, 1F, 1F).color(color) - buf.vertex(matrix, 1F, 0F, 1F).color(color) + buf.vertex(matrix, 0F, 0F, 1F).color(r, g, b, a) + buf.vertex(matrix, 0F, 1F, 1F).color(r, g, b, a) + buf.vertex(matrix, 1F, 1F, 1F).color(r, g, b, a) + buf.vertex(matrix, 1F, 0F, 1F).color(r, g, b, a) } |