- Статус
- Оффлайн
- Регистрация
- 3 Май 2023
- Сообщения
- 854
- Реакции
- 19
Обратите внимание, пользователь заблокирован на форуме. Не рекомендуется проводить сделки.
навалил лютого жду крутые вкиды по поводу моего кода
киньте реакцию клоуна, буду рад
HitBublik.py:
@SubscribeEvent
public void onRender3D(RenderWorldLastEvent renderWorldLastEvent) {
if (mc.player != null && mc.level != null) {
bubbles.removeIf(bubble -> bubble.timerUtil.hasReached(bubble.lifeTime));
MatrixStack matrixStack = renderWorldLastEvent.getMatrixStack();
Tessellator tessellator = Tessellator.getInstance();
BufferBuilder bufferBuilder = tessellator.getBuilder();
bubbles.forEach(bubble -> {
matrixStack.pushPose();
Vector3d vector3d = mc.getEntityRenderDispatcher().camera.getPosition();
matrixStack.translate(bubble.x - vector3d.x, bubble.y - vector3d.y + bubble.BbHeight, bubble.z - vector3d.z);
matrixStack.mulPose(bubble.quaternion);
matrixStack.scale(-0.1f, -0.1f, -0.1f);
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);
RenderSystem.disableCull();
mc.getTextureManager().bind(this.bubble); // думаю сами осилите забиндить текстуру?
bufferBuilder.begin(GL11.GL_QUADS, DefaultVertexFormats.POSITION_COLOR_TEX);
Color color = bubble.color;
float life = (float) bubble.timerUtil.getMc() / bubble.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(), 5, 5, 0).color(color.getRed(), color.getGreen(), color.getBlue(), color.getAlpha()).uv(0, 0).endVertex();
bufferBuilder.vertex(matrixStack.last().pose(), 5, -5, 0).color(color.getRed(), color.getGreen(), color.getBlue(), color.getAlpha()).uv(0, 1).endVertex();
bufferBuilder.vertex(matrixStack.last().pose(), -5, -5, 0).color(color.getRed(), color.getGreen(), color.getBlue(), color.getAlpha()).uv(1, 1).endVertex();
bufferBuilder.vertex(matrixStack.last().pose(), -5, 5, 0).color(color.getRed(), color.getGreen(), color.getBlue(), color.getAlpha()).uv(1, 0).endVertex();
tessellator.end();
RenderSystem.enableCull();
RenderSystem.disableBlend();
RenderSystem.depthMask(true);
RenderSystem.popMatrix();
matrixStack.popPose();
});
}
}
@SubscribeEvent
public void onAttack(AttackEntityEvent attackEntityEvent) {
if (timerUtil.hasReached(200) && attackEntityEvent.getTarget().isAlive()) {
bubbles.add(new Bubble(attackEntityEvent.getTarget().getX(), attackEntityEvent.getTarget().getY(), attackEntityEvent.getTarget().getZ(), attackEntityEvent.getTarget().getBbHeight() / 1.5f, mc.gameRenderer.getMainCamera().rotation().copy(), (long) skorost.value));
timerUtil.reset();
}
}
static class Bubble {
double x, y, z;
float BbHeight;
Quaternion quaternion;
TimerUtil timerUtil = new TimerUtil();
long lifeTime;
Color color = new Color(ColorUtil.twoColorEffectTh(color1, color2, 255).getRGB());
public Bubble(double x, double y, double z, float BbHeight, Quaternion quaternion, long lifeTime) {
this.x = x;
this.y = y;
this.z = z;
this.BbHeight = BbHeight;
this.quaternion = quaternion;
this.lifeTime = lifeTime;
}
}
two color:
public static Color twoColorEffectTh(Color color1, Color color2, float alpha) {
float val = MathHelper.clamp((float) Math.sin(19 * ((Math.abs(System.currentTimeMillis() / 25) / 200.4) / 2 % 1)) / 2 + 0.5f, 0, 1);
return new Color(MathUtil.lerp((float) color1.getRed() / 255, (float) color2.getRed() / 255, val), MathUtil.lerp((float) color1.getGreen() / 255, (float) color2.getGreen() / 255, val), MathUtil.lerp((float) color1.getBlue() / 255, (float) color2.getBlue() / 255, val), alpha / 255);
}
timerUtil.rs:
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();
}
}
Пожалуйста, авторизуйтесь для просмотра ссылки.
киньте реакцию клоуна, буду рад
