Начинающий
- Статус
- Оффлайн
- Регистрация
- 27 Мар 2025
- Сообщения
- 4
- Реакции
- 0
...Сидел около 10 мин над этим держите знаю что не очень похоже
ss -Пожалуйста, авторизуйтесь для просмотра ссылки.
Код:package im.okay.ui.display.impl; import com.mojang.blaze3d.platform.GlStateManager; import im.okay.okay; import im.okay.events.EventDisplay; import im.okay.ui.display.ElementRenderer; import im.okay.ui.styles.Style; import im.okay.utils.animations.Animation; import im.okay.utils.animations.Direction; import im.okay.utils.animations.impl.EaseBackIn; import im.okay.utils.client.ClientUtil; import im.okay.utils.drag.Dragging; import im.okay.utils.math.MathUtil; import im.okay.utils.math.StopWatch; import im.okay.utils.math.Vector4i; import im.okay.utils.render.ColorUtils; import im.okay.utils.render.DisplayUtils; import im.okay.utils.render.Scissor; import im.okay.utils.render.Stencil; import im.okay.utils.render.font.Fonts; import lombok.AccessLevel; import lombok.RequiredArgsConstructor; import lombok.experimental.FieldDefaults; import net.minecraft.client.gui.AbstractGui; import net.minecraft.client.gui.screen.ChatScreen; import net.minecraft.client.renderer.entity.EntityRenderer; import net.minecraft.entity.LivingEntity; import net.minecraft.entity.player.PlayerEntity; 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; @FieldDefaults(level = AccessLevel.PRIVATE) @RequiredArgsConstructor public class TargetInfoRenderer5 implements ElementRenderer { final StopWatch stopWatch = new StopWatch(); final Dragging drag; LivingEntity entity = null; boolean allow; final Animation animation = new EaseBackIn(400, 1, 1); float healthAnimation = 0.0f; float absorptionAnimation = 0.0f; @Override public void render(EventDisplay eventDisplay) { entity = getTarget(entity); boolean out = !allow || stopWatch.isReached(1000); animation.setDuration(out ? 400 : 300); animation.setDirection(out ? Direction.BACKWARDS : Direction.FORWARDS); if (animation.getOutput() == 0.0f) { entity = null; } if (entity != null) { String name = entity.getName().getString(); float posX = drag.getX(); float posY = drag.getY(); float headSize = 28; float spacing = 5; float width = 172 / 1.5f; float height = 59 / 1.5f; drag.setWidth(width); drag.setHeight(height); float shrinking = 1.5f; Score score = mc.world.getScoreboard().getOrCreateScore(entity.getScoreboardName(), mc.world.getScoreboard().getObjectiveInDisplaySlot(2)); float hp = entity.getHealth(); float maxHp = entity.getMaxHealth(); String header = mc.ingameGUI.getTabList().header == null ? " " : mc.ingameGUI.getTabList().header.getString().toLowerCase(); if (mc.getCurrentServerData() != null && mc.getCurrentServerData().serverIP.contains("funtime") && (header.contains("анархия") || header.contains("гриферский")) && entity instanceof PlayerEntity) { hp = score.getScorePoints(); maxHp = 20; } healthAnimation = MathUtil.fast(healthAnimation, MathHelper.clamp(hp / maxHp, 0, 1), 10); absorptionAnimation = MathUtil.fast(absorptionAnimation, MathHelper.clamp(entity.getAbsorptionAmount() / maxHp, 0, 1), 10); if (mc.getCurrentServerData() != null && mc.getCurrentServerData().serverIP.contains("funtime") && (header.contains("анархия") || header.contains("гриферский")) && entity instanceof PlayerEntity) { hp = score.getScorePoints(); maxHp = 20; } float animationValue = (float) animation.getOutput(); float halfAnimationValueRest = (1 - animationValue) / 2f; float testX = posX + (width * halfAnimationValueRest); float testY = posY + (height * halfAnimationValueRest); float testW = width * animationValue; float testH = height * animationValue; int windowWidth = ClientUtil.calc(mc.getMainWindow().getScaledWidth()); GlStateManager.pushMatrix(); Style style = okay.getInstance().getStyleManager().getCurrentStyle(); sizeAnimation(posX + (width / 2), posY + (height / 2), animation.getOutput()); drawStyledRect(posX, posY, width, height, 4); DisplayUtils.drawShadow(posX, posY, width, height, 2, ColorUtils.rgba(0,0,0,0)); Stencil.initStencilToWrite(); DisplayUtils.drawRoundedRect(posX + spacing, posY + spacing + 1, headSize, headSize, 6, style.getSecondColor().getRGB()); Stencil.readStencilBuffer(1); Stencil.uninitStencilBuffer(); drawTargetHead(entity, posX + spacing, posY + spacing + 1, headSize, headSize); Scissor.push(); Scissor.setFromComponentCoordinates(testX, testY, testW - 6, testH); Fonts.sfui.drawText(eventDisplay.getMatrixStack(), entity.getName().getString(), posX + headSize + spacing + spacing, posY + spacing + 1, -1, 8); Fonts.sfui.drawText(eventDisplay.getMatrixStack(), "HP: ", posX + headSize + spacing + spacing, posY + spacing + 1 + spacing + spacing + 2, ColorUtils.rgb(255, 255, 255), 7); Fonts.sfui.drawText(eventDisplay.getMatrixStack(), "" + ((int) hp + (int) mc.player.getAbsorptionAmount()), posX + headSize + spacing + spacing + 12.5f, posY + spacing + 1 + spacing + spacing + 2, ColorUtils.rgb(255, 255, 255), 7); Scissor.unset(); Scissor.pop(); DisplayUtils.drawRoundedRect(posX + headSize + spacing + spacing, posY + height - spacing * 2, (width - 42), 4, 2, ColorUtils.rgb(255, 255, 255)); DisplayUtils.drawRoundedRect(posX + headSize + spacing + spacing, posY + height - spacing * 2, (width - 42) * healthAnimation, 4, 2, ColorUtils.getColor(0)); GlStateManager.popMatrix(); } } private LivingEntity getTarget(LivingEntity nullTarget) { LivingEntity auraTarget = okay.getInstance().getFunctionRegistry().getKillAura().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; } 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 void drawTargetHead(LivingEntity entity, float x, float y, float width, float height) { if (entity != null) { GL11.glEnable(GL11.GL_STENCIL_TEST); Stencil.initStencilToWrite(); DisplayUtils.drawRoundedRect(x, y, width, height, 3, -1); Stencil.readStencilBuffer(1); EntityRenderer<? super LivingEntity> renderer = mc.getRenderManager().getRenderer(entity); drawFace( renderer.getEntityTexture(entity), x, y, 8F, 8F, 8F, 8F, width, height, 64F, 64F, entity ); Stencil.uninitStencilBuffer(); GL11.glDisable(GL11.GL_STENCIL_TEST); } } public void drawFace(ResourceLocation res, float d, float y, float u, float v, float uWidth, float vHeight, float width, float height, float tileWidth, float tileHeight, LivingEntity target) { GL11.glEnable(GL11.GL_BLEND); GL11.glBlendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA); mc.getTextureManager().bindTexture(res); float hurtPercent = (target.hurtTime - (target.hurtTime != 0 ? mc.timer.renderPartialTicks : 0.0f)) / 10.0f; GL11.glColor4f(1, 1 - hurtPercent, 1 - hurtPercent, 1); AbstractGui.drawScaledCustomSizeModalRect(d, y, u, v, uWidth, vHeight, width, height, tileWidth, tileHeight); GL11.glColor4f(1, 1, 1, 1); GL11.glDisable(GL11.GL_BLEND); } private void drawStyledRect(float x, float y, float width, float height, float radius) { DisplayUtils.drawShadow(x, y, width, height, 8, ColorUtils.getColor(0)); DisplayUtils.gradientrect(x, y, width, height, 6); DisplayUtils.drawRoundedRect(x - 1, y - 1, width + 2, height + 2, radius, ColorUtils.getColor(0)); DisplayUtils.drawRoundedRect(x, y, width, height, radius, ColorUtils.rgb(0, 0, 0)); } }
ну как обычно, изуродовал обычный таргет худ експы..
Последнее редактирование: