aboutsummaryrefslogtreecommitdiff
path: root/src/main/java/at
diff options
context:
space:
mode:
authorHiZe <super@hize.be>2024-09-08 09:53:42 +0200
committerGitHub <noreply@github.com>2024-09-08 09:53:42 +0200
commit68044ebd31dc1af39c01a26285b1de1eb46c3263 (patch)
treecde0c1480a9cc4042e4f74fa98b2f3224f99c135 /src/main/java/at
parent3db3627ec03baa134940a92e596e591f2d88aa0c (diff)
downloadskyhanni-68044ebd31dc1af39c01a26285b1de1eb46c3263.tar.gz
skyhanni-68044ebd31dc1af39c01a26285b1de1eb46c3263.tar.bz2
skyhanni-68044ebd31dc1af39c01a26285b1de1eb46c3263.zip
Feature: Mirrorverse Crafting Room Helper (#2178)
Co-authored-by: hannibal2 <24389977+hannibal00212@users.noreply.github.com>
Diffstat (limited to 'src/main/java/at')
-rw-r--r--src/main/java/at/hannibal2/skyhanni/config/features/rift/area/mirrorverse/CraftingRoomConfig.java31
-rw-r--r--src/main/java/at/hannibal2/skyhanni/config/features/rift/area/mirrorverse/MirrorVerseConfig.java11
-rw-r--r--src/main/java/at/hannibal2/skyhanni/features/rift/area/mirrorverse/CraftRoomHolographicMob.kt99
3 files changed, 140 insertions, 1 deletions
diff --git a/src/main/java/at/hannibal2/skyhanni/config/features/rift/area/mirrorverse/CraftingRoomConfig.java b/src/main/java/at/hannibal2/skyhanni/config/features/rift/area/mirrorverse/CraftingRoomConfig.java
new file mode 100644
index 000000000..e1bc145c3
--- /dev/null
+++ b/src/main/java/at/hannibal2/skyhanni/config/features/rift/area/mirrorverse/CraftingRoomConfig.java
@@ -0,0 +1,31 @@
+package at.hannibal2.skyhanni.config.features.rift.area.mirrorverse;
+
+import at.hannibal2.skyhanni.config.FeatureToggle;
+import com.google.gson.annotations.Expose;
+import io.github.notenoughupdates.moulconfig.annotations.ConfigEditorBoolean;
+import io.github.notenoughupdates.moulconfig.annotations.ConfigOption;
+
+public class CraftingRoomConfig {
+
+ @Expose
+ @ConfigOption(name = "Enabled", desc = "Show an holographic version of the mob on your side of the craft room.")
+ @ConfigEditorBoolean
+ @FeatureToggle
+ public boolean enabled = true;
+
+ @Expose
+ @ConfigOption(name = "Show Name", desc = "Show the name of the mob.")
+ @ConfigEditorBoolean
+ public boolean showName = true;
+
+ @Expose
+ @ConfigOption(name = "Show Health", desc = "Show the health of the mob.")
+ @ConfigEditorBoolean
+ public boolean showHealth = true;
+
+ @Expose
+ @ConfigOption(name = "Hide Players", desc = "Hide other players in the room.")
+ @ConfigEditorBoolean
+ public boolean hidePlayers = true;
+
+}
diff --git a/src/main/java/at/hannibal2/skyhanni/config/features/rift/area/mirrorverse/MirrorVerseConfig.java b/src/main/java/at/hannibal2/skyhanni/config/features/rift/area/mirrorverse/MirrorVerseConfig.java
index c1fedf3a4..0ab546ae8 100644
--- a/src/main/java/at/hannibal2/skyhanni/config/features/rift/area/mirrorverse/MirrorVerseConfig.java
+++ b/src/main/java/at/hannibal2/skyhanni/config/features/rift/area/mirrorverse/MirrorVerseConfig.java
@@ -7,16 +7,25 @@ import io.github.notenoughupdates.moulconfig.annotations.ConfigOption;
public class MirrorVerseConfig {
+ // Four Levers
+
@ConfigOption(name = "Lava Maze", desc = "")
@Accordion
@Expose
public LavaMazeConfig lavaMazeConfig = new LavaMazeConfig();
- @ConfigOption(name = "Upside Down Parkour", desc = "")
+ @ConfigOption(name = "Crafting Room", desc = "")
+ @Accordion
+ @Expose
+ public CraftingRoomConfig craftingRoom = new CraftingRoomConfig();
+
+ @ConfigOption(name = "Upside-Down Parkour", desc = "")
@Accordion
@Expose
public UpsideDownParkourConfig upsideDownParkour = new UpsideDownParkourConfig();
+ // Red-Green Puzzle
+
@ConfigOption(name = "Dance Room Helper", desc = "")
@Accordion
@Expose
diff --git a/src/main/java/at/hannibal2/skyhanni/features/rift/area/mirrorverse/CraftRoomHolographicMob.kt b/src/main/java/at/hannibal2/skyhanni/features/rift/area/mirrorverse/CraftRoomHolographicMob.kt
new file mode 100644
index 000000000..ab5060be3
--- /dev/null
+++ b/src/main/java/at/hannibal2/skyhanni/features/rift/area/mirrorverse/CraftRoomHolographicMob.kt
@@ -0,0 +1,99 @@
+package at.hannibal2.skyhanni.features.rift.area.mirrorverse
+
+import at.hannibal2.skyhanni.SkyHanniMod
+import at.hannibal2.skyhanni.events.CheckRenderEntityEvent
+import at.hannibal2.skyhanni.events.LorenzRenderWorldEvent
+import at.hannibal2.skyhanni.events.LorenzTickEvent
+import at.hannibal2.skyhanni.features.rift.RiftAPI
+import at.hannibal2.skyhanni.skyhannimodule.SkyHanniModule
+import at.hannibal2.skyhanni.utils.CollectionUtils.editCopy
+import at.hannibal2.skyhanni.utils.EntityUtils
+import at.hannibal2.skyhanni.utils.HolographicEntities
+import at.hannibal2.skyhanni.utils.LocationUtils
+import at.hannibal2.skyhanni.utils.LocationUtils.isInside
+import at.hannibal2.skyhanni.utils.RenderUtils.drawString
+import at.hannibal2.skyhanni.utils.getLorenzVec
+import net.minecraft.client.entity.EntityOtherPlayerMP
+import net.minecraft.entity.EntityLivingBase
+import net.minecraft.entity.monster.EntityCaveSpider
+import net.minecraft.entity.monster.EntitySlime
+import net.minecraft.entity.monster.EntityZombie
+import net.minecraft.entity.player.EntityPlayer
+import net.minecraft.util.AxisAlignedBB
+import net.minecraftforge.fml.common.eventhandler.SubscribeEvent
+import kotlin.math.abs
+
+@SkyHanniModule
+object CraftRoomHolographicMob {
+
+ private val config get() = SkyHanniMod.feature.rift.area.mirrorverse.craftingRoom
+ private val craftRoomArea = AxisAlignedBB(
+ -108.0, 58.0, -106.0,
+ -117.0, 51.0, -128.0,
+ )
+ private var entitiesList = listOf<HolographicEntities.HolographicEntity<out EntityLivingBase>>()
+ private var entityToHolographicEntity = mapOf(
+ EntityZombie::class.java to HolographicEntities.zombie,
+ EntitySlime::class.java to HolographicEntities.slime,
+ EntityCaveSpider::class.java to HolographicEntities.caveSpider,
+ )
+
+ @SubscribeEvent
+ fun onTick(event: LorenzTickEvent) {
+ if (!isEnabled()) return
+ for (entity in entitiesList) {
+ entity.moveTo(entity.position.up(.1), (entity.yaw + 5) % 360)
+ }
+ }
+
+ @SubscribeEvent
+ fun onWorldRender(event: LorenzRenderWorldEvent) {
+ if (!isEnabled()) return
+
+ for (theMob in EntityUtils.getEntitiesNearby<EntityLivingBase>(LocationUtils.playerLocation(), 25.0)) {
+ if (theMob is EntityPlayer) continue
+
+ if (!craftRoomArea.isInside(theMob.getLorenzVec())) continue
+
+ val mobPos = theMob.getLorenzVec()
+ val wallZ = -116.5
+ val dist = abs(mobPos.z - wallZ)
+ val holographicMobPos = mobPos.add(z = dist * 2)
+ val displayString = buildString {
+ val mobName = theMob.displayName.formattedText
+ if (config.showName) {
+ append("§a$mobName ")
+ }
+ if (config.showHealth) {
+ append("§c${theMob.health}♥")
+ }
+ }.trim()
+
+ val mob = entityToHolographicEntity[theMob::class.java] ?: continue
+
+ val instance = mob.instance(holographicMobPos, -theMob.rotationYaw)
+
+ instance.isChild = theMob.isChild
+
+ HolographicEntities.renderHolographicEntity(instance, event.partialTicks)
+
+ if (displayString.isNotEmpty()) {
+ event.drawString(holographicMobPos.add(y = theMob.eyeHeight + .5), displayString)
+ }
+
+ entitiesList = entitiesList.editCopy { add(instance) }
+ }
+ }
+
+ @SubscribeEvent(receiveCanceled = true)
+ fun onPlayerRender(event: CheckRenderEntityEvent<*>) {
+ if (!RiftAPI.inRift() || !config.hidePlayers) return
+
+ val entity = event.entity
+ if (entity is EntityOtherPlayerMP && craftRoomArea.isInside(entity.getLorenzVec())) {
+ event.cancel()
+ }
+ }
+
+ private fun isEnabled() = config.enabled && RiftAPI.inRift()
+}