Начинающий
- Статус
- Оффлайн
- Регистрация
- 22 Окт 2024
- Сообщения
- 27
- Реакции
- 0
- Выберите загрузчик игры
- Прочие моды
Слэм югейм
Таргет худ за 5 минут
Мама папа виндсюрф я крутая семья
Code
SS
Таргет худ за 5 минут
Мама папа виндсюрф я крутая семья
Code
меня били в детстве:
package alpha.night.ui.display.impl;
import com.mojang.blaze3d.systems.RenderSystem;
import com.mojang.blaze3d.matrix.MatrixStack;
import com.mojang.blaze3d.platform.GlStateManager;
import alpha.night.NightDLS;
import alpha.night.events.EventDisplay;
import alpha.night.modules.api.ModuleManager;
import alpha.night.modules.impl.render.HUD;
import alpha.night.modules.impl.combat.HitAura;
import alpha.night.ui.display.ElementRenderer;
import alpha.night.modules.impl.render.Theme;
import alpha.night.utils.animations.Animation;
import alpha.night.utils.animations.Direction;
import alpha.night.utils.animations.impl.EaseBackIn;
import alpha.night.utils.client.ClientUtil;
import alpha.night.utils.drag.Dragging;
import alpha.night.utils.math.MathUtil;
import alpha.night.utils.math.StopWatch;
import alpha.night.utils.math.Vector4i;
import alpha.night.utils.render.color.ColorUtils;
import alpha.night.utils.render.GaussianBlur;
import alpha.night.utils.render.font.Fonts;
import alpha.night.utils.render.gl.Scissor;
import alpha.night.utils.render.gl.Stencil;
import alpha.night.utils.render.rect.RenderUtility;
import alpha.night.utils.render.rect.RectUtil;
import alpha.night.utils.text.GradientUtil;
import alpha.night.utils.text.font.ClientFonts;
import lombok.AccessLevel;
import lombok.RequiredArgsConstructor;
import lombok.experimental.FieldDefaults;
import net.minecraft.client.entity.player.AbstractClientPlayerEntity;
import net.minecraft.client.gui.AbstractGui;
import net.minecraft.client.gui.screen.ChatScreen;
import net.minecraft.entity.Entity;
import net.minecraft.entity.LivingEntity;
import net.minecraft.entity.player.PlayerEntity;
import net.minecraft.item.ItemStack;
import net.minecraft.scoreboard.Score;
import net.minecraft.util.ResourceLocation;
import net.minecraft.util.math.MathHelper;
import net.minecraft.util.math.vector.Vector4f;
import org.lwjgl.opengl.GL11;
import java.text.DecimalFormat;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Collection;
import java.util.List;
import java.util.concurrent.atomic.AtomicReference;
@FieldDefaults(level = AccessLevel.PRIVATE)
@RequiredArgsConstructor
public class TargetInfoRenderer implements ElementRenderer {
final StopWatch stopWatch = new StopWatch();
final Dragging drag;
LivingEntity entity = null;
boolean allow;
final Animation fadeAnimation = new EaseBackIn(600, 1, 1);
float healthAnimation = 0.0f; float absorptionAnimation = 0.0f;
float width = 138 / 1.5f;
float height = 54 / 1.5f;
@Override
public void render(EventDisplay eventDisplay) {
entity = getTarget(entity);
float rounding = 6;
boolean out = !allow || stopWatch.isReached(1000);
fadeAnimation.setDirection(out ? Direction.BACKWARDS : Direction.FORWARDS); FloatFormatter formatter = new FloatFormatter();
if (out) {
entity = null;
}
if (entity != null) {
String name = entity.getName().getString();
float posX = drag.getX();
float posY = drag.getY();
int headSize = 28;
float spacing = 5;
drag.setWidth(width);
drag.setHeight(height);
Score score = mc.world.getScoreboard().getOrCreateScore(entity.getScoreboardName(), mc.world.getScoreboard().getObjectiveInDisplaySlot(2));
float hp = entity.getHealth();
float maxHp = entity.getMaxHealth();
float healthPercent = (hp / maxHp) * 100;
String healthText = String.format(" %.1f%%", healthPercent);
healthAnimation = MathUtil.fast(healthAnimation, MathHelper.clamp(hp / maxHp, 0, 1), 10);
absorptionAnimation = MathUtil.fast(absorptionAnimation, MathHelper.clamp(entity.getAbsorptionAmount() / maxHp, 0, 1), 10);
float fadeValue = (float) fadeAnimation.getOutput(); float halfAnimationValueRest = 0f;
float testX = posX;
float testY = posY;
float testW = width;
float testH = height;
float finalHp;
String header = mc.ingameGUI.getTabList().header == null ? " " : mc.ingameGUI.getTabList().header.getString().toLowerCase();
if (mc.getCurrentServerData() != null && mc.getCurrentServerData().serverIP.contains("funsky")) {
finalHp = formatter.format(hp);
} else {
finalHp = formatter.format((hp + entity.getAbsorptionAmount()));
}
if (mc.getCurrentServerData() != null && mc.getCurrentServerData().serverIP.contains("funtime") && (header.contains("анархия") || header.contains("гриферский")) && this.entity instanceof PlayerEntity) {
hp = (float)score.getScorePoints();
maxHp = 20.0F;
}
this.healthAnimation = MathUtil.fast(this.healthAnimation, MathHelper.clamp(hp / maxHp, 0.0F, 1.0F), 10.0F);
this.absorptionAnimation = MathUtil.fast(this.absorptionAnimation, MathHelper.clamp(this.entity.getAbsorptionAmount() / maxHp, 0.0F, 1.0F), 10.0F);
if (mc.getCurrentServerData() != null && mc.getCurrentServerData().serverIP.contains("funtime") && (header.contains("анархия") || header.contains("гриферский")) && this.entity instanceof PlayerEntity) {
hp = (float)score.getScorePoints();
maxHp = 20.0F;
}
GlStateManager.pushMatrix();
HUD hud = NightDLS.getInstance().getModuleManager().getHud();
if (hud.blur.get()) {
GaussianBlur.startBlur();
RenderUtility.drawRoundedRect(posX, posY, width, height, 5, ColorUtils.setAlpha(Theme.RectColor(0), (int)(30 * fadeValue)));
GaussianBlur.endBlur(8f, 1f);
RenderUtility.drawRoundedRect(posX, posY, width, height, 5, ColorUtils.rgba(5, 5, 5, (int)(150 * fadeValue)));
RenderUtility.drawRoundedRect(posX, posY, width, height, 5, ColorUtils.setAlpha(Theme.RectColor(0), (int)(30 * fadeValue)));
} else {
RenderUtility.drawRoundedRect(posX, posY, width, height, 5, ColorUtils.rgba(5, 5, 5, (int)(200 * fadeValue)));
RenderUtility.drawRoundedRect(posX, posY, width, height, 5, ColorUtils.setAlpha(Theme.RectColor(0), (int)(30 * fadeValue)));
}
if (NightDLS.getInstance().getModuleManager().getModule(HUD.class).tHudMode.is("Обычный")) {
drawHead(eventDisplay.getMatrixStack(), entity, posX + 5, posY + 5, 25);
RenderUtility.drawRoundedRect(posX + 5 + headSize + spacing + spacing - 9, posY + 6 + height - spacing * 2 - 4f, (width - 40), 3, new Vector4f(3, 3, 3, 3), Theme.RectColor(0));
RenderUtility.drawRoundedRect(posX + 5 + headSize + spacing + spacing - 9, posY + 6 + height - spacing * 2 - 4f, (width - 40) * healthAnimation, 3, new Vector4f(3, 3, 3, 3), Theme.MainColor(0));
RenderUtility.drawShadow(posX + 5 + headSize + spacing + spacing - 9, posY + 6 + height - spacing * 2 - 4f, (width - 40) * healthAnimation, 3, 8, Theme.RectColor(0), Theme.MainColor(0));
float maxTextWidth = (width - (headSize + spacing * 2)) - 10;
float nameWidth = Fonts.montserrat.getWidth(name, 8, 0.07f);
if (nameWidth > maxTextWidth) {
while (nameWidth > maxTextWidth && name.length() > 0) {
name = name.substring(0, name.length() - 1);
nameWidth = Fonts.montserrat.getWidth(name, 8, 0.07f);
}
name += "...";
}
Scissor.push();
Scissor.setFromComponentCoordinates(testX, testY, testW, testH);
float fixedHeadSize = 28;
Fonts.montserrat.drawText(eventDisplay.getMatrixStack(), name, posX - 4.3f + fixedHeadSize + spacing + spacing, posY + 1 + spacing, Theme.MainColor(0), 8, .07f);
Fonts.sfui.drawText(
eventDisplay.getMatrixStack(),
healthText,
posX + 23,
posY + height - spacing * 1.8f - 10,
Theme.MainColor(0),
6.5f,
0.05f
);
Scissor.unset();
Scissor.pop();
Vector4i vector4i = new Vector4i(Theme.rectcolor.get(), Theme.rectcolor.get(), Theme.visualscolor.get(), Theme.visualscolor.get());
}
if (NightDLS.getInstance().getModuleManager().getModule(HUD.class).tHudMode.is("Неон")) {
width = 160 / 1.5f;
headSize = 35;
if (hud.blur.get()) {
GaussianBlur.startBlur();
RenderUtility.drawRoundedRect(posX, posY, width, height, 5, ColorUtils.setAlpha(Theme.RectColor(0), (int)(30 * fadeValue)));
GaussianBlur.endBlur(8f, 1f);
RenderUtility.drawRoundedRect(posX, posY, width, height, 5, ColorUtils.rgba(5, 5, 5, (int)(150 * fadeValue)));
RenderUtility.drawRoundedRect(posX, posY, width, height, 5, ColorUtils.setAlpha(Theme.RectColor(0), (int)(30 * fadeValue)));
} else {
RenderUtility.drawRoundedRect(posX, posY, width, height, 5, ColorUtils.rgba(5, 5, 5, (int)(200 * fadeValue)));
RenderUtility.drawRoundedRect(posX, posY, width, height, 5, ColorUtils.setAlpha(Theme.RectColor(0), (int)(30 * fadeValue)));
}
Stencil.initStencilToWrite();
RenderUtility.drawRoundedRect(posX, posY, headSize, headSize, 5,-1);
Stencil.readStencilBuffer(1);
drawHead(eventDisplay.getMatrixStack(), entity, posX, posY, headSize);
Stencil.uninitStencilBuffer();
Vector4i vector4i = new Vector4i(Theme.RectColor(0), Theme.RectColor(0), Theme.MainColor(0), Theme.MainColor(0));
RenderUtility.drawRoundedRect(posX, posY + 3 + height - spacing, (width), 5, new Vector4f(0,0,0,0), Theme.RectColor(0));
RenderUtility.drawRoundedRect(posX, posY + 3 + height - spacing, (width) * healthAnimation, 5, new Vector4f(0,0,0,0), Theme.MainColor(0));
RenderUtility.drawShadow(posX, posY + 3 + height - spacing, (width) * healthAnimation, 5, 8, ColorUtils.setAlpha(Theme.RectColor(0), 80), ColorUtils.setAlpha(Theme.MainColor(0), 80));
float x = posX + headSize + spacing - 2.5f, y = posY + spacing;
Scissor.push();
Scissor.setFromComponentCoordinates(testX, testY, testW - 1, testH);
Fonts.montserrat.drawText(eventDisplay.getMatrixStack(), name, x, y, Theme.MainColor(0), 8, 0.05f);
Fonts.montserrat.drawText(eventDisplay.getMatrixStack(), "Health: ", x , y + (spacing * 2), Theme.MainColor(0), 8, 0.02f);
Fonts.montserrat.drawText(eventDisplay.getMatrixStack(), GradientUtil.gradient(finalHp + "").getString(), x + Fonts.montserrat.getWidth("Health: ", 8, 0.02f), y + (spacing * 2), Theme.MainColor(0), 8, 0.05f);
RenderUtility.drawRoundedRect(posX, posY, headSize, headSize, 5, Theme.MainColor(0));
Scissor.unset();
Scissor.pop();
drawItemStack(posX + headSize + spacing - 2.5f, posY - 1 + spacing * 5, 9, 0.6f);
}
GlStateManager.popMatrix();
}
}
private LivingEntity getTarget(LivingEntity nullTarget) {
LivingEntity auraTarget = NightDLS.getInstance().getModuleManager().getModule(HitAura.class).getTarget();
LivingEntity target = nullTarget;
if (auraTarget != null) {
stopWatch.reset();
allow = true;
target = auraTarget;
} else if (mc.currentScreen instanceof ChatScreen) {
stopWatch.reset();
allow = true;
target = mc.player;
} else {
allow = false;
}
return target;
}
private void drawHead(MatrixStack matrix, final Entity entity, final double x, final double y, final int size) {
if (entity instanceof AbstractClientPlayerEntity player) {
RenderSystem.enableBlend();
RenderSystem.blendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA);
RenderSystem.alphaFunc(GL11.GL_GREATER, 0);
RenderSystem.enableTexture();
mc.getTextureManager().bindTexture(player.getLocationSkin());
float hurtPercent = (((AbstractClientPlayerEntity) entity).hurtTime - (((AbstractClientPlayerEntity) entity).hurtTime != 0 ? mc.timer.renderPartialTicks : 0.0f)) / 10.0f;
RenderSystem.color4f(1, 1 - hurtPercent, 1 - hurtPercent, 1);
AbstractGui.blit(matrix, (float) x, (float) y, size, size, 4F, 4F, 4F, 4F, 32F, 32F);
RenderUtility.scaleStart((float) (x + size / 2F), (float) (y + size / 2F), 1.1F);
AbstractGui.blit(matrix, (float) x, (float) y, size, size, 20, 4, 4, 4, 32, 32);
RenderUtility.scaleEnd();
RenderSystem.disableBlend();
} else {
int color = ColorUtils.getColor(20, 128);
RectUtil.getInstance().drawRoundedRectShadowed(matrix, (float) x, (float) y, (float) (x + size), (float) (y + size), 2F, 1, color, color, color, color, false, false, true, true);
ClientFonts.interRegular[size * 2].drawCenteredString(matrix, "?", x + (size / 2F), y + 3 + (size / 2F) - (ClientFonts.interRegular[size * 2].getFontHeight() / 2F), -1);
}
}
private void drawItemStack(float x, float y, float offset, float scale) {
ArrayList<ItemStack> stackList = new ArrayList(Arrays.asList(this.entity.getHeldItemMainhand(), this.entity.getHeldItemOffhand()));
stackList.addAll((Collection)this.entity.getArmorInventoryList());
AtomicReference<Float> posX = new AtomicReference(x);
stackList.stream().filter((stack) -> {
return !stack.isEmpty();
}).forEach((stack) -> {
drawItemStack(stack, (Float)posX.getAndAccumulate(offset, Float::sum), y, true, true, scale);
});
}
public void drawItemStack(ItemStack stack, float x, float y, boolean withoutOverlay, boolean scale, float scaleValue) {
RenderSystem.pushMatrix();
RenderSystem.translatef(x, y, 0.0F);
if (scale) {
GL11.glScaled((double)scaleValue, (double)scaleValue, (double)scaleValue);
}
mc.getItemRenderer().renderItemAndEffectIntoGUI(stack, 0, 0);
if (withoutOverlay) {
mc.getItemRenderer().renderItemOverlays(mc.fontRenderer, stack, 0, 0);
}
RenderSystem.popMatrix();
}
public static void sizeAnimation(double width, double height, double scale) {
GlStateManager.translated(width, height, 0);
GlStateManager.scaled(scale, scale, scale);
GlStateManager.translated(-width, -height, 0);
}
public class FloatFormatter {
public float format(float value) {
return Math.round(value * 2) / 2.0f;
}
}
}
SS

