blob: 93df913c88234be4b3375b330369b75972867bc4 (
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 at.hannibal2.skyhanni.features.rift
import at.hannibal2.skyhanni.SkyHanniMod
import at.hannibal2.skyhanni.events.LorenzTickEvent
import at.hannibal2.skyhanni.events.withAlpha
import at.hannibal2.skyhanni.mixins.hooks.RenderLivingEntityHelper
import at.hannibal2.skyhanni.utils.EntityUtils.hasSkullTexture
import at.hannibal2.skyhanni.utils.InventoryUtils
import at.hannibal2.skyhanni.utils.ItemUtils.getInternalName
import at.hannibal2.skyhanni.utils.LorenzUtils.toChromaColor
import net.minecraft.client.Minecraft
import net.minecraft.entity.item.EntityArmorStand
import net.minecraftforge.fml.common.eventhandler.SubscribeEvent
class RiftLarva {
private val config get() = SkyHanniMod.feature.rift.larvas
private var hasHookInHand = false
val larvaSkullTexture =
"eyJ0ZXh0dXJlcyI6eyJTS0lOIjp7InVybCI6Imh0dHA6Ly90ZXh0dXJlcy5taW5lY3JhZnQubmV0L3RleHR1cmUvOTgzYjMwZTlkMTM1YjA1MTkwZWVhMmMzYWM2MWUyYWI1NWEyZDgxZTFhNThkYmIyNjk4M2ExNDA4MjY2NCJ9fX0="
@SubscribeEvent
fun onTick(event: LorenzTickEvent) {
if (!isEnabled()) return
checkHand()
if (!hasHookInHand) return
if (event.isMod(20)) {
findLarvas()
}
}
private fun checkHand() {
hasHookInHand = InventoryUtils.getItemInHand()?.getInternalName() == "LARVA_HOOK"
}
private fun findLarvas() {
val list = Minecraft.getMinecraft().theWorld?.loadedEntityList ?: return
for (stand in list.filterIsInstance<EntityArmorStand>()) {
if (stand.hasSkullTexture(larvaSkullTexture)) {
RenderLivingEntityHelper.setEntityColor(
stand,
config.highlightColor.toChromaColor().withAlpha(1)
) { isEnabled() && hasHookInHand }
}
}
}
fun isEnabled() = RiftAPI.inRift() && config.highlight
}
|