- Статус
- Оффлайн
- Регистрация
- 3 Май 2023
- Сообщения
- 854
- Реакции
- 19
Обратите внимание, пользователь заблокирован на форуме. Не рекомендуется проводить сделки.
Java:
FloatSetting length = new FloatSetting("Length", 100, 1000, 500, 1);
ArrayList<Particle> particles = new ArrayList<>();
private final Map<PlayerEntity, Vector3d> lastPos = new HashMap<>();
@SubscribeEvent
public void onUpdate(TickEvent.RenderTickEvent e) {
if (mc.player != null && mc.level != null) {
particles.removeIf(particle -> particle.timer.hasReached(particle.time));
for (PlayerEntity player : mc.level.players()) {
boolean isThirdPerson = !mc.options.getCameraType().isFirstPerson();
if (player.equals(mc.player) && !isThirdPerson) {
continue;
}
if (!player.equals(mc.player) && !FriendManager.isFriend(player.getName().getString())) {
continue;
}
Vector3d newPos = player.getPosition(e.renderTickTime).add(0, player.getBbHeight() * 0.5, 0);
Vector3d oldPos = lastPos.get(player);
if (oldPos != null && !oldPos.equals(newPos)) {
double xt = newPos.x - oldPos.x;
double yt = newPos.y - oldPos.y;
double zt = newPos.z - oldPos.z;
double distance = Math.sqrt(xt * xt + yt * yt + zt * zt);
if (distance >= MathUtil.getBps(player)) {
lastPos.put(player, newPos);
continue;
}
int points = (int) (distance * 100);
for (int i = 0; i < points; i++) {
float x = MathUtil.interpolate((float) i, 0, (float) oldPos.x, points, (float) newPos.x);
float y = MathUtil.interpolate((float) i, 0, (float) oldPos.y, points, (float) newPos.y);
float z = MathUtil.interpolate((float) i, 0, (float) oldPos.z, points, (float) newPos.z);
particles.add(new Particle(new Vector3d(x, y, z), (long) length.getValue(), ColorUtil.twoColorEffect(color1, color2, 255).getRGB()));
}
}
lastPos.put(player, newPos);
}
}
}
@SubscribeEvent
public void onRenderWorldLast(RenderWorldLastEvent renderWorldLastEvent) {
if (mc.player != null && mc.level != null) {
Tessellator tessellator = Tessellator.getInstance();
BufferBuilder bufferbuilder = tessellator.getBuilder();
MatrixStack ms = renderWorldLastEvent.getMatrixStack();
float startX = -2f;
float startY = -2f;
float width = 4;
float height = 4;
float endX = startX + width;
float endY = startY + height;
RenderSystem.depthMask(true);
RenderSystem.enableDepthTest();
particles.forEach(particle -> {
{
if (particles.indexOf(particle) > this.particles.size() - 2) return;
int a = (int) ((float) this.particles.indexOf(particle) / (float) this.particles.size() * 255);
int color2 = ColorUtil.swapAlpha(particle.color, MathUtil.clamp(a, 0, 20));
float process = (this.particles.indexOf(particle) / (float) this.particles.size());
double x = particle.getX() - mc.getEntityRenderDispatcher().camera.getPosition().x;
double y = particle.getY() - mc.getEntityRenderDispatcher().camera.getPosition().y;
double z = particle.getZ() - mc.getEntityRenderDispatcher().camera.getPosition().z;
float scale = -MathUtil.calculateValue(process * 100, 0.025f, 0.135f);
ms.pushPose();
ms.translate(x, y, z);
final ActiveRenderInfo renderInfo = mc.gameRenderer.getMainCamera();
ms.mulPose(renderInfo.rotation().copy());
ms.scale(scale, scale, scale);
resetColor();
mc.getTextureManager().bind(/*ваша пнгшка*/);
Matrix4f matrix = ms.last().pose();
bufferbuilder.begin(GL20.GL_QUADS, DefaultVertexFormats.POSITION_COLOR_TEX);
ms.pushPose();
bufferbuilder.vertex(matrix, startX - 0.2f, startY - 0.2f, 0).color(ColorUtil.r(color2), ColorUtil.g(color2), ColorUtil.b(color2), ColorUtil.a(color2)).uv(0.0F, 0.0F).endVertex();
bufferbuilder.vertex(matrix, startX - 0.2f, endY + 0.2f, 0).color(ColorUtil.r(color2), ColorUtil.g(color2), ColorUtil.b(color2), ColorUtil.a(color2)).uv(0.0F, 1.0F).endVertex();
bufferbuilder.vertex(matrix, endX + 0.2f, endY + 0.2f, 0).color(ColorUtil.r(color2), ColorUtil.g(color2), ColorUtil.b(color2), ColorUtil.a(color2)).uv(1.0F, 1.0F).endVertex();
bufferbuilder.vertex(matrix, endX + 0.2f, startY - 0.2f, 0).color(ColorUtil.r(color2), ColorUtil.g(color2), ColorUtil.b(color2), ColorUtil.a(color2)).uv(1.0F, 0.0F).endVertex();
GL46.glDepthMask(false);
GL46.glDisable(GL46.GL_CULL_FACE);
GL46.glDisable(GL46.GL_ALPHA_TEST);
GL46.glEnable(GL46.GL_BLEND);
GL46.glBlendFunc(GL46.GL_SRC_ALPHA, GL46.GL_ONE);
tessellator.end();
GL46.glBlendFunc(GL46.GL_SRC_ALPHA, GlStateManager.DestFactor.ONE_MINUS_SRC_ALPHA.value);
GL46.glDisable(GL46.GL_BLEND);
GL46.glEnable(GL46.GL_ALPHA_TEST);
GL46.glEnable(GL46.GL_CULL_FACE);
GL46.glDepthMask(true);
ms.popPose();
_bindTexture(0);
_disableBlend();
ms.popPose();
}
});
RenderSystem.lineWidth(1);
}
}
class Particle {
public Vector3d pos;
public long time;
public TimerUtil timer;
public int color;
public Particle(Vector3d pos, long time, int color) {
this.time = time;
this.color = color;
this.timer = new TimerUtil();
this.pos = pos;
}
public float getX() {
return (float) pos.x;
}
public float getY() {
return (float) pos.y;
}
public float getZ() {
return (float) pos.z;
}
}
}
SS: