Skip to content

Commit

Permalink
Added ESP
Browse files Browse the repository at this point in the history
  • Loading branch information
ya-ilya committed Sep 12, 2023
1 parent 8ef4817 commit aee6cb9
Show file tree
Hide file tree
Showing 5 changed files with 79 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,6 @@ public void renderHook(
Matrix4f projectionMatrix,
CallbackInfo callbackInfo
) {
Client.EVENT_BUS.post(new Render3DEvent(matrices));
Client.EVENT_BUS.post(new Render3DEvent(matrices, tickDelta));
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -3,4 +3,4 @@ package org.progreso.client.events.render
import net.minecraft.client.util.math.MatrixStack
import org.progreso.api.event.Event

data class Render3DEvent(val matrices: MatrixStack) : Event()
data class Render3DEvent(val matrices: MatrixStack, val tickDelta: Float) : Event()
Original file line number Diff line number Diff line change
@@ -0,0 +1,75 @@
package org.progreso.client.modules.render

import net.minecraft.entity.Entity
import net.minecraft.entity.mob.Monster
import net.minecraft.entity.mob.WaterCreatureEntity
import net.minecraft.entity.passive.IronGolemEntity
import net.minecraft.entity.passive.PassiveEntity
import net.minecraft.entity.passive.SnowGolemEntity
import net.minecraft.entity.player.PlayerEntity
import net.minecraft.util.math.MathHelper
import net.minecraft.util.math.Vec3d
import org.progreso.api.module.AbstractModule
import org.progreso.client.Client.Companion.mc
import org.progreso.client.events.misc.TickEvent
import org.progreso.client.events.render.Render3DEvent
import org.progreso.client.events.safeEventListener
import org.progreso.client.gui.clickgui.element.elements.ColorElement.Companion.copy
import org.progreso.client.util.render.*
import java.awt.Color

@AbstractModule.AutoRegister
object ESP : AbstractModule() {
private val players by setting("Players", true)
private val monsters by setting("Monsters", false)
private val animals by setting("Animals", false)
private val self by setting("Self", false)

private val colors = setting("colors")
private val playersColor by colors.setting("Players", Color.WHITE)
private val monstersColor by colors.setting("Monsters", Color.RED)
private val animalsColor by setting("Animals", Color.GREEN)

private val renderMap = mutableMapOf<Entity, Color>()

init {
safeEventListener<TickEvent> {
renderMap.clear()

for (entity in mc.world.entities) {
if (entity == mc.player && !self) continue

val (render, color) = when (entity) {
is PlayerEntity -> players to playersColor
is Monster -> monsters to monstersColor
is PassiveEntity, is WaterCreatureEntity, is SnowGolemEntity, is IronGolemEntity -> animals to animalsColor
else -> continue
}

if (render) renderMap[entity] = color
}
}

safeEventListener<Render3DEvent> { event ->
for ((entity, color) in renderMap) {
val pos = Vec3d(
MathHelper.lerp(event.tickDelta.toDouble(), entity.lastRenderX, entity.x) - entity.x,
MathHelper.lerp(event.tickDelta.toDouble(), entity.lastRenderY, entity.y) - entity.y,
MathHelper.lerp(event.tickDelta.toDouble(), entity.lastRenderZ, entity.z) - entity.z
)

render3D(event.matrices) {
withPosition(pos) {
withColor(color.copy(50)) {
drawSolidBox(entity.boundingBox)
}

withColor(color.copy(100)) {
drawOutlinedBox(entity.boundingBox)
}
}
}
}
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -98,6 +98,7 @@
"module.AutoWalk.description": "Automatically walks in the specified direction",
"module.SafeWalk.description": "Prevents you from walking off edges",
"module.Sprint.description": "Automatically makes the player sprint",
"module.ESP.description": "Draws entities through blocks",
"module.FullBright.description": "Changes game gamma to maximum",
"module.StorageESP.description": "Draws storages through blocks"
}
Original file line number Diff line number Diff line change
Expand Up @@ -98,6 +98,7 @@
"module.AutoWalk.description": "Автоматически ходит в заданном направлении",
"module.SafeWalk.description": "Предотвращает схождение с краев блоков",
"module.Sprint.description": "Автоматически зажимает кнопку спринта",
"module.ESP.description": "Показывает сущностей через блоки",
"module.FullBright.description": "Изменяет гамму игры на максимум",
"module.StorageESP.description": "Показывает сундуки через блоки"
}

0 comments on commit aee6cb9

Please sign in to comment.