Я нашел свою старую пасту, можеш отсюда взять
// made by T1mKar
package im.expensive.functions.impl.render;
import com.google.common.eventbus.Subscribe;
import com.mojang.blaze3d.matrix.MatrixStack;
import com.mojang.blaze3d.systems.RenderSystem;
import im.expensive.command.friends.FriendStorage;
import im.expensive.events.EventDisplay;
import im.expensive.functions.api.Category;
import im.expensive.functions.api.Function;
import im.expensive.functions.api.FunctionRegister;
import im.expensive.functions.settings.impl.ColorSetting;
import im.expensive.utils.math.MathUtil;
import im.expensive.utils.projections.ProjectionUtil;
import im.expensive.utils.render.ColorUtils;
import net.minecraft.entity.player.PlayerEntity;
import net.minecraft.util.math.AxisAlignedBB;
import net.minecraft.util.math.vector.Vector2f;
import net.minecraft.util.math.vector.Vector3d;
import org.lwjgl.opengl.GL11;
import java.util.HashMap;
import java.util.Map;
import static net.minecraft.client.renderer.WorldRenderer.frustum;
@FunctionRegister(name = "SkeletonESP", type = Category.Render)
public class SkeletonESP extends Function {
public ColorSetting color = new ColorSetting("Color", ColorUtils.rgb(255, 255, 255));
public SkeletonESP() {
toggle();
addSettings(color);
}
private final HashMap<PlayerEntity, Vector3d[]> pointsMap = new HashMap<>();
@Subscribe
public void onDisplay(EventDisplay e) {
if (mc.world == null || e.getType() != EventDisplay.Type.PRE) return;
pointsMap.clear();
float partial = e.getPartialTicks();
for (PlayerEntity player : mc.world.getPlayers()) {
if (player == mc.player) continue;
if (!player.isAlive()) continue;
if (!isInView(player)) continue;
Vector3d[] pts = calcPoints(player, partial);
if (pts != null) pointsMap.put(player, pts);
}
renderSkeletons(e.getMatrixStack());
}
private Vector3d[] calcPoints(PlayerEntity p, float partial) {
double x = MathUtil.interpolate(p.getPosX(), p.lastTickPosX, partial);
double y = MathUtil.interpolate(p.getPosY(), p.lastTickPosY, partial);
double z = MathUtil.interpolate(p.getPosZ(), p.lastTickPosZ, partial);
AxisAlignedBB bb = p.getBoundingBox();
double width = bb.maxX - bb.minX;
double height = bb.maxY - bb.minY;
double centerX = x;
double baseY = y;
double centerZ = z;
double headY = baseY + p.getEyeHeight();
double bodyY = baseY + height * 0.5;
double footY = baseY;
float yaw = (p.prevRotationYaw + (p.rotationYaw - p.prevRotationYaw) * partial);
double sin = Math.sin(Math.toRadians(yaw));
double cos = Math.cos(Math.toRadians(yaw));
double armOffset = width * 0.45;
double legOffset = width * 0.18;
Vector3d head = new Vector3d(centerX, headY, centerZ);
Vector3d body = new Vector3d(centerX, bodyY, centerZ);
double leftArmX = centerX + (armOffset * cos);
double leftArmZ = centerZ + (armOffset * sin);
Vector3d leftArm = new Vector3d(leftArmX, bodyY, leftArmZ);
double rightArmX = centerX + (-armOffset * cos);
double rightArmZ = centerZ + (-armOffset * sin);
Vector3d rightArm = new Vector3d(rightArmX, bodyY, rightArmZ);
double leftLegX = centerX + (legOffset * cos);
double leftLegZ = centerZ + (legOffset * sin);
Vector3d leftLeg = new Vector3d(leftLegX, footY, leftLegZ);
double rightLegX = centerX + (-legOffset * cos);
double rightLegZ = centerZ + (-legOffset * sin);
Vector3d rightLeg = new Vector3d(rightLegX, footY, rightLegZ);
return new Vector3d[]{head, body, leftArm, rightArm, leftLeg, rightLeg};
}
private void renderSkeletons(MatrixStack matrixStack) {
RenderSystem.disableTexture();
RenderSystem.enableBlend();
RenderSystem.defaultBlendFunc();
GL11.glPushAttrib(GL11.GL_ALL_ATTRIB_BITS);
GL11.glLineWidth(1.5f);
int clr = 0xFFFFFFFF;
try {
clr = color.get();
} catch (Exception ignored) {}
for (Map.Entry<PlayerEntity, Vector3d[]> e : pointsMap.entrySet()) {
PlayerEntity p = e.getKey();
Vector3d[] pts = e.getValue();
int useColor = FriendStorage.isFriend(p.getName().getString()) ? ColorUtils.rgb(144,238,144) : clr;
Vector2f head2 = ProjectionUtil.project(pts[0].x, pts[0].y, pts[0].z);
Vector2f body2 = ProjectionUtil.project(pts[1].x, pts[1].y, pts[1].z);
Vector2f leftArm2 = ProjectionUtil.project(pts[2].x, pts[2].y, pts[2].z);
Vector2f rightArm2 = ProjectionUtil.project(pts[3].x, pts[3].y, pts[3].z);
Vector2f leftLeg2 = ProjectionUtil.project(pts[4].x, pts[4].y, pts[4].z);
Vector2f rightLeg2 = ProjectionUtil.project(pts[5].x, pts[5].y, pts[5].z);
if (isInvalid(head2) || isInvalid(body2) || isInvalid(leftArm2) || isInvalid(rightArm2) || isInvalid(leftLeg2) || isInvalid(rightLeg2))
continue;
GL11.glBegin(GL11.GL_LINES);
setGLColor(useColor);
GL11.glVertex2f(head2.x, head2.y);
GL11.glVertex2f(body2.x, body2.y);
GL11.glVertex2f(body2.x, body2.y);
GL11.glVertex2f(leftArm2.x, leftArm2.y);
GL11.glVertex2f(body2.x, body2.y);
GL11.glVertex2f(rightArm2.x, rightArm2.y);
GL11.glVertex2f(body2.x, body2.y);
GL11.glVertex2f(leftLeg2.x, leftLeg2.y);
GL11.glVertex2f(body2.x, body2.y);
GL11.glVertex2f(rightLeg2.x, rightLeg2.y);
GL11.glEnd();
}
GL11.glPopAttrib();
RenderSystem.disableBlend();
RenderSystem.enableTexture();
}
private boolean isInvalid(Vector2f v) {
if (v == null) return true;
return Float.isNaN(v.x) || Float.isNaN(v.y) || v.x == Float.NEGATIVE_INFINITY || v.y == Float.NEGATIVE_INFINITY;
}
private void setGLColor(int c) {
float a = ((c >> 24) & 0xFF) / 255f;
float r = ((c >> 16) & 0xFF) / 255f;
float g = ((c >> 8) & 0xFF) / 255f;
float b = (c & 0xFF) / 255f;
GL11.glColor4f(r, g, b, a == 0f ? 1f : a);
}
public boolean isInView(net.minecraft.entity.Entity ent) {
if (mc.getRenderViewEntity() == null) return false;
frustum.setCameraPosition(mc.getRenderManager().info.getProjectedView().x, mc.getRenderManager().info.getProjectedView().y, mc.getRenderManager().info.getProjectedView().z);
return frustum.isBoundingBoxInFrustum(ent.getBoundingBox()) || ent.ignoreFrustumCheck;
}
}