blob: 2de2159449f447f86cb32b34352b849a8d2e8467 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
|
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
import moe.nea.firmament.util.MC
import net.minecraft.util.hit.BlockHitResult
import moe.nea.firmament.events.WorldRenderLastEvent
import moe.nea.firmament.util.extraAttributes
import moe.nea.firmament.util.render.RenderInWorldContext
import moe.nea.firmament.util.skyBlockId
import moe.nea.firmament.util.skyblock.SkyBlockItems
object EtherwarpOverlay : FirmamentFeature {
override val identifier: String
get() = "etherwarp-overlay"
object TConfig : ManagedConfig(identifier, Category.ITEMS) {
var etherwarpOverlay by toggle("etherwarp-overlay") { false }
var cube by toggle("cube") { true }
var wireframe by toggle("wireframe") { false }
}
override val config: ManagedConfig
get() = TConfig
@Subscribe
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
if (heldItem.skyBlockId !in listOf(SkyBlockItems.ASPECT_OF_THE_VOID, SkyBlockItems.ASPECT_OF_THE_END)) return
if (!heldItem.extraAttributes.contains("ethermerge")) return
val hitResult = camera.raycast(61.0, 0.0f, false)
if (hitResult !is BlockHitResult) return
val blockPos = hitResult.blockPos
if (camera.squaredDistanceTo(blockPos.toCenterPos()) > 61 * 61) return
if (!world.getBlockState(blockPos.up()).isAir) return
if (!world.getBlockState(blockPos.up(2)).isAir) return
RenderInWorldContext.renderInWorld(event) {
if (TConfig.cube) block(blockPos, Color.ofRGBA(172, 0, 255, 60).color)
if (TConfig.wireframe) wireframeCube(blockPos, 10f)
}
}
}
|