diff options
Diffstat (limited to 'src/main/java/at/hannibal2/skyhanni')
5 files changed, 43 insertions, 37 deletions
diff --git a/src/main/java/at/hannibal2/skyhanni/config/features/FishingConfig.java b/src/main/java/at/hannibal2/skyhanni/config/features/FishingConfig.java index 896c572f0..cfc73ad94 100644 --- a/src/main/java/at/hannibal2/skyhanni/config/features/FishingConfig.java +++ b/src/main/java/at/hannibal2/skyhanni/config/features/FishingConfig.java @@ -192,7 +192,7 @@ public class FishingConfig { } @Expose - @ConfigOption(name = "Rare Sea Creature Highlight", desc = "Highlight rare sea creatures in blue color.") + @ConfigOption(name = "Highlight Rare", desc = "Highlight rare sea creatures in blue color.") @ConfigEditorBoolean @FeatureToggle public boolean rareSeaCreatureHighlight = false; diff --git a/src/main/java/at/hannibal2/skyhanni/events/RenderEntityOutlineEvent.kt b/src/main/java/at/hannibal2/skyhanni/events/RenderEntityOutlineEvent.kt index 5efc7cd94..21e18bd6c 100644 --- a/src/main/java/at/hannibal2/skyhanni/events/RenderEntityOutlineEvent.kt +++ b/src/main/java/at/hannibal2/skyhanni/events/RenderEntityOutlineEvent.kt @@ -30,7 +30,7 @@ class RenderEntityOutlineEvent(theType: Type?, potentialEntities: HashSet<Entity *
* This will modify {@param potentialEntities} internally, so make a copy before passing it if necessary.
*
- * @param theType of the event (see [Type]
+ * @param theType of the event (see [Type]
*/
init {
type = theType
diff --git a/src/main/java/at/hannibal2/skyhanni/features/fishing/SeaCreatureFeatures.kt b/src/main/java/at/hannibal2/skyhanni/features/fishing/SeaCreatureFeatures.kt index 9f7ef0fa5..883607b70 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/fishing/SeaCreatureFeatures.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/fishing/SeaCreatureFeatures.kt @@ -7,27 +7,18 @@ import at.hannibal2.skyhanni.events.RenderEntityOutlineEvent import at.hannibal2.skyhanni.events.withAlpha import at.hannibal2.skyhanni.features.damageindicator.DamageIndicatorManager import at.hannibal2.skyhanni.mixins.hooks.RenderLivingEntityHelper -import at.hannibal2.skyhanni.utils.* -import at.hannibal2.skyhanni.utils.EntityUtils.getSkinTexture import at.hannibal2.skyhanni.utils.EntityUtils.hasMaxHealth import at.hannibal2.skyhanni.utils.LocationUtils.distanceToPlayer +import at.hannibal2.skyhanni.utils.LorenzColor +import at.hannibal2.skyhanni.utils.LorenzUtils import at.hannibal2.skyhanni.utils.LorenzUtils.baseMaxHealth import at.hannibal2.skyhanni.utils.LorenzUtils.editCopy -import net.minecraft.client.Minecraft -import net.minecraft.client.entity.EntityOtherPlayerMP -import net.minecraft.client.gui.FontRenderer import net.minecraft.entity.Entity import net.minecraft.entity.EntityLivingBase -import net.minecraft.entity.item.EntityItem import net.minecraft.entity.monster.EntityGuardian -import net.minecraft.entity.monster.EntitySkeleton import net.minecraft.entity.monster.EntityZombie import net.minecraft.entity.player.EntityPlayer -import net.minecraft.scoreboard.ScorePlayerTeam -import net.minecraft.scoreboard.Team.EnumVisible -import net.minecraftforge.client.event.RenderWorldLastEvent import net.minecraftforge.fml.common.eventhandler.SubscribeEvent -import java.awt.Color class SeaCreatureFeatures { @@ -78,15 +69,17 @@ class SeaCreatureFeatures { private fun isEnabled() = LorenzUtils.inSkyBlock && !LorenzUtils.inDungeons && !LorenzUtils.inKuudraFight - private val getEntityOutlineColor: (entity: Entity) -> Int? = { e -> - if (EntityLivingBase::class.java.isInstance(e) && e in rareSeaCreatures && e.distanceToPlayer() < 30) { + private val getEntityOutlineColor: (entity: Entity) -> Int? = { entity -> + if (EntityLivingBase::class.java.isInstance(entity) && entity in rareSeaCreatures && entity.distanceToPlayer() < 30) { LorenzColor.GREEN.toColor().rgb - } else { - null - } + } else null } - enum class RareSeaCreatureType(val clazz: Class<out EntityLivingBase>, val nametag: String, vararg val health: Int) { + enum class RareSeaCreatureType( + val clazz: Class<out EntityLivingBase>, + val nametag: String, + vararg val health: Int + ) { WATER_HYDRA(EntityZombie::class.java, "Water Hydra", 500_000, 1_500_000), SEA_EMPEROR(EntityGuardian::class.java, "The Sea Emperors", 750_000, 800_000, 2_250_000, 2_400_000), ZOMBIE_MINER(EntityPlayer::class.java, "", 2_000_000, 6_000_000), diff --git a/src/main/java/at/hannibal2/skyhanni/mixins/hooks/RendererLivingEntityHook.kt b/src/main/java/at/hannibal2/skyhanni/mixins/hooks/RendererLivingEntityHook.kt index a06e6d89e..c91252c8a 100644 --- a/src/main/java/at/hannibal2/skyhanni/mixins/hooks/RendererLivingEntityHook.kt +++ b/src/main/java/at/hannibal2/skyhanni/mixins/hooks/RendererLivingEntityHook.kt @@ -6,15 +6,15 @@ import net.minecraft.entity.EntityLivingBase class RendererLivingEntityHook {
fun setOutlineColor(red: Float, green: Float, blue: Float, alpha: Float, entity: EntityLivingBase) {
- val color = EntityOutlineRenderer.getCustomOutlineColor(entity);
+ val color = EntityOutlineRenderer.getCustomOutlineColor(entity)
if (color != null) {
val colorRed = (color shr 16 and 255).toFloat() / 255.0f
val colorGreen = (color shr 8 and 255).toFloat() / 255.0f
val colorBlue = (color and 255).toFloat() / 255.0f
- GlStateManager.color(colorRed, colorGreen, colorBlue, alpha);
+ GlStateManager.color(colorRed, colorGreen, colorBlue, alpha)
} else {
- GlStateManager.color(red, green, blue, alpha);
+ GlStateManager.color(red, green, blue, alpha)
}
}
}
\ No newline at end of file diff --git a/src/main/java/at/hannibal2/skyhanni/utils/EntityOutlineRenderer.kt b/src/main/java/at/hannibal2/skyhanni/utils/EntityOutlineRenderer.kt index e86d5bfda..049a89f0b 100644 --- a/src/main/java/at/hannibal2/skyhanni/utils/EntityOutlineRenderer.kt +++ b/src/main/java/at/hannibal2/skyhanni/utils/EntityOutlineRenderer.kt @@ -14,11 +14,8 @@ import net.minecraft.entity.Entity import net.minecraft.entity.EntityLivingBase import net.minecraft.util.BlockPos import net.minecraftforge.client.MinecraftForgeClient -import net.minecraftforge.common.MinecraftForge import net.minecraftforge.fml.common.eventhandler.EventPriority import net.minecraftforge.fml.common.eventhandler.SubscribeEvent -import net.minecraftforge.fml.common.gameevent.TickEvent -import net.minecraftforge.fml.common.gameevent.TickEvent.ClientTickEvent import org.lwjgl.opengl.GL11 import org.lwjgl.opengl.GL13 import org.lwjgl.opengl.GL30 @@ -33,7 +30,7 @@ import java.lang.reflect.Method * https://github.com/BiscuitDevelopment/SkyblockAddons/blob/main/src/main/java/codes/biscuit/skyblockaddons/features/EntityOutlines/EntityOutlineRenderer.java * */ - object EntityOutlineRenderer { +object EntityOutlineRenderer { private val entityRenderCache: CachedInfo = CachedInfo(null, null, null) private var stopLookingForOptifine = false private var isFastRender: Method? = null @@ -286,11 +283,18 @@ import java.lang.reflect.Method private fun shouldRender(camera: ICamera, entity: Entity, vector: LorenzVec): Boolean = // Only render the view entity when sleeping or in 3rd person mode if (entity === mc.renderViewEntity && - !(mc.renderViewEntity is EntityLivingBase && (mc.renderViewEntity as EntityLivingBase).isPlayerSleeping || - mc.gameSettings.thirdPersonView != 0)) { + !(mc.renderViewEntity is EntityLivingBase && (mc.renderViewEntity as EntityLivingBase).isPlayerSleeping || + mc.gameSettings.thirdPersonView != 0) + ) { false - } else mc.theWorld.isBlockLoaded(BlockPos(entity)) && (mc.renderManager.shouldRender(entity, camera, vector.x, vector.y, vector.z) || entity.riddenByEntity === mc.thePlayer) - // Only render if renderManager would render and the world is loaded at the entity + } else mc.theWorld.isBlockLoaded(BlockPos(entity)) && (mc.renderManager.shouldRender( + entity, + camera, + vector.x, + vector.y, + vector.z + ) || entity.riddenByEntity === mc.thePlayer) + // Only render if renderManager would render and the world is loaded at the entity private fun outlineColor(color: Int) { BUF_FLOAT_4.put(0, (color shr 16 and 255).toFloat() / 255.0f) @@ -318,9 +322,11 @@ import java.lang.reflect.Method if (OpenGlHelper.isFramebufferEnabled()) { OpenGlHelper.glBindFramebuffer(GL30.GL_READ_FRAMEBUFFER, frameToCopy!!.framebufferObject) OpenGlHelper.glBindFramebuffer(GL30.GL_DRAW_FRAMEBUFFER, frameToPaste!!.framebufferObject) - GL30.glBlitFramebuffer(0, 0, frameToCopy.framebufferWidth, frameToCopy.framebufferHeight, - 0, 0, frameToPaste.framebufferWidth, frameToPaste.framebufferHeight, - buffersToCopy, GL11.GL_NEAREST) + GL30.glBlitFramebuffer( + 0, 0, frameToCopy.framebufferWidth, frameToCopy.framebufferHeight, + 0, 0, frameToPaste.framebufferWidth, frameToPaste.framebufferHeight, + buffersToCopy, GL11.GL_NEAREST + ) } } @@ -353,10 +359,13 @@ import java.lang.reflect.Method // These events need to be called in this specific order for the xray to have priority over the no xray // Get all entities to render xray outlines val xrayOutlineEvent = RenderEntityOutlineEvent(RenderEntityOutlineEvent.Type.XRAY, null) - MinecraftForge.EVENT_BUS.post(xrayOutlineEvent) + xrayOutlineEvent.postAndCatch() // Get all entities to render no xray outlines, using pre-filtered entities (no need to test xray outlined entities) - val noxrayOutlineEvent = RenderEntityOutlineEvent(RenderEntityOutlineEvent.Type.NO_XRAY, xrayOutlineEvent.entitiesToChooseFrom) - MinecraftForge.EVENT_BUS.post(noxrayOutlineEvent) + val noxrayOutlineEvent = RenderEntityOutlineEvent( + RenderEntityOutlineEvent.Type.NO_XRAY, + xrayOutlineEvent.entitiesToChooseFrom + ) + noxrayOutlineEvent.postAndCatch() // Cache the entities for future use entityRenderCache.xrayCache = xrayOutlineEvent.entitiesToOutline entityRenderCache.noXrayCache = noxrayOutlineEvent.entitiesToOutline @@ -379,5 +388,9 @@ import java.lang.reflect.Method } } - private class CachedInfo(var xrayCache: HashMap<Entity, Int>?, var noXrayCache: HashMap<Entity, Int>?, var noOutlineCache: HashSet<Entity>?) + private class CachedInfo( + var xrayCache: HashMap<Entity, Int>?, + var noXrayCache: HashMap<Entity, Int>?, + var noOutlineCache: HashSet<Entity>? + ) }
\ No newline at end of file |