Исходник HitBubbles expensive ready

read only ambassador
Пользователь
Статус
Оффлайн
Регистрация
28 Июн 2022
Сообщения
626
Реакции[?]
110
Поинты[?]
14K
ss
Посмотреть вложение 264261


типа как в вегалайне
каде:
package ru.dedinside.modules.impl.render;

import java.util.ArrayList;
import net.minecraft.client.Minecraft;
import net.minecraft.client.renderer.BufferBuilder;
import net.minecraft.client.renderer.GlStateManager;
import net.minecraft.client.renderer.Tessellator;
import net.minecraft.client.renderer.GlStateManager.DestFactor;
import net.minecraft.client.renderer.GlStateManager.SourceFactor;
import net.minecraft.client.renderer.entity.RenderManager;
import net.minecraft.client.renderer.vertex.DefaultVertexFormats;
import net.minecraft.entity.Entity;
import net.minecraft.entity.EntityLivingBase;
import net.minecraft.util.ResourceLocation;
import net.minecraft.util.math.Vec3d;
import org.lwjgl.opengl.GL11;
import ru.dedinside.event.EventTarget;
import ru.dedinside.event.events.impl.EventAttack;
import ru.dedinside.event.events.impl.EventRender;
import ru.dedinside.event.events.impl.EventUpdate;
import ru.dedinside.modules.Module;
import ru.dedinside.modules.ModuleAnnotation;
import ru.dedinside.modules.Type;
import ru.dedinside.modules.impl.hud.HudModule;
import ru.dedinside.util.animation.AnimationUtils;
import ru.dedinside.util.color.ColorUtility;
import ru.dedinside.util.math.MathUtility;
import ru.dedinside.util.render.RenderUtility;

@ModuleAnnotation(name = "HitBubble", type = Type.Visuals)
public class HitBubble extends Module {
    public AnimationUtils stateAnim = new AnimationUtils(0.0F, 0.0F, 0.1F);

    public static HitBubble get;
    static final ArrayList<Bubble> bubbles = new ArrayList();
    private final Tessellator tessellator = Tessellator.getInstance();
    private final BufferBuilder buffer;
    private final ResourceLocation BUBBLE_TEXTURE;

    public HitBubble() {
        this.buffer = this.tessellator.getBuffer();
        this.BUBBLE_TEXTURE = new ResourceLocation("client/images/hitbubble/bubble.png");
        get = this;
    }

    public void onDisable() {
        boolean actived = state;
        this.stateAnim.to = actived ? 1.0F : 0.0F;
        super.onDisable();
    }
    @EventTarget
    public void onUpdate(EventUpdate update) {
        this.stateAnim.to = 1.0F;
    }

    private float getAlphaPC() {
        return this.stateAnim.getAnim();
    }

    private static float getMaxTime() {
        return (double)mc.player.getCooledAttackStrength(0.0F) > 0.8 ? 2500.0F : 1000.0F;
    }
    @EventTarget
    public void onAttack(EventAttack e) {
        if (e.hitted instanceof EntityLivingBase base) {
            if (base == null || !base.isEntityAlive()) {
                return;
            }

            Vec3d to = base.getPositionVector().add(0.0, (double)(base.height / 1.6F), 0.0);
            addBubble(to);
        }

    }

    private void addBubble(Vec3d addToCoord) {
        RenderManager manager = mc.getRenderManager();
        bubbles.add(new Bubble(manager.playerViewX, -manager.playerViewY, addToCoord));
    }

    private void setupDrawsBubbles3D(Runnable render) {
        RenderManager manager = mc.getRenderManager();
        Vec3d conpense = new Vec3d(manager.renderPosX, manager.renderPosY, manager.renderPosZ);
        mc.entityRenderer.disableLightmap();
        GL11.glDisable(2896);
        GL11.glDepthMask(false);
        GL11.glDisable(2884);
        GL11.glEnable(3042);
        GL11.glDisable(3008);
        GL11.glTranslated(-conpense.x, -conpense.y, -conpense.z);
        mc.getTextureManager().bindTexture(this.BUBBLE_TEXTURE);
        render.run();
        GlStateManager.tryBlendFuncSeparate(SourceFactor.SRC_ALPHA, DestFactor.ONE_MINUS_SRC_ALPHA, SourceFactor.ONE, DestFactor.ZERO);
        GL11.glTranslated(conpense.x, conpense.y, conpense.z);
        GL11.glEnable(3008);
        GL11.glDepthMask(true);
        GL11.glEnable(2884);
        mc.entityRenderer.enableLightmap();
        GL11.glEnable(2896);
    }

    private void drawBubble(Bubble bubble, float alphaPC) {
        GL11.glPushMatrix();
        Vec3d bXYZ = bubble.pos;
        GL11.glTranslated(bubble.pos.x, bubble.pos.y, bubble.pos.z);
        RenderManager manager = mc.getRenderManager();
        float extS = bubble.getDeltaTime();
        GlStateManager.translate(-Math.sin(Math.toRadians((double)bubble.viewPitch)) * (double)extS / 3.0, Math.sin(Math.toRadians((double)bubble.viewYaw)) * (double)extS / 2.0, -Math.cos(Math.toRadians((double)bubble.viewPitch)) * (double)extS / 3.0);
        GL11.glNormal3d(1.0, 1.0, 1.0);
        GL11.glRotated((double)bubble.viewPitch, 0.0, 1.0, 0.0);
        GL11.glRotated((double)bubble.viewYaw, mc.gameSettings.thirdPersonView == 2 ? -1.0 : 1.0, 0.0, 0.0);
        GL11.glScaled(-0.1, -0.1, 0.1);
        this.drawBeginsNullCoord(bubble, alphaPC);
        GL11.glPopMatrix();
    }

    private void drawBeginsNullCoord(Bubble bubble, float alphaPC) {
        float aPC = MathUtility.clamp(bubble.getDeltaTime(), 0.0F, 1.0F) * alphaPC;
        aPC = (double)aPC > 0.5 ? 1.0F - aPC : aPC;
        aPC *= 4.0F;
        aPC = aPC > 1.0F ? 1.0F : aPC;
        aPC *= alphaPC;
        float r = 50.0F * bubble.getDeltaTime() * (1.0F - bubble.getDeltaTime());

        int speedRotate = 3;
        float III = (float)(System.currentTimeMillis() % (long)(3600 / speedRotate)) / 10.0F * (float)speedRotate;
        RenderUtility.customRotatedObject2D(-1.0F, -1.0F, 2.0F, 2.0F, -III);
        this.buffer.begin(7, DefaultVertexFormats.POSITION_TEX_COLOR);
        this.buffer.pos(0.0, 0.0, 0.0).tex(0.0, 0.0).color(ColorUtility.applyOpacity(HudModule.getColor(0), aPC).getRGB()).endVertex();
        this.buffer.pos(0.0, (double)r, 0.0).tex(0.0, 1.0).color(ColorUtility.applyOpacity(HudModule.getColor(90), aPC).getRGB()).endVertex();
        this.buffer.pos((double)r, (double)r, 0.0).tex(1.0, 1.0).color(ColorUtility.applyOpacity(HudModule.getColor(180), aPC).getRGB()).endVertex();
        this.buffer.pos((double)r, 0.0, 0.0).tex(1.0, 0.0).color(ColorUtility.applyOpacity(HudModule.getColor(270), aPC).getRGB()).endVertex();
        GlStateManager.blendFunc(770, 772);
        GlStateManager.translate(-r / 2.0F, -r / 2.0F, 0.0F);
        GlStateManager.shadeModel(7425);
        GlStateManager.tryBlendFuncSeparate(SourceFactor.SRC_ALPHA, DestFactor.ONE, SourceFactor.ONE, DestFactor.ZERO);
        this.tessellator.draw();
        GlStateManager.shadeModel(7424);
        GlStateManager.translate(r / 2.0F, r / 2.0F, 0.0F);
        GlStateManager.blendFunc(770, 771);
    }
@EventTarget
    public void alwaysRender3D(EventRender e) {
        float aPC = this.getAlphaPC();
        if (!((double)aPC < 0.05)) {
            if (!bubbles.isEmpty()) {
                this.removeAuto();
                this.setupDrawsBubbles3D(() -> {
                    bubbles.forEach((bubble) -> {
                        if (bubble != null && bubble.getDeltaTime() <= 1.0F) {
                            this.drawBubble(bubble, aPC);
                        }

                    });
                });
            }
        }
    }

    private void removeAuto() {
        bubbles.removeIf((bubble) -> {
            return bubble.getDeltaTime() >= 1.0F;
        });
    }
    public final class Bubble {
        Vec3d pos;
        long time = System.currentTimeMillis();
        float maxTime = HitBubble.getMaxTime();
        float viewYaw;
        float viewPitch;

        public Bubble(float viewYaw, float viewPitch, Vec3d pos) {
            this.viewYaw = viewYaw;
            this.viewPitch = viewPitch;
            this.pos = pos;
        }

        private float getDeltaTime() {
            return (float)(System.currentTimeMillis() - this.time) / this.maxTime;
        }
    }

}
Красавец, держишь планку, как всегда кал (Красивый Ахуенный Летальный (исход у твоего мозга))!
 
Забаненный
Статус
Оффлайн
Регистрация
29 Дек 2023
Сообщения
138
Реакции[?]
1
Поинты[?]
0
Обратите внимание, пользователь заблокирован на форуме. Не рекомендуется проводить сделки.
че делать миллион ошибок выдает Cannot resolve symbol 'GlStateManager' и т.д.
 
Последнее редактирование:
Начинающий
Статус
Оффлайн
Регистрация
15 Янв 2023
Сообщения
61
Реакции[?]
0
Поинты[?]
0
Помогите спастить в експу 2.0,выдает много ошибок сорри что тему поднял
 
Пользователь
Статус
Оффлайн
Регистрация
13 Сен 2021
Сообщения
633
Реакции[?]
117
Поинты[?]
44K
ss
Посмотреть вложение 264261


типа как в вегалайне
каде:
package ru.dedinside.modules.impl.render;

import java.util.ArrayList;
import net.minecraft.client.Minecraft;
import net.minecraft.client.renderer.BufferBuilder;
import net.minecraft.client.renderer.GlStateManager;
import net.minecraft.client.renderer.Tessellator;
import net.minecraft.client.renderer.GlStateManager.DestFactor;
import net.minecraft.client.renderer.GlStateManager.SourceFactor;
import net.minecraft.client.renderer.entity.RenderManager;
import net.minecraft.client.renderer.vertex.DefaultVertexFormats;
import net.minecraft.entity.Entity;
import net.minecraft.entity.EntityLivingBase;
import net.minecraft.util.ResourceLocation;
import net.minecraft.util.math.Vec3d;
import org.lwjgl.opengl.GL11;
import ru.dedinside.event.EventTarget;
import ru.dedinside.event.events.impl.EventAttack;
import ru.dedinside.event.events.impl.EventRender;
import ru.dedinside.event.events.impl.EventUpdate;
import ru.dedinside.modules.Module;
import ru.dedinside.modules.ModuleAnnotation;
import ru.dedinside.modules.Type;
import ru.dedinside.modules.impl.hud.HudModule;
import ru.dedinside.util.animation.AnimationUtils;
import ru.dedinside.util.color.ColorUtility;
import ru.dedinside.util.math.MathUtility;
import ru.dedinside.util.render.RenderUtility;

@ModuleAnnotation(name = "HitBubble", type = Type.Visuals)
public class HitBubble extends Module {
    public AnimationUtils stateAnim = new AnimationUtils(0.0F, 0.0F, 0.1F);

    public static HitBubble get;
    static final ArrayList<Bubble> bubbles = new ArrayList();
    private final Tessellator tessellator = Tessellator.getInstance();
    private final BufferBuilder buffer;
    private final ResourceLocation BUBBLE_TEXTURE;

    public HitBubble() {
        this.buffer = this.tessellator.getBuffer();
        this.BUBBLE_TEXTURE = new ResourceLocation("client/images/hitbubble/bubble.png");
        get = this;
    }

    public void onDisable() {
        boolean actived = state;
        this.stateAnim.to = actived ? 1.0F : 0.0F;
        super.onDisable();
    }
    @EventTarget
    public void onUpdate(EventUpdate update) {
        this.stateAnim.to = 1.0F;
    }

    private float getAlphaPC() {
        return this.stateAnim.getAnim();
    }

    private static float getMaxTime() {
        return (double)mc.player.getCooledAttackStrength(0.0F) > 0.8 ? 2500.0F : 1000.0F;
    }
    @EventTarget
    public void onAttack(EventAttack e) {
        if (e.hitted instanceof EntityLivingBase base) {
            if (base == null || !base.isEntityAlive()) {
                return;
            }

            Vec3d to = base.getPositionVector().add(0.0, (double)(base.height / 1.6F), 0.0);
            addBubble(to);
        }

    }

    private void addBubble(Vec3d addToCoord) {
        RenderManager manager = mc.getRenderManager();
        bubbles.add(new Bubble(manager.playerViewX, -manager.playerViewY, addToCoord));
    }

    private void setupDrawsBubbles3D(Runnable render) {
        RenderManager manager = mc.getRenderManager();
        Vec3d conpense = new Vec3d(manager.renderPosX, manager.renderPosY, manager.renderPosZ);
        mc.entityRenderer.disableLightmap();
        GL11.glDisable(2896);
        GL11.glDepthMask(false);
        GL11.glDisable(2884);
        GL11.glEnable(3042);
        GL11.glDisable(3008);
        GL11.glTranslated(-conpense.x, -conpense.y, -conpense.z);
        mc.getTextureManager().bindTexture(this.BUBBLE_TEXTURE);
        render.run();
        GlStateManager.tryBlendFuncSeparate(SourceFactor.SRC_ALPHA, DestFactor.ONE_MINUS_SRC_ALPHA, SourceFactor.ONE, DestFactor.ZERO);
        GL11.glTranslated(conpense.x, conpense.y, conpense.z);
        GL11.glEnable(3008);
        GL11.glDepthMask(true);
        GL11.glEnable(2884);
        mc.entityRenderer.enableLightmap();
        GL11.glEnable(2896);
    }

    private void drawBubble(Bubble bubble, float alphaPC) {
        GL11.glPushMatrix();
        Vec3d bXYZ = bubble.pos;
        GL11.glTranslated(bubble.pos.x, bubble.pos.y, bubble.pos.z);
        RenderManager manager = mc.getRenderManager();
        float extS = bubble.getDeltaTime();
        GlStateManager.translate(-Math.sin(Math.toRadians((double)bubble.viewPitch)) * (double)extS / 3.0, Math.sin(Math.toRadians((double)bubble.viewYaw)) * (double)extS / 2.0, -Math.cos(Math.toRadians((double)bubble.viewPitch)) * (double)extS / 3.0);
        GL11.glNormal3d(1.0, 1.0, 1.0);
        GL11.glRotated((double)bubble.viewPitch, 0.0, 1.0, 0.0);
        GL11.glRotated((double)bubble.viewYaw, mc.gameSettings.thirdPersonView == 2 ? -1.0 : 1.0, 0.0, 0.0);
        GL11.glScaled(-0.1, -0.1, 0.1);
        this.drawBeginsNullCoord(bubble, alphaPC);
        GL11.glPopMatrix();
    }

    private void drawBeginsNullCoord(Bubble bubble, float alphaPC) {
        float aPC = MathUtility.clamp(bubble.getDeltaTime(), 0.0F, 1.0F) * alphaPC;
        aPC = (double)aPC > 0.5 ? 1.0F - aPC : aPC;
        aPC *= 4.0F;
        aPC = aPC > 1.0F ? 1.0F : aPC;
        aPC *= alphaPC;
        float r = 50.0F * bubble.getDeltaTime() * (1.0F - bubble.getDeltaTime());

        int speedRotate = 3;
        float III = (float)(System.currentTimeMillis() % (long)(3600 / speedRotate)) / 10.0F * (float)speedRotate;
        RenderUtility.customRotatedObject2D(-1.0F, -1.0F, 2.0F, 2.0F, -III);
        this.buffer.begin(7, DefaultVertexFormats.POSITION_TEX_COLOR);
        this.buffer.pos(0.0, 0.0, 0.0).tex(0.0, 0.0).color(ColorUtility.applyOpacity(HudModule.getColor(0), aPC).getRGB()).endVertex();
        this.buffer.pos(0.0, (double)r, 0.0).tex(0.0, 1.0).color(ColorUtility.applyOpacity(HudModule.getColor(90), aPC).getRGB()).endVertex();
        this.buffer.pos((double)r, (double)r, 0.0).tex(1.0, 1.0).color(ColorUtility.applyOpacity(HudModule.getColor(180), aPC).getRGB()).endVertex();
        this.buffer.pos((double)r, 0.0, 0.0).tex(1.0, 0.0).color(ColorUtility.applyOpacity(HudModule.getColor(270), aPC).getRGB()).endVertex();
        GlStateManager.blendFunc(770, 772);
        GlStateManager.translate(-r / 2.0F, -r / 2.0F, 0.0F);
        GlStateManager.shadeModel(7425);
        GlStateManager.tryBlendFuncSeparate(SourceFactor.SRC_ALPHA, DestFactor.ONE, SourceFactor.ONE, DestFactor.ZERO);
        this.tessellator.draw();
        GlStateManager.shadeModel(7424);
        GlStateManager.translate(r / 2.0F, r / 2.0F, 0.0F);
        GlStateManager.blendFunc(770, 771);
    }
@EventTarget
    public void alwaysRender3D(EventRender e) {
        float aPC = this.getAlphaPC();
        if (!((double)aPC < 0.05)) {
            if (!bubbles.isEmpty()) {
                this.removeAuto();
                this.setupDrawsBubbles3D(() -> {
                    bubbles.forEach((bubble) -> {
                        if (bubble != null && bubble.getDeltaTime() <= 1.0F) {
                            this.drawBubble(bubble, aPC);
                        }

                    });
                });
            }
        }
    }

    private void removeAuto() {
        bubbles.removeIf((bubble) -> {
            return bubble.getDeltaTime() >= 1.0F;
        });
    }
    public final class Bubble {
        Vec3d pos;
        long time = System.currentTimeMillis();
        float maxTime = HitBubble.getMaxTime();
        float viewYaw;
        float viewPitch;

        public Bubble(float viewYaw, float viewPitch, Vec3d pos) {
            this.viewYaw = viewYaw;
            this.viewPitch = viewPitch;
            this.pos = pos;
        }

        private float getDeltaTime() {
            return (float)(System.currentTimeMillis() - this.time) / this.maxTime;
        }
    }

}
ты говно куска, это чо нахуй? тебе не стыдно? ты не боишься второго прихода Иисуса?
 
Начинающий
Статус
Оффлайн
Регистрация
27 Окт 2023
Сообщения
20
Реакции[?]
0
Поинты[?]
0
ss
Посмотреть вложение 264261


типа как в вегалайне
каде:
package ru.dedinside.modules.impl.render;

import java.util.ArrayList;
import net.minecraft.client.Minecraft;
import net.minecraft.client.renderer.BufferBuilder;
import net.minecraft.client.renderer.GlStateManager;
import net.minecraft.client.renderer.Tessellator;
import net.minecraft.client.renderer.GlStateManager.DestFactor;
import net.minecraft.client.renderer.GlStateManager.SourceFactor;
import net.minecraft.client.renderer.entity.RenderManager;
import net.minecraft.client.renderer.vertex.DefaultVertexFormats;
import net.minecraft.entity.Entity;
import net.minecraft.entity.EntityLivingBase;
import net.minecraft.util.ResourceLocation;
import net.minecraft.util.math.Vec3d;
import org.lwjgl.opengl.GL11;
import ru.dedinside.event.EventTarget;
import ru.dedinside.event.events.impl.EventAttack;
import ru.dedinside.event.events.impl.EventRender;
import ru.dedinside.event.events.impl.EventUpdate;
import ru.dedinside.modules.Module;
import ru.dedinside.modules.ModuleAnnotation;
import ru.dedinside.modules.Type;
import ru.dedinside.modules.impl.hud.HudModule;
import ru.dedinside.util.animation.AnimationUtils;
import ru.dedinside.util.color.ColorUtility;
import ru.dedinside.util.math.MathUtility;
import ru.dedinside.util.render.RenderUtility;

@ModuleAnnotation(name = "HitBubble", type = Type.Visuals)
public class HitBubble extends Module {
    public AnimationUtils stateAnim = new AnimationUtils(0.0F, 0.0F, 0.1F);

    public static HitBubble get;
    static final ArrayList<Bubble> bubbles = new ArrayList();
    private final Tessellator tessellator = Tessellator.getInstance();
    private final BufferBuilder buffer;
    private final ResourceLocation BUBBLE_TEXTURE;

    public HitBubble() {
        this.buffer = this.tessellator.getBuffer();
        this.BUBBLE_TEXTURE = new ResourceLocation("client/images/hitbubble/bubble.png");
        get = this;
    }

    public void onDisable() {
        boolean actived = state;
        this.stateAnim.to = actived ? 1.0F : 0.0F;
        super.onDisable();
    }
    @EventTarget
    public void onUpdate(EventUpdate update) {
        this.stateAnim.to = 1.0F;
    }

    private float getAlphaPC() {
        return this.stateAnim.getAnim();
    }

    private static float getMaxTime() {
        return (double)mc.player.getCooledAttackStrength(0.0F) > 0.8 ? 2500.0F : 1000.0F;
    }
    @EventTarget
    public void onAttack(EventAttack e) {
        if (e.hitted instanceof EntityLivingBase base) {
            if (base == null || !base.isEntityAlive()) {
                return;
            }

            Vec3d to = base.getPositionVector().add(0.0, (double)(base.height / 1.6F), 0.0);
            addBubble(to);
        }

    }

    private void addBubble(Vec3d addToCoord) {
        RenderManager manager = mc.getRenderManager();
        bubbles.add(new Bubble(manager.playerViewX, -manager.playerViewY, addToCoord));
    }

    private void setupDrawsBubbles3D(Runnable render) {
        RenderManager manager = mc.getRenderManager();
        Vec3d conpense = new Vec3d(manager.renderPosX, manager.renderPosY, manager.renderPosZ);
        mc.entityRenderer.disableLightmap();
        GL11.glDisable(2896);
        GL11.glDepthMask(false);
        GL11.glDisable(2884);
        GL11.glEnable(3042);
        GL11.glDisable(3008);
        GL11.glTranslated(-conpense.x, -conpense.y, -conpense.z);
        mc.getTextureManager().bindTexture(this.BUBBLE_TEXTURE);
        render.run();
        GlStateManager.tryBlendFuncSeparate(SourceFactor.SRC_ALPHA, DestFactor.ONE_MINUS_SRC_ALPHA, SourceFactor.ONE, DestFactor.ZERO);
        GL11.glTranslated(conpense.x, conpense.y, conpense.z);
        GL11.glEnable(3008);
        GL11.glDepthMask(true);
        GL11.glEnable(2884);
        mc.entityRenderer.enableLightmap();
        GL11.glEnable(2896);
    }

    private void drawBubble(Bubble bubble, float alphaPC) {
        GL11.glPushMatrix();
        Vec3d bXYZ = bubble.pos;
        GL11.glTranslated(bubble.pos.x, bubble.pos.y, bubble.pos.z);
        RenderManager manager = mc.getRenderManager();
        float extS = bubble.getDeltaTime();
        GlStateManager.translate(-Math.sin(Math.toRadians((double)bubble.viewPitch)) * (double)extS / 3.0, Math.sin(Math.toRadians((double)bubble.viewYaw)) * (double)extS / 2.0, -Math.cos(Math.toRadians((double)bubble.viewPitch)) * (double)extS / 3.0);
        GL11.glNormal3d(1.0, 1.0, 1.0);
        GL11.glRotated((double)bubble.viewPitch, 0.0, 1.0, 0.0);
        GL11.glRotated((double)bubble.viewYaw, mc.gameSettings.thirdPersonView == 2 ? -1.0 : 1.0, 0.0, 0.0);
        GL11.glScaled(-0.1, -0.1, 0.1);
        this.drawBeginsNullCoord(bubble, alphaPC);
        GL11.glPopMatrix();
    }

    private void drawBeginsNullCoord(Bubble bubble, float alphaPC) {
        float aPC = MathUtility.clamp(bubble.getDeltaTime(), 0.0F, 1.0F) * alphaPC;
        aPC = (double)aPC > 0.5 ? 1.0F - aPC : aPC;
        aPC *= 4.0F;
        aPC = aPC > 1.0F ? 1.0F : aPC;
        aPC *= alphaPC;
        float r = 50.0F * bubble.getDeltaTime() * (1.0F - bubble.getDeltaTime());

        int speedRotate = 3;
        float III = (float)(System.currentTimeMillis() % (long)(3600 / speedRotate)) / 10.0F * (float)speedRotate;
        RenderUtility.customRotatedObject2D(-1.0F, -1.0F, 2.0F, 2.0F, -III);
        this.buffer.begin(7, DefaultVertexFormats.POSITION_TEX_COLOR);
        this.buffer.pos(0.0, 0.0, 0.0).tex(0.0, 0.0).color(ColorUtility.applyOpacity(HudModule.getColor(0), aPC).getRGB()).endVertex();
        this.buffer.pos(0.0, (double)r, 0.0).tex(0.0, 1.0).color(ColorUtility.applyOpacity(HudModule.getColor(90), aPC).getRGB()).endVertex();
        this.buffer.pos((double)r, (double)r, 0.0).tex(1.0, 1.0).color(ColorUtility.applyOpacity(HudModule.getColor(180), aPC).getRGB()).endVertex();
        this.buffer.pos((double)r, 0.0, 0.0).tex(1.0, 0.0).color(ColorUtility.applyOpacity(HudModule.getColor(270), aPC).getRGB()).endVertex();
        GlStateManager.blendFunc(770, 772);
        GlStateManager.translate(-r / 2.0F, -r / 2.0F, 0.0F);
        GlStateManager.shadeModel(7425);
        GlStateManager.tryBlendFuncSeparate(SourceFactor.SRC_ALPHA, DestFactor.ONE, SourceFactor.ONE, DestFactor.ZERO);
        this.tessellator.draw();
        GlStateManager.shadeModel(7424);
        GlStateManager.translate(r / 2.0F, r / 2.0F, 0.0F);
        GlStateManager.blendFunc(770, 771);
    }
@EventTarget
    public void alwaysRender3D(EventRender e) {
        float aPC = this.getAlphaPC();
        if (!((double)aPC < 0.05)) {
            if (!bubbles.isEmpty()) {
                this.removeAuto();
                this.setupDrawsBubbles3D(() -> {
                    bubbles.forEach((bubble) -> {
                        if (bubble != null && bubble.getDeltaTime() <= 1.0F) {
                            this.drawBubble(bubble, aPC);
                        }

                    });
                });
            }
        }
    }

    private void removeAuto() {
        bubbles.removeIf((bubble) -> {
            return bubble.getDeltaTime() >= 1.0F;
        });
    }
    public final class Bubble {
        Vec3d pos;
        long time = System.currentTimeMillis();
        float maxTime = HitBubble.getMaxTime();
        float viewYaw;
        float viewPitch;

        public Bubble(float viewYaw, float viewPitch, Vec3d pos) {
            this.viewYaw = viewYaw;
            this.viewPitch = viewPitch;
            this.pos = pos;
        }

        private float getDeltaTime() {
            return (float)(System.currentTimeMillis() - this.time) / this.maxTime;
        }
    }

}
Если ты новичок то очень хорошо получилось
 
Начинающий
Статус
Оффлайн
Регистрация
26 Фев 2024
Сообщения
453
Реакции[?]
1
Поинты[?]
0
ss
Посмотреть вложение 264261


типа как в вегалайне
каде:
package ru.dedinside.modules.impl.render;

import java.util.ArrayList;
import net.minecraft.client.Minecraft;
import net.minecraft.client.renderer.BufferBuilder;
import net.minecraft.client.renderer.GlStateManager;
import net.minecraft.client.renderer.Tessellator;
import net.minecraft.client.renderer.GlStateManager.DestFactor;
import net.minecraft.client.renderer.GlStateManager.SourceFactor;
import net.minecraft.client.renderer.entity.RenderManager;
import net.minecraft.client.renderer.vertex.DefaultVertexFormats;
import net.minecraft.entity.Entity;
import net.minecraft.entity.EntityLivingBase;
import net.minecraft.util.ResourceLocation;
import net.minecraft.util.math.Vec3d;
import org.lwjgl.opengl.GL11;
import ru.dedinside.event.EventTarget;
import ru.dedinside.event.events.impl.EventAttack;
import ru.dedinside.event.events.impl.EventRender;
import ru.dedinside.event.events.impl.EventUpdate;
import ru.dedinside.modules.Module;
import ru.dedinside.modules.ModuleAnnotation;
import ru.dedinside.modules.Type;
import ru.dedinside.modules.impl.hud.HudModule;
import ru.dedinside.util.animation.AnimationUtils;
import ru.dedinside.util.color.ColorUtility;
import ru.dedinside.util.math.MathUtility;
import ru.dedinside.util.render.RenderUtility;

@ModuleAnnotation(name = "HitBubble", type = Type.Visuals)
public class HitBubble extends Module {
    public AnimationUtils stateAnim = new AnimationUtils(0.0F, 0.0F, 0.1F);

    public static HitBubble get;
    static final ArrayList<Bubble> bubbles = new ArrayList();
    private final Tessellator tessellator = Tessellator.getInstance();
    private final BufferBuilder buffer;
    private final ResourceLocation BUBBLE_TEXTURE;

    public HitBubble() {
        this.buffer = this.tessellator.getBuffer();
        this.BUBBLE_TEXTURE = new ResourceLocation("client/images/hitbubble/bubble.png");
        get = this;
    }

    public void onDisable() {
        boolean actived = state;
        this.stateAnim.to = actived ? 1.0F : 0.0F;
        super.onDisable();
    }
    @EventTarget
    public void onUpdate(EventUpdate update) {
        this.stateAnim.to = 1.0F;
    }

    private float getAlphaPC() {
        return this.stateAnim.getAnim();
    }

    private static float getMaxTime() {
        return (double)mc.player.getCooledAttackStrength(0.0F) > 0.8 ? 2500.0F : 1000.0F;
    }
    @EventTarget
    public void onAttack(EventAttack e) {
        if (e.hitted instanceof EntityLivingBase base) {
            if (base == null || !base.isEntityAlive()) {
                return;
            }

            Vec3d to = base.getPositionVector().add(0.0, (double)(base.height / 1.6F), 0.0);
            addBubble(to);
        }

    }

    private void addBubble(Vec3d addToCoord) {
        RenderManager manager = mc.getRenderManager();
        bubbles.add(new Bubble(manager.playerViewX, -manager.playerViewY, addToCoord));
    }

    private void setupDrawsBubbles3D(Runnable render) {
        RenderManager manager = mc.getRenderManager();
        Vec3d conpense = new Vec3d(manager.renderPosX, manager.renderPosY, manager.renderPosZ);
        mc.entityRenderer.disableLightmap();
        GL11.glDisable(2896);
        GL11.glDepthMask(false);
        GL11.glDisable(2884);
        GL11.glEnable(3042);
        GL11.glDisable(3008);
        GL11.glTranslated(-conpense.x, -conpense.y, -conpense.z);
        mc.getTextureManager().bindTexture(this.BUBBLE_TEXTURE);
        render.run();
        GlStateManager.tryBlendFuncSeparate(SourceFactor.SRC_ALPHA, DestFactor.ONE_MINUS_SRC_ALPHA, SourceFactor.ONE, DestFactor.ZERO);
        GL11.glTranslated(conpense.x, conpense.y, conpense.z);
        GL11.glEnable(3008);
        GL11.glDepthMask(true);
        GL11.glEnable(2884);
        mc.entityRenderer.enableLightmap();
        GL11.glEnable(2896);
    }

    private void drawBubble(Bubble bubble, float alphaPC) {
        GL11.glPushMatrix();
        Vec3d bXYZ = bubble.pos;
        GL11.glTranslated(bubble.pos.x, bubble.pos.y, bubble.pos.z);
        RenderManager manager = mc.getRenderManager();
        float extS = bubble.getDeltaTime();
        GlStateManager.translate(-Math.sin(Math.toRadians((double)bubble.viewPitch)) * (double)extS / 3.0, Math.sin(Math.toRadians((double)bubble.viewYaw)) * (double)extS / 2.0, -Math.cos(Math.toRadians((double)bubble.viewPitch)) * (double)extS / 3.0);
        GL11.glNormal3d(1.0, 1.0, 1.0);
        GL11.glRotated((double)bubble.viewPitch, 0.0, 1.0, 0.0);
        GL11.glRotated((double)bubble.viewYaw, mc.gameSettings.thirdPersonView == 2 ? -1.0 : 1.0, 0.0, 0.0);
        GL11.glScaled(-0.1, -0.1, 0.1);
        this.drawBeginsNullCoord(bubble, alphaPC);
        GL11.glPopMatrix();
    }

    private void drawBeginsNullCoord(Bubble bubble, float alphaPC) {
        float aPC = MathUtility.clamp(bubble.getDeltaTime(), 0.0F, 1.0F) * alphaPC;
        aPC = (double)aPC > 0.5 ? 1.0F - aPC : aPC;
        aPC *= 4.0F;
        aPC = aPC > 1.0F ? 1.0F : aPC;
        aPC *= alphaPC;
        float r = 50.0F * bubble.getDeltaTime() * (1.0F - bubble.getDeltaTime());

        int speedRotate = 3;
        float III = (float)(System.currentTimeMillis() % (long)(3600 / speedRotate)) / 10.0F * (float)speedRotate;
        RenderUtility.customRotatedObject2D(-1.0F, -1.0F, 2.0F, 2.0F, -III);
        this.buffer.begin(7, DefaultVertexFormats.POSITION_TEX_COLOR);
        this.buffer.pos(0.0, 0.0, 0.0).tex(0.0, 0.0).color(ColorUtility.applyOpacity(HudModule.getColor(0), aPC).getRGB()).endVertex();
        this.buffer.pos(0.0, (double)r, 0.0).tex(0.0, 1.0).color(ColorUtility.applyOpacity(HudModule.getColor(90), aPC).getRGB()).endVertex();
        this.buffer.pos((double)r, (double)r, 0.0).tex(1.0, 1.0).color(ColorUtility.applyOpacity(HudModule.getColor(180), aPC).getRGB()).endVertex();
        this.buffer.pos((double)r, 0.0, 0.0).tex(1.0, 0.0).color(ColorUtility.applyOpacity(HudModule.getColor(270), aPC).getRGB()).endVertex();
        GlStateManager.blendFunc(770, 772);
        GlStateManager.translate(-r / 2.0F, -r / 2.0F, 0.0F);
        GlStateManager.shadeModel(7425);
        GlStateManager.tryBlendFuncSeparate(SourceFactor.SRC_ALPHA, DestFactor.ONE, SourceFactor.ONE, DestFactor.ZERO);
        this.tessellator.draw();
        GlStateManager.shadeModel(7424);
        GlStateManager.translate(r / 2.0F, r / 2.0F, 0.0F);
        GlStateManager.blendFunc(770, 771);
    }
@EventTarget
    public void alwaysRender3D(EventRender e) {
        float aPC = this.getAlphaPC();
        if (!((double)aPC < 0.05)) {
            if (!bubbles.isEmpty()) {
                this.removeAuto();
                this.setupDrawsBubbles3D(() -> {
                    bubbles.forEach((bubble) -> {
                        if (bubble != null && bubble.getDeltaTime() <= 1.0F) {
                            this.drawBubble(bubble, aPC);
                        }

                    });
                });
            }
        }
    }

    private void removeAuto() {
        bubbles.removeIf((bubble) -> {
            return bubble.getDeltaTime() >= 1.0F;
        });
    }
    public final class Bubble {
        Vec3d pos;
        long time = System.currentTimeMillis();
        float maxTime = HitBubble.getMaxTime();
        float viewYaw;
        float viewPitch;

        public Bubble(float viewYaw, float viewPitch, Vec3d pos) {
            this.viewYaw = viewYaw;
            this.viewPitch = viewPitch;
            this.pos = pos;
        }

        private float getDeltaTime() {
            return (float)(System.currentTimeMillis() - this.time) / this.maxTime;
        }
    }

}
екпа 3.1 риде?
ой бля простите, не увидил что только что какието не очень хорошие люди тему подняли
 
Похожие темы
Сверху Снизу