Skip to content

Commit

Permalink
feat/fix: esp gaussian mode & fixed esp inside dorender not following…
Browse files Browse the repository at this point in the history
… condition
  • Loading branch information
opZywl committed Dec 31, 2024
1 parent 71f97ea commit a1387d7
Show file tree
Hide file tree
Showing 2 changed files with 35 additions and 19 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ object ESP : Module("ESP", Category.VISUAL, hideModule = false) {

val mode by choices(
"Mode",
arrayOf("Box", "OtherBox", "WireFrame", "2D", "Real2D", "Outline", "Glow"), "Box"
arrayOf("Box", "OtherBox", "WireFrame", "2D", "Real2D", "Gaussian", "Outline", "Glow"), "Box"
)

val outlineWidth by float("Outline-Width", 3f, 0.5f..5f) { mode == "Outline" }
Expand All @@ -54,7 +54,7 @@ object ESP : Module("ESP", Category.VISUAL, hideModule = false) {

private val espColorMode by choices("ESP-Color", arrayOf("Custom", "Rainbow"), "Custom")
private val espColor = ColorSettingsInteger(this, "ESP", withAlpha = false)
{ espColorMode == "Custom" }.with(255, 255, 255)
{ espColorMode in arrayOf("Custom", "Gaussian") }.with(255, 255, 255)

private val maxRenderDistance by object : IntegerValue("MaxRenderDistance", 100, 1..200) {
override fun onUpdate(value: Int) {
Expand All @@ -72,17 +72,12 @@ object ESP : Module("ESP", Category.VISUAL, hideModule = false) {
field = if (value <= 0.0) maxRenderDistance.toDouble().pow(2.0) else value
}

private val colorTeam by boolean("Team", false)
private val colorTeam by boolean("TeamColor", false)
private val bot by boolean("Bots", true)

var renderNameTags = true

private val entities by EntityLookup<EntityLivingBase>()
.filter { bot || !isBot(it) }
.filter { isSelected(it, false) }
.filter { !onLook || isLookingOnEntities(it, maxAngleDifference.toDouble()) }
.filter { mc.thePlayer.getDistanceSqToEntity(it) <= maxRenderDistanceSq }
.filter { thruBlocks || isEntityHeightVisible(it) }
private val entities by EntityLookup<EntityLivingBase>().filter { shouldRender(it) }

val onRender3D = handler<Render3DEvent> {
if (entities.isEmpty())
Expand Down Expand Up @@ -222,7 +217,13 @@ object ESP : Module("ESP", Category.VISUAL, hideModule = false) {
}

fun shouldRender(entity: EntityLivingBase): Boolean {
return (bot || !isBot(entity))
val player = mc.thePlayer ?: return false

return (player.getDistanceSqToEntity(entity) <= maxRenderDistanceSq
&& (thruBlocks || isEntityHeightVisible(entity))
&& (!onLook || isLookingOnEntities(entity, maxAngleDifference.toDouble()))
&& isSelected(entity, false)
&& (bot || !isBot(entity)))
}

}
Original file line number Diff line number Diff line change
Expand Up @@ -99,28 +99,32 @@ protected <T extends EntityLivingBase> void rotateCorpse(T p_rotateCorpse_1_, fl
@Inject(method = "doRender(Lnet/minecraft/entity/EntityLivingBase;DDDFF)V", at = @At("HEAD"), cancellable = true)
private <T extends EntityLivingBase> void injectChamsPre(T entity, double x, double y, double z, float entityYaw, float partialTicks, CallbackInfo callbackInfo) {
final Chams chams = Chams.INSTANCE;
final ESP esp = ESP.INSTANCE;
boolean shouldRender = chams.handleEvents() && chams.getTargets() && EntityUtils.INSTANCE.isSelected(entity, false) || esp.handleEvents() && esp.shouldRender(entity) && esp.getMode().equals("Gaussian");
final NoRender noRender = NoRender.INSTANCE;

if (noRender.handleEvents() && noRender.shouldStopRender(entity)) {
callbackInfo.cancel();
return;
}

if (chams.getState() && chams.getTargets() && chams.getLegacyMode() && ((chams.getLocalPlayerValue() && entity == mc.thePlayer) || EntityUtils.INSTANCE.isSelected(entity, false))) {
if (shouldRender) {
glEnable(GL_POLYGON_OFFSET_FILL);
glPolygonOffset(1.0F, -1000000F);
glPolygonOffset(1f, -1000000F);
}
}

@Inject(method = "doRender(Lnet/minecraft/entity/EntityLivingBase;DDDFF)V", at = @At("RETURN"))
private <T extends EntityLivingBase> void injectChamsPost(T entity, double x, double y, double z, float entityYaw, float partialTicks, CallbackInfo callbackInfo) {
final Chams chams = Chams.INSTANCE;
final ESP esp = ESP.INSTANCE;
boolean shouldRender = chams.handleEvents() && chams.getTargets() && EntityUtils.INSTANCE.isSelected(entity, false) || esp.handleEvents() && esp.shouldRender(entity) && esp.getMode().equals("Gaussian");
final NoRender noRender = NoRender.INSTANCE;

if (chams.getState() && chams.getTargets() && chams.getLegacyMode() && ((chams.getLocalPlayerValue() && entity == mc.thePlayer) || EntityUtils.INSTANCE.isSelected(entity, false))) {
if (shouldRender) {
if (!(noRender.getState() && noRender.shouldStopRender(entity))) {
glPolygonOffset(1.0F, 1000000F);
glDisable(GL_POLYGON_OFFSET_FILL);
glPolygonOffset(1f, 1000000F);
glDisable(GL_POLYGON_OFFSET_FILL);
}
}
}
Expand Down Expand Up @@ -298,8 +302,16 @@ protected <T extends EntityLivingBase> void renderModel(T entitylivingbaseIn, fl
boolean chamsFlag = (chams.handleEvents() && chams.getTargets() && !chams.getLegacyMode() && ((chams.getLocalPlayerValue() && entitylivingbaseIn == mc.thePlayer) || EntityUtils.INSTANCE.isSelected(entitylivingbaseIn, false)));
boolean semiVisible = !visible && (!entitylivingbaseIn.isInvisibleToPlayer(mc.thePlayer) || (trueSight.handleEvents() && trueSight.getEntities()));
if(visible || semiVisible) {
if(!this.bindEntityTexture(entitylivingbaseIn))
return;
final ESP esp = ESP.INSTANCE;
boolean shouldRenderGaussianESP = esp.handleEvents() && esp.shouldRender(entitylivingbaseIn) && esp.getMode().equals("Gaussian");
if (!shouldRenderGaussianESP) {
if (!bindEntityTexture(entitylivingbaseIn)) {
return;
}
} else {
bindTexture(0);
RenderUtils.INSTANCE.glColor(esp.getColor(entitylivingbaseIn));
}

if (semiVisible) {
pushMatrix();
Expand All @@ -310,8 +322,7 @@ protected <T extends EntityLivingBase> void renderModel(T entitylivingbaseIn, fl
alphaFunc(516, 0.003921569F);
}

final ESP esp = ESP.INSTANCE;
if (esp.handleEvents() && esp.shouldRender(entitylivingbaseIn) && EntityUtils.INSTANCE.isSelected(entitylivingbaseIn, false)) {
if (esp.handleEvents() && esp.shouldRender(entitylivingbaseIn)) {
boolean fancyGraphics = mc.gameSettings.fancyGraphics;
mc.gameSettings.fancyGraphics = false;

Expand Down Expand Up @@ -441,6 +452,10 @@ protected <T extends EntityLivingBase> void renderModel(T entitylivingbaseIn, fl
glPopMatrix();
}

if (shouldRenderGaussianESP) {
resetColor();
}

if (semiVisible) {
disableBlend();
alphaFunc(516, 0.1F);
Expand Down

0 comments on commit a1387d7

Please sign in to comment.