Начинающий
Начинающий
- Статус
- Оффлайн
- Регистрация
- 7 Фев 2024
- Сообщения
- 96
- Реакции
- 0
- Выберите загрузчик игры
- Vanilla
click ->
Ассалам алейкум всем, решил слить свой таргет есп под 3.1. Если что-то будет нужно из рендера, то пишите <3
Кучу режимов таргет есп, есть множество настроек для каждого режима (кроме дефолт пнг) А также можно выбрать цвет (от клиента или кастомный, т.е каллорпикер)
Пожалуйста, авторизуйтесь для просмотра ссылки.
(png)Ассалам алейкум всем, решил слить свой таргет есп под 3.1. Если что-то будет нужно из рендера, то пишите <3
Кучу режимов таргет есп, есть множество настроек для каждого режима (кроме дефолт пнг) А также можно выбрать цвет (от клиента или кастомный, т.е каллорпикер)
TargetEsp:
package Fever.Visual.functions.impl.combat;
import Fever.Visual.events.EventDisplay;
import Fever.Visual.events.WorldEvent;
import Fever.Visual.functions.api.Category;
import Fever.Visual.functions.api.Function;
import Fever.Visual.functions.api.FunctionRegister;
import Fever.Visual.functions.impl.render.HUD;
import Fever.Visual.functions.settings.impl.BooleanSetting;
import Fever.Visual.functions.settings.impl.ColorSetting;
import Fever.Visual.functions.settings.impl.ModeSetting;
import Fever.Visual.functions.settings.impl.SliderSetting;
import Fever.Visual.utils.animations.Animation;
import Fever.Visual.utils.animations.Direction;
import Fever.Visual.utils.animations.impl.DecelerateAnimation;
import Fever.Visual.utils.math.MathUtil;
import Fever.Visual.utils.math.Vector4i;
import Fever.Visual.utils.projections.ProjectionUtil;
import Fever.Visual.utils.render.ColorUtils;
import Fever.Visual.utils.render.DisplayUtils;
import com.google.common.eventbus.Subscribe;
import com.mojang.blaze3d.matrix.MatrixStack;
import com.mojang.blaze3d.platform.GlStateManager;
import com.mojang.blaze3d.systems.RenderSystem;
import net.minecraft.client.Minecraft;
import net.minecraft.client.renderer.*;
import net.minecraft.client.renderer.entity.EntityRendererManager;
import net.minecraft.client.renderer.vertex.DefaultVertexFormats;
import net.minecraft.entity.Entity;
import net.minecraft.entity.LivingEntity;
import net.minecraft.item.ItemStack;
import net.minecraft.util.ResourceLocation;
import net.minecraft.util.math.EntityRayTraceResult;
import net.minecraft.util.math.MathHelper;
import net.minecraft.util.math.RayTraceResult;
import net.minecraft.util.math.vector.*;
import org.lwjgl.opengl.GL11;
import java.util.ArrayList;
import java.util.Comparator;
import java.util.List;
import static Fever.Visual.utils.font.Wrapper.BUILDER;
import static Fever.Visual.utils.font.Wrapper.TESSELLATOR;
import static com.mojang.blaze3d.systems.RenderSystem.depthMask;
import static org.lwjgl.opengl.GL11.*;
@FunctionRegister(name = "TargetESP", type = Category.Combat)
public class TargetESP extends Function {
private LivingEntity target;
private boolean allow = false;
private final Minecraft mc = Minecraft.getInstance();
private final Stopwatch stopWatch = new Stopwatch();
private net.minecraft.entity.LivingEntity LivingEntity;
private static final ModeSetting mode = new ModeSetting("Mode", "Ring", "Soul", "Ring", "SoulRing", "Chains", "Donut","Image");
private static final ModeSetting imageMode = new ModeSetting("Image Mode", "1", "1", "2", "3", "4", "5").setVisible(() -> mode.is("Image"));
private final ModeSetting colorMode = new ModeSetting("Цвет", "Тема", "Тема", "Свой");
private final ColorSetting customColor = new ColorSetting("Свой цвет", ColorUtils.rgb(77, 77, 77)).setVisible(() -> colorMode.is("Свой"));
private final SliderSetting soulEffectSize = new SliderSetting("Размер", 0.3f, 0.1f, 1.0f, 0.1f).setVisible(() -> mode.is("Soul") || mode.is("SoulRing"));
private final SliderSetting soulEffectAlpha = new SliderSetting("Альфа", 0.6f, 0.1f, 1.0f, 0.1f).setVisible(() -> mode.is("Soul") || mode.is("SoulRing"));
private final SliderSetting soulLength = new SliderSetting("Длинна душ", 7f, 0.1f, 10.0f, 0.1f).setVisible(() -> mode.is("Soul"));
private final SliderSetting soulRingSize = new SliderSetting("Размер душ", 0.4f, 0.1f, 0.4f, 0.01f).setVisible(() -> mode.is("SoulRing"));
private final SliderSetting SoulsValue = new SliderSetting("Кол-во душ", 10f, 3f, 20f, 1f).setVisible(() -> mode.is("SoulRing"));
private final SliderSetting donutAlpha = new SliderSetting("Альфа пончика", 0.8f, 0.1f, 1.0f, 0.1f).setVisible(() -> mode.is("Donut"));
private final SliderSetting donutSize = new SliderSetting("Размер пончика", 0.4f, 0.1f, 1.0f, 0.1f).setVisible(() -> mode.is("Donut"));
private final BooleanSetting throughWalls = new BooleanSetting("Через стены", false).setVisible(() -> mode.is("Chains"));
private final Animation chainTargetAnim = new DecelerateAnimation(400, 255);
private final Animation chainTarget2Anim = new DecelerateAnimation(400, 255);
private long startTime;
private final Animation hurtAnim = new DecelerateAnimation(100, 255);
private final Animation alpha = new DecelerateAnimation(600, 255);
private LivingEntity prevTarget;
private long lastTime = System.currentTimeMillis();
public TargetESP() {
addSettings(mode, imageMode, colorMode, customColor, soulEffectSize, soulEffectAlpha, soulLength, soulRingSize, SoulsValue, donutAlpha, donutSize, throughWalls);
}
private int getColor(int hue, float saturation) {
if (colorMode.is("Тема")) {
return HUD.getColor(hue, saturation);
} else {
return customColor.get();
}
}
private int getColor(int hue) {
return getColor(hue, 1.0f);
}
@Subscribe
private void onDisplay(EventDisplay e) {
if (this.alpha.finished(Direction.BACKWARDS)) return;
if (e.getType() != EventDisplay.Type.PRE) {
return;
}
LivingEntity target = getTarget(LivingEntity);
if (target != null && mode.is("Image")) {
if (target.isInvisible()) {
return;
}
double sin = Math.sin((double) System.currentTimeMillis() / 1000.0);
float size = 110.0F;
Vector3d interpolated = MathUtil.interpolate(target.getPositionVec(),
new Vector3d(target.lastTickPosX, target.lastTickPosY, target.lastTickPosZ),
e.getPartialTicks());
Vector2f pos = ProjectionUtil.project(interpolated.x, interpolated.y + (double) (target.getHeight() / 2.0F), interpolated.z);
GlStateManager.pushMatrix();
GlStateManager.translatef(pos.x, pos.y, 0.0F);
GlStateManager.rotatef((float) sin * 360.0F, 0.0F, 0.0F, 1.0F);
GlStateManager.translatef(-pos.x, -pos.y, 0.0F);
int color1 = getColor(90);
int color2 = getColor(180);
int color3 = getColor(270);
switch (imageMode.get()) {
case "1":
DisplayUtils.drawImage(new ResourceLocation("FeverVisual/images/swords.png"), pos.x - size / 2.0F, pos.y - size / 2.0F, size, size, new Vector4i(ColorUtils.rgb(255, 255, 255), ColorUtils.setAlpha(color1, 220), ColorUtils.setAlpha(color2, 220), ColorUtils.setAlpha(color3, 220)));
break;
case "2":
DisplayUtils.drawImage(new ResourceLocation("FeverVisual/images/bubble.png"), pos.x - size / 2.0F, pos.y - size / 2.0F, size, size, new Vector4i(ColorUtils.rgb(255, 255, 255), ColorUtils.setAlpha(color1, 220), ColorUtils.setAlpha(color2, 220), ColorUtils.setAlpha(color3, 220)));
break;
case "3":
DisplayUtils.drawImage(new ResourceLocation("FeverVisual/images/target.png"), pos.x - size / 2.0F, pos.y - size / 2.0F, size, size, new Vector4i(ColorUtils.rgb(255, 255, 255), ColorUtils.setAlpha(color1, 220), ColorUtils.setAlpha(color2, 220), ColorUtils.setAlpha(color3, 220)));
break;
case "4":
DisplayUtils.drawImage(new ResourceLocation("FeverVisual/images/target2.png"), pos.x - size / 2.0F, pos.y - size / 2.0F, size, size, new Vector4i(ColorUtils.rgb(255, 255, 255), ColorUtils.setAlpha(color1, 220), ColorUtils.setAlpha(color2, 220), ColorUtils.setAlpha(color3, 220)));
break;
case "5":
DisplayUtils.drawImage(new ResourceLocation("FeverVisual/images/target3.png"), pos.x - size / 2.0F, pos.y - size / 2.0F, size, size, new Vector4i(ColorUtils.rgb(255, 255, 255), ColorUtils.setAlpha(color1, 220), ColorUtils.setAlpha(color2, 220), ColorUtils.setAlpha(color3, 220)));
break;
}
GlStateManager.popMatrix();
}
}
private LivingEntity getTarget(LivingEntity nullTarget) {
RayTraceResult rayTraceResult = mc.objectMouseOver;
LivingEntity newTarget = nullTarget;
if (rayTraceResult != null && rayTraceResult.getType() == RayTraceResult.Type.ENTITY) {
Entity entityHit = ((EntityRayTraceResult) rayTraceResult).getEntity();
if (entityHit instanceof LivingEntity) {
LivingEntity livingEntity = (LivingEntity) entityHit;
if (livingEntity.isInvisible()) {
return null;
}
newTarget = livingEntity;
if (target != newTarget) {
target = newTarget;
stopWatch.reset();
allow = true;
}
}
} else if (target != null && stopWatch.getElapsedTime() <= 7000) {
double distanceToTarget = mc.player.getDistance(target);
if (distanceToTarget <= 4) {
if (target.isInvisible()) {
return null;
}
newTarget = target;
} else {
target = null;
allow = false;
}
} else if (stopWatch.getElapsedTime() > 10000) {
target = null;
allow = false;
}
boolean hasTarget = target != null;
if (newTarget != null) {
chainTargetAnim.setDirection(hasTarget ? Direction.FORWARDS : Direction.BACKWARDS);
chainTarget2Anim.setDirection(chainTargetAnim.getOutput() >= 0.95f ? Direction.FORWARDS : Direction.BACKWARDS);
prevTarget = newTarget;
}
return newTarget;
}
@Subscribe
private void onWorldEvent(WorldEvent e) {
LivingEntity target = getTarget(LivingEntity);
if (target == null) return;
MatrixStack ms = new MatrixStack();
if (mode.is("Soul")) {
renderSoulEffect(e, target);
} else if (mode.is("Ring")) {
renderRingEffect(e, target);
} else if (mode.is("SoulRing")) {
renderSoulRingEffect(e, target);
} else if (mode.is("Chains")) {
renderChain(ms, target);
} else if (mode.is("Donut")) {
renderDonutEffect(e, target);
}
}
private void renderDonutEffect(WorldEvent e, LivingEntity target) {
MatrixStack ms = new MatrixStack();
ms.push();
RenderSystem.pushMatrix();
RenderSystem.disableLighting();
depthMask(false);
RenderSystem.enableBlend();
RenderSystem.shadeModel(7425);
RenderSystem.disableCull();
RenderSystem.disableAlphaTest();
RenderSystem.blendFuncSeparate(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA, GL11.GL_ONE, GL11.GL_ZERO);
double x = target.getPosX();
double y = target.getPosY() + target.getHeight() / 2f;
double z = target.getPosZ();
double radius = 0.65f;
float speed = 12;
float size = donutSize.get();
double distance = 155;
int length = 155;
int maxAlpha = (int) (donutAlpha.get() * 255);
int alphaFactor = 0;
ActiveRenderInfo camera = mc.getRenderManager().info;
ms.translate(-camera.getProjectedView().getX(), -camera.getProjectedView().getY(), -camera.getProjectedView().getZ());
Vector3d interpolated = MathUtil.interpolate(target.getPositionVec(), new Vector3d(target.lastTickPosX, target.lastTickPosY, target.lastTickPosZ), e.getPartialTicks());
interpolated = new Vector3d(interpolated.x + 0.2f, interpolated.y + 0.8f + 0.5f, interpolated.z);
ms.translate(interpolated.x, interpolated.y, interpolated.z);
mc.getTextureManager().bindTexture(new ResourceLocation("FeverVisual/images/glow.png"));
List<Quad> quads = new ArrayList<>();
for (int j = 0; j < 1; j++) {
for (int i = 0; i < length; i++) {
double angle = 0.05f * (System.currentTimeMillis() - lastTime - (i * distance)) / speed;
double s = Math.sin(angle + j * (Math.PI / 1.5)) * radius;
double c = Math.cos(angle + j * (Math.PI / 1.5)) * radius;
double yOffset = Math.sin(System.currentTimeMillis() * 0.002 + j) * 0.5;
Vector3d pos = new Vector3d(s, yOffset, -c);
double dist = pos.distanceTo(camera.getProjectedView());
quads.add(new Quad(i, pos, dist, j));
}
}
quads.sort(Comparator.comparingDouble(quad -> -quad.distance));
for (Quad quad : quads) {
int i = quad.index;
int j = quad.type;
double angle = 0.05f * (System.currentTimeMillis() - lastTime - (i * distance)) / speed;
double s = Math.sin(angle + j * (Math.PI / 1.5)) * radius;
double c = Math.cos(angle + j * (Math.PI / 1.5)) * radius;
double yOffset = Math.sin(System.currentTimeMillis() * 0.002 + j) * 0.5;
Quaternion r = camera.getRotation().copy();
buffer.begin(GL_QUADS, DefaultVertexFormats.POSITION_COLOR_TEX);
ms.push();
ms.translate(s, yOffset, -c);
ms.translate(-size / 2f, -size / 2f, 0);
ms.rotate(r);
ms.translate(size / 2f, size / 2f, 0);
int color = colorMode.is("Тема") ? ColorUtils.getColor(i) : getColor(i);
int alpha = MathHelper.clamp(maxAlpha - (i * alphaFactor), 0, maxAlpha);
buffer.pos(ms.getLast().getMatrix(), 0, -size, 0).color(ColorUtils.setAlpha(color, alpha)).tex(0, 0).endVertex();
buffer.pos(ms.getLast().getMatrix(), -size, -size, 0).color(ColorUtils.setAlpha(color, alpha)).tex(0, 1).endVertex();
buffer.pos(ms.getLast().getMatrix(), -size, 0, 0).color(ColorUtils.setAlpha(color, alpha)).tex(1, 1).endVertex();
buffer.pos(ms.getLast().getMatrix(), 0, 0, 0).color(ColorUtils.setAlpha(color, alpha)).tex(1, 0).endVertex();
tessellator.draw();
ms.pop();
}
RenderSystem.defaultBlendFunc();
RenderSystem.disableBlend();
RenderSystem.enableCull();
RenderSystem.enableAlphaTest();
depthMask(true);
RenderSystem.popMatrix();
ms.pop();
}
private static class Quad {
int index;
Vector3d position;
double distance;
int type;
Quad(int index, Vector3d position, double distance, int type) {
this.index = index;
this.position = position;
this.distance = distance;
this.type = type;
}
}
private void renderChain(MatrixStack ms, LivingEntity target) {
this.chainTargetAnim.setDirection(this.target != null ? Direction.FORWARDS : Direction.BACKWARDS);
this.chainTarget2Anim.setDirection(this.target != null ? Direction.FORWARDS : Direction.BACKWARDS);
if (this.chainTargetAnim.finished(Direction.BACKWARDS)) return;
if (throughWalls.get()) {
RenderSystem.disableDepthTest();
RenderSystem.disableCull();
}
if (this.prevTarget != null) {
this.hurtAnim.setDirection(this.prevTarget.hurtTime > 0 ? Direction.FORWARDS : Direction.BACKWARDS);
}
if (this.prevTarget == null) return;
double entX = prevTarget.lastTickPosX + (prevTarget.getPosX() - prevTarget.lastTickPosX) * mc.getRenderPartialTicks() - mc.getRenderManager().info.getProjectedView().getX();
double entY = prevTarget.lastTickPosY + (prevTarget.getPosY() - prevTarget.lastTickPosY) * mc.getRenderPartialTicks() - mc.getRenderManager().info.getProjectedView().getY() - 0.5f;
double entZ = prevTarget.lastTickPosZ + (prevTarget.getPosZ() - prevTarget.lastTickPosZ) * mc.getRenderPartialTicks() - mc.getRenderManager().info.getProjectedView().getZ();
float rotSpeed = 0.5f;
float chainSize = 4;
float down = 1;
float movingValue = getMovingValue();
float gradusX = (float) (20 * Math.min(1 + Math.sin(Math.toRadians(movingValue)), 1));
float gradusZ = (float) (20 * (Math.min(1 + Math.sin(Math.toRadians(movingValue)), 2) - 1));
float width = prevTarget.getWidth() * 1.5f;
RenderSystem.enableBlend();
RenderSystem.blendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE);
for (int chain = 0; chain < 2; chain++) {
float val = 1.2f - 0.5f * (chain == 0 ? (float) chainTargetAnim.getOutput() / 255f : (float) this.chainTarget2Anim.getOutput() / 255f);
for (int glowLayer = 2; glowLayer >= 0; glowLayer--) {
ms.push();
ms.translate(entX, entY + prevTarget.getHeight() / 2, entZ);
float x = 0, y = 0, z = 0;
Matrix4f matrix = ms.getLast().getMatrix();
ms.rotate(Vector3f.ZP.rotationDegrees(chain == 0 ? gradusX : -gradusX));
ms.rotate(Vector3f.XP.rotationDegrees(chain == 0 ? gradusZ : -gradusZ));
GL11.glDisable(GL11.GL_CULL_FACE);
int alpha = chain == 0 ? (int) chainTargetAnim.getOutput() : (int) this.chainTarget2Anim.getOutput();
if (glowLayer == 0) {
ResourceLocation chainTexture = new ResourceLocation("FeverVisual/images/chain.png");
mc.getTextureManager().bindTexture(chainTexture);
RenderSystem.color4f(1.0f, 1.0f, 1.0f, 1.0f);
int baseColor = ColorUtils.setAlpha(getColor(chain == 0 ? 0 : 90), alpha);
BUILDER.begin(GL11.GL_QUADS, DefaultVertexFormats.POSITION_COLOR_TEX_LIGHTMAP);
int modif = 45 / 2;
for (int i = 0; i < 360 * 2; i += modif) {
float prevSin = (float) (x + (chain == 0 ? gradusX : -gradusX) / 100F + Math.sin(Math.toRadians(i - modif + movingValue * rotSpeed)) * width * val);
float prevCos = (float) (z + (chain == 0 ? -gradusZ : gradusZ) / 100F + Math.cos(Math.toRadians(i - modif + movingValue * rotSpeed)) * width * val);
float sin = (float) (x + (chain == 0 ? gradusX : -gradusX) / 100F + Math.sin(Math.toRadians(i + movingValue * rotSpeed)) * width * val);
float cos = (float) (z + (chain == 0 ? -gradusZ : gradusZ) / 100F + Math.cos(Math.toRadians(i + movingValue * rotSpeed)) * width * val);
int r = ColorUtils.getRed(baseColor);
int g = ColorUtils.getGreen(baseColor);
int b = ColorUtils.getBlue(baseColor);
int a = ColorUtils.getAlpha(baseColor);
BUILDER.pos(matrix, prevSin, y, prevCos).color(r, g, b, a).tex(1 / 360F * (float) (i - modif) * chainSize, 0).lightmap(0, 240).endVertex();
BUILDER.pos(matrix, sin, y, cos).color(r, g, b, a).tex(1 / 360F * (float) (i) * chainSize, 0).lightmap(0, 240).endVertex();
BUILDER.pos(matrix, sin, y + down, cos).color(r, g, b, a).tex(1 / 360F * (float) (i) * chainSize, 1 - 0.01f).lightmap(0, 240).endVertex();
BUILDER.pos(matrix, prevSin, y + down, prevCos).color(r, g, b, a).tex(1 / 360F * (float) (i - modif) * chainSize, 1 - 0.01f).lightmap(0, 240).endVertex();
}
} else {
RenderSystem.disableTexture();
float glowSize = 1.0f + glowLayer * 0.4f;
float glowAlpha = alpha * (0.6f - glowLayer * 0.2f);
int glowColor = ColorUtils.setAlpha(getColor(chain == 0 ? 0 : 90), (int) glowAlpha);
BUILDER.begin(GL11.GL_QUADS, DefaultVertexFormats.POSITION_COLOR);
int modif = 45 / 2;
for (int i = 0; i < 360 * 2; i += modif) {
float prevSin = (float) (x + (chain == 0 ? gradusX : -gradusX) / 100F + Math.sin(Math.toRadians(i - modif + movingValue * rotSpeed)) * width * val * glowSize);
float prevCos = (float) (z + (chain == 0 ? -gradusZ : gradusZ) / 100F + Math.cos(Math.toRadians(i - modif + movingValue * rotSpeed)) * width * val * glowSize);
float sin = (float) (x + (chain == 0 ? gradusX : -gradusX) / 100F + Math.sin(Math.toRadians(i + movingValue * rotSpeed)) * width * val * glowSize);
float cos = (float) (z + (chain == 0 ? -gradusZ : gradusZ) / 100F + Math.cos(Math.toRadians(i + movingValue * rotSpeed)) * width * val * glowSize);
int r = ColorUtils.getRed(glowColor);
int g = ColorUtils.getGreen(glowColor);
int b = ColorUtils.getBlue(glowColor);
int a = ColorUtils.getAlpha(glowColor);
float glowDown = down * glowSize;
BUILDER.pos(matrix, prevSin, y - glowDown * 0.1f, prevCos).color(r, g, b, a).endVertex();
BUILDER.pos(matrix, sin, y - glowDown * 0.1f, cos).color(r, g, b, a).endVertex();
BUILDER.pos(matrix, sin, y + glowDown * 1.1f, cos).color(r, g, b, a).endVertex();
BUILDER.pos(matrix, prevSin, y + glowDown * 1.1f, prevCos).color(r, g, b, a).endVertex();
}
RenderSystem.enableTexture();
}
TESSELLATOR.draw();
ms.pop();
}
}
RenderSystem.defaultBlendFunc();
RenderSystem.disableBlend();
RenderSystem.enableDepthTest();
RenderSystem.enableCull();
}
private void renderSoulRingEffect(WorldEvent e, LivingEntity target) {
EntityRendererManager rm = mc.getRenderManager();
double x = target.lastTickPosX + (target.getPosX() - target.lastTickPosX) * e.getPartialTicks() - rm.info.getProjectedView().getX();
double y = target.lastTickPosY + (target.getPosY() - target.lastTickPosY) * e.getPartialTicks() - rm.info.getProjectedView().getY();
double z = target.lastTickPosZ + (target.getPosZ() - target.lastTickPosZ) * e.getPartialTicks() - rm.info.getProjectedView().getZ();
float height = target.getHeight();
double duration = 3500;
double elapsed = (System.currentTimeMillis() % duration);
double progress = elapsed / duration;
double verticalOffset = Math.sin(progress * Math.PI * 2) * height * 0.3;
float size = soulRingSize.get();
int alpha = (int)(soulEffectAlpha.get() * 255);
float radius = target.getWidth() * 0.8f;
RenderSystem.pushMatrix();
RenderSystem.disableLighting();
RenderSystem.depthMask(false);
RenderSystem.enableBlend();
RenderSystem.blendFunc(GlStateManager.SourceFactor.SRC_ALPHA, GlStateManager.DestFactor.ONE_MINUS_SRC_ALPHA);
RenderSystem.disableCull();
mc.getTextureManager().bindTexture(new ResourceLocation("FeverVisual/images/glow.png"));
MatrixStack ms = new MatrixStack();
Tessellator tessellator = Tessellator.getInstance();
BufferBuilder buffer = tessellator.getBuffer();
Float soulCount = SoulsValue.get();
for (int i = 0; i < soulCount; i++) {
double angle = Math.toRadians(i * (360.0 / soulCount));
double rotationAngle = angle + (System.currentTimeMillis() / 10000.0) * Math.PI * 2;
double soulX = x + Math.cos(rotationAngle) * radius;
double soulY = y + height * 0.5 + verticalOffset;
double soulZ = z + Math.sin(rotationAngle) * radius;
ms.push();
ms.translate(soulX, soulY, soulZ);
Quaternion rotation = rm.info.getRotation().copy();
ms.rotate(rotation);
int color = getColor((int)(angle * 180/Math.PI));
int colorWithAlpha = (color & 0xFFFFFF) | (alpha << 24);
buffer.begin(GL_QUADS, DefaultVertexFormats.POSITION_COLOR_TEX);
buffer.pos(ms.getLast().getMatrix(), -size/2, -size*1.2f, 0).color(colorWithAlpha).tex(0, 0).endVertex();
buffer.pos(ms.getLast().getMatrix(), -size/2, size*1.2f, 0).color(colorWithAlpha).tex(0, 1).endVertex();
buffer.pos(ms.getLast().getMatrix(), size/2, size*1.2f, 0).color(colorWithAlpha).tex(1, 1).endVertex();
buffer.pos(ms.getLast().getMatrix(), size/2, -size*1.2f, 0).color(colorWithAlpha).tex(1, 0).endVertex();
tessellator.draw();
ms.pop();
}
RenderSystem.defaultBlendFunc();
RenderSystem.disableBlend();
RenderSystem.enableCull();
RenderSystem.depthMask(true);
RenderSystem.popMatrix();
}
private void renderSoulEffect(WorldEvent e, LivingEntity target) {
MatrixStack ms = new MatrixStack();
ms.push();
RenderSystem.pushMatrix();
RenderSystem.disableLighting();
RenderSystem.depthMask(false);
RenderSystem.enableBlend();
RenderSystem.shadeModel(7425);
RenderSystem.disableCull();
RenderSystem.disableAlphaTest();
RenderSystem.blendFuncSeparate(770, 1, 0, 1);
double x = target.getPosX();
double y = target.getPosY() + target.getHeight() / 2f;
double z = target.getPosZ();
double radius = 0.7f;
float speed = 30;
float size = soulEffectSize.get();
double distance = 25;
int maxAlpha = 255;
int alphaFactor = 20;
int length = Math.round(soulLength.get());
ActiveRenderInfo camera = mc.getRenderManager().info;
ms.translate(-mc.getRenderManager().info.getProjectedView().getX(),
-mc.getRenderManager().info.getProjectedView().getY(),
-mc.getRenderManager().info.getProjectedView().getZ());
Vector3d interpolated = MathUtil.interpolate(target.getPositionVec(),
new Vector3d(target.lastTickPosX, target.lastTickPosY, target.lastTickPosZ),
e.getPartialTicks());
interpolated.y += 0.75f;
ms.translate(interpolated.x + 0.2f, interpolated.y + 0.5f, interpolated.z);
mc.getTextureManager().bindTexture(new ResourceLocation("FeverVisual/images/glow.png"));
Tessellator tessellator = Tessellator.getInstance();
BufferBuilder buffer = tessellator.getBuffer();
for (int j = 0; j < 3; j++) {
for (int i = 0; i < length; i++) {
Quaternion r = camera.getRotation().copy();
buffer.begin(GL_QUADS, DefaultVertexFormats.POSITION_COLOR_TEX);
double angle = 0.15f * (System.currentTimeMillis() - startTime - (i * distance)) / (speed);
double s = Math.sin(angle) * radius;
double c = Math.cos(angle) * radius;
switch (j) {
case 0:
ms.translate(s, c, -c);
break;
case 1:
ms.translate(-s, s, -c);
break;
case 2:
ms.translate(s, -c, -c);
break;
}
ms.translate(-size / 2f, -size / 2f, 0);
ms.rotate(r);
ms.translate(size / 2f, size / 2f, 0);
int color = getColor(i);
int alpha = MathHelper.clamp(maxAlpha - (i * alphaFactor), 0, maxAlpha);
int colorWithAlpha = (color & 0xFFFFFF) | (MathHelper.clamp((int) (soulEffectAlpha.get() * 255), 255, 255) << 24);
buffer.pos(ms.getLast().getMatrix(), 0, -size, 0).color(colorWithAlpha).tex(0, 0).endVertex();
buffer.pos(ms.getLast().getMatrix(), -size, -size, 0).color(colorWithAlpha).tex(0, 1).endVertex();
buffer.pos(ms.getLast().getMatrix(), -size, 0, 0).color(colorWithAlpha).tex(1, 1).endVertex();
buffer.pos(ms.getLast().getMatrix(), 0, 0, 0).color(colorWithAlpha).tex(1, 0).endVertex();
tessellator.draw();
ms.translate(-size / 2f, -size / 2f, 0);
r.conjugate();
ms.rotate(r);
ms.translate(size / 2f, size / 2f, 0);
switch (j) {
case 0:
ms.translate(-s, -c, c);
break;
case 1:
ms.translate(s, -s, c);
break;
case 2:
ms.translate(-s, c, c);
break;
}
}
}
ms.translate(-x, -y, -z);
RenderSystem.defaultBlendFunc();
RenderSystem.disableBlend();
RenderSystem.enableCull();
RenderSystem.enableAlphaTest();
RenderSystem.depthMask(true);
RenderSystem.popMatrix();
ms.pop();
}
private void renderRingEffect(WorldEvent e, LivingEntity target) {
EntityRendererManager rm = mc.getRenderManager();
double x = target.lastTickPosX + (target.getPosX() - target.lastTickPosX) * (double) e.getPartialTicks() - rm.info.getProjectedView().getX();
double y = target.lastTickPosY + (target.getPosY() - target.lastTickPosY) * (double) e.getPartialTicks() - rm.info.getProjectedView().getY();
double z = target.lastTickPosZ + (target.getPosZ() - target.lastTickPosZ) * (double) e.getPartialTicks() - rm.info.getProjectedView().getZ();
float height = target.getHeight();
double duration = 2000;
double elapsed = (System.currentTimeMillis() % duration);
boolean side = elapsed > (duration / 2);
double progress = elapsed / (duration / 2);
if (side) progress -= 1;
else progress = 1 - progress;
progress = (progress < 0.5) ? 2 * progress * progress : 1 - Math.pow((-2 * progress + 2), 2) / 2;
double eased = (height / 1.2) * ((progress > 0.5) ? 1 - progress : progress) * ((side) ? -1 : 1);
RenderSystem.pushMatrix();
GL11.glDepthMask(false);
GL11.glDisable(GL11.GL_DEPTH_TEST);
GL11.glEnable(GL11.GL_LINE_SMOOTH);
RenderSystem.disableTexture();
RenderSystem.enableBlend();
RenderSystem.blendFunc(GlStateManager.SourceFactor.SRC_ALPHA, GlStateManager.DestFactor.ONE);
RenderSystem.disableAlphaTest();
RenderSystem.shadeModel(GL11.GL_SMOOTH);
RenderSystem.disableCull();
RenderSystem.lineWidth(1.5f);
RenderSystem.color4f(-1f, -1f, -1f, -1f);
BufferBuilder buffer = Tessellator.getInstance().getBuffer();
buffer.begin(GL11.GL_QUAD_STRIP, DefaultVertexFormats.POSITION_COLOR);
for (int i = 0; i <= 360; i++) {
buffer.pos(x + Math.cos(Math.toRadians(i)) * target.getWidth() * 0.8, y + (height * progress), z + Math.sin(Math.toRadians(i)) * target.getWidth() * 0.8)
.color(ColorUtils.setAlpha(getColor(0), 225)).endVertex();
buffer.pos(x + Math.cos(Math.toRadians(i)) * target.getWidth() * 0.8, y + (height * progress) + eased, z + Math.sin(Math.toRadians(i)) * target.getWidth() * 0.8)
.color(ColorUtils.setAlpha(getColor(0), 1)).endVertex();
}
buffer.finishDrawing();
WorldVertexBufferUploader.draw(buffer);
RenderSystem.color4f(-1f, -1f, -1f, -1f);
buffer.begin(GL11.GL_LINE_LOOP, DefaultVertexFormats.POSITION_COLOR);
for (int i = 0; i <= 360; i++) {
buffer.pos(x + Math.cos(Math.toRadians(i)) * target.getWidth() * 0.8, y + (height * progress), z + Math.sin(Math.toRadians(i)) * target.getWidth() * 0.8)
.color(ColorUtils.setAlpha(getColor(0), 1)).endVertex();
}
buffer.finishDrawing();
WorldVertexBufferUploader.draw(buffer);
RenderSystem.enableCull();
RenderSystem.disableBlend();
RenderSystem.enableTexture();
RenderSystem.enableAlphaTest();
GL11.glDepthMask(true);
GL11.glEnable(GL11.GL_DEPTH_TEST);
GL11.glDisable(GL11.GL_LINE_SMOOTH);
GL11.glHint(GL11.GL_LINE_SMOOTH_HINT, GL11.GL_NICEST);
RenderSystem.shadeModel(GL11.GL_FLAT);
RenderSystem.popMatrix();
}
public static class Stopwatch {
private long startTime;
public Stopwatch() {
reset();
}
public void reset() {
startTime = System.currentTimeMillis();
}
public long getElapsedTime() {
return System.currentTimeMillis() - startTime;
}
}
private float getMovingValue() {
return (System.currentTimeMillis() % 360000) * 0.15f;
}
}
