summaryrefslogtreecommitdiff
path: root/src/main/java/at/hannibal2/skyhanni/utils
diff options
context:
space:
mode:
authorEmpa <42304516+ItsEmpa@users.noreply.github.com>2024-09-09 12:00:51 +0200
committerGitHub <noreply@github.com>2024-09-09 12:00:51 +0200
commit5e77ccdf9c55ba3791427b67dc9456d5ae874380 (patch)
tree19d4ddbdf4e94b755c3c151c9bea2e5433c85706 /src/main/java/at/hannibal2/skyhanni/utils
parent31134aabbf803ac8f3caf0bff98b12eef8821bc9 (diff)
downloadskyhanni-5e77ccdf9c55ba3791427b67dc9456d5ae874380.tar.gz
skyhanni-5e77ccdf9c55ba3791427b67dc9456d5ae874380.tar.bz2
skyhanni-5e77ccdf9c55ba3791427b67dc9456d5ae874380.zip
Feature: Miniboss timer (#2042)
Co-authored-by: hannibal2 <24389977+hannibal00212@users.noreply.github.com> Co-authored-by: ItsEmpa <itsempa@users.noreply.github.com>
Diffstat (limited to 'src/main/java/at/hannibal2/skyhanni/utils')
-rw-r--r--src/main/java/at/hannibal2/skyhanni/utils/EntityUtils.kt18
1 files changed, 11 insertions, 7 deletions
diff --git a/src/main/java/at/hannibal2/skyhanni/utils/EntityUtils.kt b/src/main/java/at/hannibal2/skyhanni/utils/EntityUtils.kt
index 5e85bb64f..5f52508f2 100644
--- a/src/main/java/at/hannibal2/skyhanni/utils/EntityUtils.kt
+++ b/src/main/java/at/hannibal2/skyhanni/utils/EntityUtils.kt
@@ -27,12 +27,15 @@ import net.minecraft.entity.monster.EntityEnderman
import net.minecraft.entity.player.EntityPlayer
import net.minecraft.item.ItemStack
import net.minecraft.potion.Potion
+import net.minecraft.scoreboard.ScorePlayerTeam
+import net.minecraft.tileentity.TileEntity
import net.minecraft.util.AxisAlignedBB
import net.minecraftforge.client.event.RenderLivingEvent
//#if FORGE
import net.minecraftforge.fml.common.eventhandler.Event
import net.minecraftforge.fml.common.eventhandler.SubscribeEvent
+
//#endif
@SkyHanniModule
@@ -131,8 +134,7 @@ object EntityUtils {
return gameProfile.properties.entries()
.filter { it.key == "textures" }
.map { it.value }
- .firstOrNull { it.name == "textures" }
- ?.value
+ .firstOrNull { it.name == "textures" }?.value
}
inline fun <reified T : Entity> getEntitiesNextToPlayer(radius: Double): Sequence<T> =
@@ -182,6 +184,10 @@ object EntityUtils {
) it else it.toMutableList() // TODO: while i am here, i want to point out that copying the entity list does not constitute proper synchronization, but *does* make crashes because of it rarer.
}?.asSequence()?.filterNotNull() ?: emptySequence()
+ fun getAllTileEntities(): Sequence<TileEntity> = Minecraft.getMinecraft()?.theWorld?.loadedTileEntityList?.let {
+ if (Minecraft.getMinecraft().isCallingFromMinecraftThread) it else it.toMutableList()
+ }?.asSequence()?.filterNotNull() ?: emptySequence()
+
fun Entity.canBeSeen(radius: Double = 150.0) = getLorenzVec().add(y = 0.5).canBeSeen(radius)
fun getEntityByID(entityId: Int) = Minecraft.getMinecraft()?.thePlayer?.entityWorld?.getEntityByID(entityId)
@@ -217,11 +223,10 @@ object EntityUtils {
SkyHanniRenderEntityEvent.Post(event.entity, event.renderer, event.x, event.y, event.z).postAndCatch()
}
-//#if MC < 11400
+ //#if MC < 11400
@SubscribeEvent
fun onEntityRenderSpecialsPre(
- event:
- RenderLivingEvent.Specials.Pre<*>,
+ event: RenderLivingEvent.Specials.Pre<*>,
) {
val shEvent = SkyHanniRenderEntityEvent.Specials.Pre(event.entity, event.renderer, event.x, event.y, event.z)
if (shEvent.postAndCatch()) {
@@ -231,8 +236,7 @@ object EntityUtils {
@SubscribeEvent
fun onEntityRenderSpecialsPost(
- event:
- RenderLivingEvent.Specials.Post<*>,
+ event: RenderLivingEvent.Specials.Post<*>,
) {
SkyHanniRenderEntityEvent.Specials.Post(event.entity, event.renderer, event.x, event.y, event.z).postAndCatch()
}