Обратите внимание, пользователь заблокирован на форуме. Не рекомендуется проводить сделки.
ахнSS:
Посмотреть вложение 275825
можно было и лучше но типо и так сойдет
Bimbim:ArrayList<Particle> particles = new ArrayList<>(); @SubscribeEvent public void onRender3D(RenderWorldLastEvent renderWorldLastEvent) { Particles.color = ваш_цвет; particles.removeIf(particle -> particle.timerUtil.hasReached(particle.lifeTime)); MatrixStack matrixStack = renderWorldLastEvent.getMatrixStack(); Tessellator tessellator = Tessellator.getInstance(); BufferBuilder bufferBuilder = tessellator.getBuilder(); particles.forEach(particle -> { particle.animation.to = (float) particle.endX; particle.animation2.to = (float) particle.endY; particle.animation3.to = (float) particle.endZ; Vector3d vector3d = mc.getEntityRenderDispatcher().camera.getPosition(); mc.getTextureManager().bind(heart); matrixStack.pushPose(); matrixStack.translate((particle.startX + particle.animation.getAnim()) - vector3d.x, (particle.startY + particle.animation2.getAnim()) - vector3d.y, (particle.startZ + particle.animation3.getAnim()) - vector3d.z); matrixStack.mulPose(mc.gameRenderer.getMainCamera().rotation().copy()); matrixStack.scale((float) razmer.value, (float) razmer.value, (float) razmer.value); RenderSystem.pushMatrix(); RenderSystem.disableDepthTest(); RenderSystem.enableBlend(); RenderSystem.blendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE); RenderSystem.color4f(1.0F, 1.0F, 1.0F, 1.0F); bufferBuilder.begin(GL11.GL_QUADS, DefaultVertexFormats.POSITION_COLOR_TEX); Color color = particle.color; float life = (float) particle.timerUtil.getMc() / particle.lifeTime; color = new Color(color.getRed(), color.getGreen(), color.getBlue(), (int) (MathHelper.clamp(1 - life, 0, 1) * 255)); matrixStack.mulPose(Vector3f.ZP.rotationDegrees(life * 360)); bufferBuilder.vertex(matrixStack.last().pose(), 2, 2, 0).color(color.getRed(), color.getGreen(), color.getBlue(), color.getAlpha()).uv(0, 0).endVertex(); bufferBuilder.vertex(matrixStack.last().pose(), 2, -2, 0).color(color.getRed(), color.getGreen(), color.getBlue(), color.getAlpha()).uv(0, 1).endVertex(); bufferBuilder.vertex(matrixStack.last().pose(), -2, -2, 0).color(color.getRed(), color.getGreen(), color.getBlue(), color.getAlpha()).uv(1, 1).endVertex(); bufferBuilder.vertex(matrixStack.last().pose(), -2, 2, 0).color(color.getRed(), color.getGreen(), color.getBlue(), color.getAlpha()).uv(1, 0).endVertex(); tessellator.end(); RenderSystem.disableBlend(); RenderSystem.depthMask(true); RenderSystem.popMatrix(); matrixStack.popPose(); }); } @SubscribeEvent public void onAttackEntity(AttackEntityEvent attackEntityEvent) { if (timerUtil.hasReached(200) && attackEntityEvent.getTarget().isAlive()) { for (int i = 0; i < kolichestvo.value; i++) { float r0 = random.nextInt(5) + random.nextFloat(); float r1 = random.nextInt(5) + random.nextFloat(); particles.add(new Particle(attackEntityEvent.getTarget().getX(), attackEntityEvent.getTarget().getY() + attackEntityEvent.getTarget().getBbHeight() / 2, attackEntityEvent.getTarget().getZ(), random.nextBoolean() ? r0 : -r0, random.nextInt(5) + random.nextFloat(), random.nextBoolean() ? r1 : -r1, random.nextInt(5000))); timerUtil.reset(); } } } static class Particle { double startX, startY, startZ, endX, endY, endZ; TimerUtil timerUtil = new TimerUtil(); long lifeTime; Color color = Particles.color; AnimationUtil animation = new AnimationUtil(0.01f); AnimationUtil animation2 = new AnimationUtil(0.01f); AnimationUtil animation3 = new AnimationUtil(0.01f); public Particle(double startX, double startY, double startZ, double endX, double endY, double endZ, long lifeTime) { this.startX = startX; this.startY = startY; this.startZ = startZ; this.endX = endX; this.endY = endY; this.endZ = endZ; this.lifeTime = lifeTime; } } }
TimerUtil:public class TimerUtil { long mc; public void reset() { this.mc = System.currentTimeMillis(); } public long getMc() { return System.currentTimeMillis() - this.mc; } public boolean hasReached(final long n) { return System.currentTimeMillis() - this.mc > n; } public TimerUtil() { this.mc = System.currentTimeMillis(); } }
PNG:AnimationUtil:public class AnimationUtil { public float anim, to, speed; long mc = System.currentTimeMillis(); public AnimationUtil(float speed) { this.speed = speed; } public float getAnim() { int count = (int) ((System.currentTimeMillis() - mc) / 5); if (count > 0) { mc = System.currentTimeMillis(); } for (int i = 0; i < count; i++) { anim = MathUtil.lerp(anim, to, speed); } return anim; } }
Посмотреть вложение 275826