Skip to content

Commit

Permalink
Readded ItemHighlight
Browse files Browse the repository at this point in the history
  • Loading branch information
odtheking committed May 4, 2024
1 parent 1575425 commit c8ef6f2
Show file tree
Hide file tree
Showing 4 changed files with 20 additions and 24 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -110,7 +110,7 @@ object ModuleManager {
KuudraRequeue,
EnrageDisplay,
BlockOverlay,
//ItemsHighlight,
ItemsHighlight,
GoldorTimer,
VisualWords,
HidePlayers,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,22 +2,16 @@ package me.odinmain.features.impl.render

import me.odinmain.OdinMain.isLegitVersion
import me.odinmain.events.impl.PostEntityMetadata
import me.odinmain.events.impl.RenderEntityModelEvent
import me.odinmain.features.Category
import me.odinmain.features.Module
import me.odinmain.features.settings.Setting.Companion.withDependency
import me.odinmain.features.settings.impl.*
import me.odinmain.utils.ServerUtils.getPing
import me.odinmain.utils.equalsOneOf
import me.odinmain.utils.getPositionEyes
import me.odinmain.utils.profile
import me.odinmain.utils.render.*
import me.odinmain.utils.render.RenderUtils.renderBoundingBox
import me.odinmain.utils.render.RenderUtils.renderVec
import me.odinmain.utils.render.Color
import me.odinmain.utils.render.HighlightRenderer
import net.minecraft.entity.Entity
import net.minecraft.entity.boss.EntityWither
import net.minecraft.entity.item.EntityArmorStand
import net.minecraftforge.client.event.RenderWorldLastEvent
import net.minecraftforge.fml.common.eventhandler.SubscribeEvent


Expand Down Expand Up @@ -60,7 +54,7 @@ object CustomHighlight : Module(
}
}

@SubscribeEvent
/* @SubscribeEvent
fun onRenderEntityModel(event: RenderEntityModelEvent) {
if (mode != 0 || event.entity !in currentEntities || (!mc.thePlayer.canEntityBeSeen(event.entity) && !renderThrough)) return
//profile("Outline Esp") { OutlineUtils.outlineEntity(event, thickness, color, true) }
Expand All @@ -78,7 +72,7 @@ object CustomHighlight : Module(
else if (mode == 3 && (mc.thePlayer.canEntityBeSeen(it) || renderThrough))
Renderer.draw2DEntity(it, thickness, color)
}}
}
}*/

@SubscribeEvent
fun postMeta(event: PostEntityMetadata) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,14 @@ package me.odinmain.features.impl.skyblock

import me.odinmain.features.Category
import me.odinmain.features.Module
import me.odinmain.features.impl.render.CustomHighlight.renderThrough
import me.odinmain.features.impl.render.CustomHighlight.thickness
import me.odinmain.features.settings.impl.BooleanSetting
import me.odinmain.features.settings.impl.NumberSetting
import me.odinmain.features.settings.impl.SelectorSetting
import me.odinmain.utils.render.Color
import me.odinmain.utils.render.HighlightRenderer
import me.odinmain.utils.render.HighlightRenderer.highlightModeDefault
import me.odinmain.utils.render.HighlightRenderer.highlightModeList
import me.odinmain.utils.skyblock.LocationUtils
import me.odinmain.utils.skyblock.getRarity
import me.odinmain.utils.skyblock.lore
import net.minecraft.entity.item.EntityItem
Expand All @@ -16,11 +19,13 @@ object ItemsHighlight : Module(
description = "Outlines dropped item entities.",
category = Category.RENDER
) {
val mode: Int by SelectorSetting("Mode", HighlightRenderer.highlightModeDefault, HighlightRenderer.highlightModeList)
private val renderThrough: Boolean by BooleanSetting("Through Walls", true)
private val mode: Int by SelectorSetting("Mode", highlightModeDefault, highlightModeList)
private val thickness: Float by NumberSetting("Line Width", 0.5f, 0.2f, 1f, .1f, description = "The line width of Outline / Boxes/ 2D Boxes")

init {
HighlightRenderer.addEntityGetter({ HighlightRenderer.HighlightType.entries[mode]}) {
if (!enabled) emptyList()
if (!enabled || !LocationUtils.inSkyblock) emptyList()
else mc.theWorld.loadedEntityList.filterIsInstance<EntityItem>().map {
HighlightRenderer.HighlightEntity(it, getEntityOutlineColor(it), thickness, !renderThrough, 1f)
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,34 +4,31 @@ import me.odinmain.OdinMain.mc
import me.odinmain.events.impl.RenderOverlayNoCaching
import me.odinmain.ui.util.shader.GlowShader
import me.odinmain.ui.util.shader.OutlineShader
import me.odinmain.ui.util.shader.OutlineShaderOPT
import me.odinmain.utils.clock.Executor
import me.odinmain.utils.clock.Executor.Companion.register
import me.odinmain.utils.render.RenderUtils.renderBoundingBox
import net.minecraft.client.renderer.GlStateManager
import net.minecraft.client.renderer.RenderHelper
import net.minecraft.entity.Entity
import net.minecraftforge.client.event.RenderGameOverlayEvent
import net.minecraftforge.client.event.RenderWorldLastEvent
import net.minecraftforge.fml.common.eventhandler.SubscribeEvent

object HighlightRenderer {
enum class HighlightType {
Outline, Overlay, Boxes, Box2d, Glow
Outline, Glow, Boxes, Box2d, Overlay
}
data class HighlightEntity(val entity: Entity, val color: Color, val thickness: Float, val depth: Boolean, val glowIntensity: Float = 1f)
const val highlightModeDefault = "Outline"
val highlightModeList = arrayListOf("Outline", "Overlay", "Boxes", "Box 2D", "Glow")
val highlightModeList = arrayListOf("Outline", "Glow", "Boxes", "Box 2D", "Overlay")
val highlightModeList2 = arrayListOf("Outline", "Boxes", "Box 2D", "Glow")

private val entityGetters: MutableList<Pair<() -> HighlightType, () -> Collection<HighlightEntity>>> = mutableListOf()
private val entities = mapOf<HighlightType, MutableList<HighlightEntity>>(
HighlightType.Outline to mutableListOf(),
HighlightType.Overlay to mutableListOf(),
HighlightType.Glow to mutableListOf(),
HighlightType.Boxes to mutableListOf(),
HighlightType.Box2d to mutableListOf(),
HighlightType.Glow to mutableListOf()
)
HighlightType.Overlay to mutableListOf()
)

fun addEntityGetter(type: () -> HighlightType, getter: () -> Collection<HighlightEntity>) {
this.entityGetters.add(type to getter)
Expand All @@ -52,7 +49,7 @@ object HighlightRenderer {
Renderer.drawBox(it.entity.renderBoundingBox, it.color, it.thickness, depth = it.depth, fillAlpha = 0)
}
entities[HighlightType.Box2d]?.forEach {
Renderer.draw2DEntity(it.entity, it.thickness, it.color)
Renderer.draw2DEntity(it.entity, it.thickness * 6, it.color)
}
}

Expand Down

0 comments on commit c8ef6f2

Please sign in to comment.