package im.expensive.functions.impl.render; import com.google.common.eventbus.Subscribe; import im.expensive.command.friends.FriendStorage; import im.expensive.events.WorldEvent; import im.expensive.functions.api.Category; import im.expensive.functions.api.Function; import im.expensive.functions.api.FunctionRegister; import im.expensive.functions.impl.combat.AntiBot; import im.expensive.functions.settings.impl.BooleanSetting; import im.expensive.utils.EntityUtils; import im.expensive.utils.render.ColorUtils; import net.minecraft.client.entity.player.AbstractClientPlayerEntity; import net.minecraft.client.renderer.vertex.DefaultVertexFormats; import net.minecraft.util.math.vector.Vector3d; import static org.lwjgl.opengl.GL11.*; @FunctionRegister(name = "Tracers", type = Category.Render) public class Tracers extends Function { private final BooleanSetting ignoreNaked = new BooleanSetting("Игнорировать голых", true); public Tracers() { addSettings(ignoreNaked); } @Subscribe public void onRender(WorldEvent e) { glPushMatrix(); glDisable(GL_TEXTURE_2D); glDisable(GL_DEPTH_TEST); glEnable(GL_BLEND); glEnable(GL_LINE_SMOOTH); glLineWidth(1); Vector3d cam = new Vector3d(0, 0, 150) .rotatePitch((float) -(Math.toRadians(mc.getRenderManager().info.getPitch()))) .rotateYaw((float) -Math.toRadians(mc.getRenderManager().info.getYaw())); for (AbstractClientPlayerEntity player : mc.world.getPlayers()) { if (player == mc.player) continue; if (!player.isAlive() || AntiBot.isBot(player) || player.getTotalArmorValue() == 0.0f && ignoreNaked.get()) continue; double distance = mc.player.getPositionVec().distanceTo(player.getPositionVec()); float red = (float) Math.min(1.0, Math.max(0, (50.0 - distance) / 50.0)); float green = 1.0f - red; int redColor = (int) (red * 255); int greenColor = (int) (green * 255); int blueColor = 0; int color = (255 << 24) | (redColor << 16) | (greenColor << 8) | blueColor; ColorUtils.setColor(FriendStorage.isFriend(player.getGameProfile().getName()) ? FriendStorage.getColor() : color); Vector3d pos = EntityUtils.getInterpolatedPositionVec(player) .subtract(mc.getRenderManager().info.getProjectedView()); buffer.begin(1, DefaultVertexFormats.POSITION); buffer.pos(cam.x, cam.y, cam.z).endVertex(); buffer.pos(pos.x, pos.y, pos.z).endVertex(); tessellator.draw(); } glDisable(GL_BLEND); glDisable(GL_LINE_SMOOTH); glEnable(GL_TEXTURE_2D); glEnable(GL_DEPTH_TEST); glPopMatrix(); } }