Skip to content

Instantly share code, notes, and snippets.

@SuperSkidder
Created November 14, 2021 03:18
Show Gist options
  • Save SuperSkidder/dc1be1ed65d9e2dbaa41200f531bfeef to your computer and use it in GitHub Desktop.
Save SuperSkidder/dc1be1ed65d9e2dbaa41200f531bfeef to your computer and use it in GitHub Desktop.
@EventHandler
private void onRender3D(EventRender3D e) {
if (target != null && esp.getValue()) {
drawShadow(target, e.getPartialTicks(), yPos, direction);
drawCircle(target, e.getPartialTicks(), yPos);
}
}
TimerUtil timerUtil = new TimerUtil();
@EventHandler
private void onRender2D(EventRender2D e) {
if(timerUtil.delay(10)) {
if (direction) {
yPos += 0.03;
if (2 - yPos < 0.02) {
direction = false;
}
} else {
yPos -= 0.03;
if (yPos < 0.02) {
direction = true;
}
}
timerUtil.reset();
}
}
private void drawShadow(Entity entity, float partialTicks, float pos, boolean direction) {
GL11.glPushMatrix();
GL11.glEnable(GL11.GL_BLEND);
GL11.glDisable(GL11.GL_DEPTH_TEST);
GL11.glDisable(GL11.GL_TEXTURE_2D);
GL11.glShadeModel((int) 7425);
double x = entity.lastTickPosX + (entity.posX - entity.lastTickPosX) * (double) partialTicks - mc.getRenderManager().viewerPosX;
double y = entity.lastTickPosY + (entity.posY - entity.lastTickPosY) * (double) partialTicks - mc.getRenderManager().viewerPosY + pos;
double z = entity.lastTickPosZ + (entity.posZ - entity.lastTickPosZ) * (double) partialTicks - mc.getRenderManager().viewerPosZ;
GL11.glBegin(GL11.GL_QUAD_STRIP);
for (int i = 0; i <= 180; i++) {
double c1 = i * Math.PI * 2 / 180;
double c2 = (i + 1) * Math.PI * 2 / 180;
GlStateManager.color(1, 1, 1, 0.3f);
GL11.glVertex3d(x + 0.5 * Math.cos(c1), y, z + 0.5 * Math.sin(c1));
GL11.glVertex3d(x + 0.5 * Math.cos(c2), y, z + 0.5 * Math.sin(c2));
GlStateManager.color(1, 1, 1, 0f);
GL11.glVertex3d(x + 0.5 * Math.cos(c1), y + (direction ? -0.2 : 0.2), z + 0.5 * Math.sin(c1));
GL11.glVertex3d(x + 0.5 * Math.cos(c2), y + (direction ? -0.2 : 0.2), z + 0.5 * Math.sin(c2));
}
GL11.glEnd();
GL11.glEnable(GL11.GL_TEXTURE_2D);
GL11.glShadeModel((int) 7424);
GL11.glEnable(GL11.GL_DEPTH_TEST);
GL11.glDisable(GL11.GL_BLEND);
GL11.glPopMatrix();
}
private void drawCircle(Entity entity, float partialTicks, float pos) {
GL11.glPushMatrix();
GL11.glEnable(GL11.GL_BLEND);
GL11.glDisable(GL11.GL_DEPTH_TEST);
GL11.glDisable(GL11.GL_TEXTURE_2D);
GL11.glShadeModel((int) 7425);
GL11.glLineWidth(1);
double x = entity.lastTickPosX + (entity.posX - entity.lastTickPosX) * (double) partialTicks - mc.getRenderManager().viewerPosX;
double y = entity.lastTickPosY + (entity.posY - entity.lastTickPosY) * (double) partialTicks - mc.getRenderManager().viewerPosY + pos;
double z = entity.lastTickPosZ + (entity.posZ - entity.lastTickPosZ) * (double) partialTicks - mc.getRenderManager().viewerPosZ;
GL11.glBegin(GL11.GL_LINE_STRIP);
for (int i = 0; i <= 180; i++) {
double c1 = i * Math.PI * 2 / 180;
GlStateManager.color(2, 1, 1, 1);
GL11.glVertex3d(x + 0.5 * Math.cos(c1), y, z + 0.5 * Math.sin(c1));
}
GL11.glEnd();
GL11.glEnable(GL11.GL_TEXTURE_2D);
GL11.glShadeModel((int) 7424);
GL11.glEnable(GL11.GL_DEPTH_TEST);
GL11.glDisable(GL11.GL_BLEND);
GL11.glPopMatrix();
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment