Начинающий
- Статус
- Оффлайн
- Регистрация
- 20 Июл 2025
- Сообщения
- 52
- Реакции
- 0
- Выберите загрузчик игры
- Fabric
салем югеймик, решил перенести arrows от @HardyDimo4ka , не сказать что прям ебать похожи но пастерки захавают, желательно с ними поработать т.к. они уродливые а так хавайте
если еще что то нужно, просите! :)
arrows:
package zenith.zov.client.modules.impl.render;
import com.darkmagician6.eventapi.EventTarget;
import net.minecraft.client.gui.screen.ingame.InventoryScreen;
import net.minecraft.client.util.math.MatrixStack;
import net.minecraft.entity.player.PlayerEntity;
import net.minecraft.util.Identifier;
import net.minecraft.util.math.MathHelper;
import zenith.zov.Zenith;
import zenith.zov.base.events.impl.render.EventRender2D;
import zenith.zov.client.modules.api.Category;
import zenith.zov.client.modules.api.Module;
import zenith.zov.client.modules.api.ModuleAnnotation;
import zenith.zov.utility.render.display.base.color.ColorRGBA;
import zenith.zov.utility.render.display.shader.DrawUtil;
@ModuleAnnotation(name = "Arrows", category = Category.RENDER, description = "Показывает стрелки к игрокам")
public final class Arrows extends Module {
public static final Arrows INSTANCE = new Arrows();
private static final Identifier TRIANGLE_TEXTURE = Zenith.id("icons/triangle.png");
public float animationStep;
private float lastYaw;
private float lastPitch;
private float animatedYaw;
private float animatedPitch;
private Arrows() {}
@EventTarget
public void onRender2D(EventRender2D event) {
if (mc.player == null || mc.world == null) {
return;
}
float size = 60;
if (mc.currentScreen instanceof InventoryScreen) {
size += 100;
}
animationStep += (size - animationStep) * 0.1f;
if (mc.options.getPerspective().isFirstPerson()) {
for (PlayerEntity player : mc.world.getPlayers()) {
if (player == mc.player || player.getName().getString().isEmpty()) {
continue;
}
double x = player.prevX + (player.getX() - player.prevX) * event.getTickDelta()
- mc.gameRenderer.getCamera().getPos().getX();
double z = player.prevZ + (player.getZ() - player.prevZ) * event.getTickDelta()
- mc.gameRenderer.getCamera().getPos().getZ();
double cos = MathHelper.cos((float) (mc.gameRenderer.getCamera().getYaw() * (Math.PI * 2 / 360)));
double sin = MathHelper.sin((float) (mc.gameRenderer.getCamera().getYaw() * (Math.PI * 2 / 360)));
double rotY = -(z * cos - x * sin);
double rotX = -(x * cos + z * sin);
float angle = (float) (Math.atan2(rotY, rotX) * 180 / Math.PI);
double x2 = animationStep * MathHelper.cos((float) Math.toRadians(angle)) + mc.getWindow().getScaledWidth() / 2f;
double y2 = animationStep * MathHelper.sin((float) Math.toRadians(angle)) + mc.getWindow().getScaledHeight() / 2f;
x2 += animatedYaw;
y2 += animatedPitch;
MatrixStack matrices = event.getContext().getMatrices();
matrices.push();
matrices.translate(x2, y2, 0);
matrices.multiply(net.minecraft.util.math.RotationAxis.POSITIVE_Z.rotationDegrees(angle + 90));
boolean isFriend = Zenith.getInstance().getFriendManager().isFriend(player.getName().getString());
drawTriangle(event.getContext().getMatrices(), isFriend);
matrices.pop();
}
}
lastYaw = mc.player.getYaw();
lastPitch = mc.player.getPitch();
}
private void drawTriangle(MatrixStack matrices, boolean isFriend) {
if (isFriend) {
ColorRGBA friendColor = new ColorRGBA(0, 255, 0, 200);
DrawUtil.drawImageAlpha(matrices, TRIANGLE_TEXTURE, -8, -9, 18, 18, friendColor, friendColor, friendColor, friendColor);
} else {
ColorRGBA color1 = Zenith.getInstance().getThemeManager().getClientColor(0).withAlpha(200);
ColorRGBA color2 = Zenith.getInstance().getThemeManager().getClientColor(90).withAlpha(200);
ColorRGBA color3 = Zenith.getInstance().getThemeManager().getClientColor(180).withAlpha(200);
ColorRGBA color4 = Zenith.getInstance().getThemeManager().getClientColor(270).withAlpha(200);
DrawUtil.drawImageAlpha(matrices, TRIANGLE_TEXTURE, -8, -9, 18, 18, color1, color2, color3, color4);
}
}
}
method drawAlphaImage (ctrl+v in DrawUtil):
public static void drawImageAlpha(MatrixStack matrices, Identifier identifier, float x, float y, float width, float height, ColorRGBA color1, ColorRGBA color2, ColorRGBA color3, ColorRGBA color4) {
matrices.push();
Matrix4f matrix4f = matrices.peek().getPositionMatrix();
RenderSystem.enableBlend();
RenderSystem.defaultBlendFunc();
RenderSystem.setShader(ShaderProgramKeys.POSITION_TEX_COLOR);
RenderSystem.setShaderTexture(0, identifier);
drawSetup();
BufferBuilder builder = RenderSystem.renderThreadTesselator().begin(VertexFormat.DrawMode.QUADS, VertexFormats.POSITION_TEXTURE_COLOR);
builder.vertex(matrix4f, x, y, 0.0F).texture(0.0F, 0.0F).color(color1.getRGB());
builder.vertex(matrix4f, x, y + height, 0.0F).texture(0.0F, 1.0F).color(color2.getRGB());
builder.vertex(matrix4f, x + width, y + height, 0.0F).texture(1.0F, 1.0F).color(color3.getRGB());
builder.vertex(matrix4f, x + width, y, 0.0F).texture(1.0F, 0.0F).color(color4.getRGB());
BufferRenderer.drawWithGlobalProgram(builder.end());
drawEnd();
RenderSystem.setShaderTexture(0, 0);
matrices.pop();
}
Пожалуйста, авторизуйтесь для просмотра ссылки.
(click)если еще что то нужно, просите! :)
Последнее редактирование: