захотел взять аровсы отсюда https://yougame.biz/threads/349215/ (no ad), ошибки с
FriendStorage
DisplayUtils
ColorUtils
Theme
import im.expensive.utils.render.color.ColorUtils;
import im.expensive.utils.render.rect.DisplayUtils;
import im.expensive.commandstorage.FriendStorage; хелп
у чат гпт попросил он высрал это
package im.expensive.functions.impl.render;
import com.google.common.eventbus.Subscribe;
import com.mojang.blaze3d.platform.GlStateManager;
import im.expensive.command.friends.FriendStorage;
import im.expensive.events.EventDisplay;
import im.expensive.functions.api.Category;
import im.expensive.functions.api.Function;
import im.expensive.functions.api.FunctionRegister;
import im.expensive.utils.math.MathUtil;
import im.expensive.functions.settings.impl.ModeSetting;
import im.expensive.utils.math.Vector4i;
import net.minecraft.util.ResourceLocation;
import im.expensive.functions.impl.render.HUD;
import im.expensive.utils.player.MoveUtils;
import im.expensive.utils.player.PlayerUtils;
import im.expensive.utils.render.ColorUtils;
import im.expensive.utils.render.DisplayUtils;
import net.minecraft.client.entity.player.AbstractClientPlayerEntity;
import net.minecraft.client.gui.screen.inventory.InventoryScreen;
import net.minecraft.client.settings.PointOfView;
import net.minecraft.util.math.MathHelper;
import org.lwjgl.opengl.GL11;
import java.awt.*;
@FunctionRegister(name = "Pointers", type = Category.Render, description = "Показывает стрелки к игрокам на экране. Белые стрелки для врагов, зеленые для друзей.")
public class Pointers extends Function {
public float animationStep;
private final ModeSetting design = new ModeSetting("Дизайн стрелки", "Client", "Client", "Celestial", "Nursultan");
private static final ResourceLocation ARROWS_TEX = new ResourceLocation("expensive/images/arrows/arrows.png");
private float lastYaw;
private float lastPitch;
private float animatedYaw;
private float animatedPitch;
public Pointers() {
addSettings(design);
}
@Subscribe
public void onDisplay(EventDisplay e) {
if (mc.player == null || mc.world == null || e.getType() != EventDisplay.Type.PRE) {
return;
}
animatedYaw = MathUtil.fast(animatedYaw, (mc.player.moveStrafing) * 10,
5);
animatedPitch = MathUtil.fast(animatedPitch,
(mc.player.moveForward) * 10, 5);
float size = 70;
if (mc.currentScreen instanceof InventoryScreen) {
size += 80;
}
if (MoveUtils.isMoving()) {
size += 10;
}
animationStep = MathUtil.fast(animationStep, size, 6);
if (mc.gameSettings.getPointOfView() == PointOfView.FIRST_PERSON) {
for (AbstractClientPlayerEntity player : mc.world.getPlayers()) {
if (!PlayerUtils.isNameValid(player.getNameClear()) || mc.player == player)
continue;
double x = player.lastTickPosX + (player.getPosX() - player.lastTickPosX) * mc.getRenderPartialTicks()
- mc.getRenderManager().info.getProjectedView().getX();
double z = player.lastTickPosZ + (player.getPosZ() - player.lastTickPosZ) * mc.getRenderPartialTicks()
- mc.getRenderManager().info.getProjectedView().getZ();
double cos = MathHelper.cos((float) (mc.getRenderManager().info.getYaw() * (Math.PI * 2 / 360)));
double sin = MathHelper.sin((float) (mc.getRenderManager().info.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)) + window.getScaledWidth() / 2f;
double y2 = animationStep * MathHelper.sin((float) Math.toRadians(angle)) + window.getScaledHeight() / 2f;
x2 += animatedYaw;
y2 += animatedPitch;
GlStateManager.pushMatrix();
GlStateManager.disableBlend();
GlStateManager.translated(x2, y2, 0);
GlStateManager.rotatef(angle, 0, 0, 1);
// Choose rendering style
if (design.is("Nursultan")) {
// gradient textured arrow (from thread reference)
DisplayUtils.drawImageAlpha(
ARROWS_TEX,
-8.0F,
-9.0F,
18,
18,
new Vector4i(
ColorUtils.setAlpha(HUD.getColor(0, 1.0F), 125),
ColorUtils.setAlpha(HUD.getColor(90, 1.0F), 125),
ColorUtils.setAlpha(HUD.getColor(180, 1.0F), 125),
ColorUtils.setAlpha(HUD.getColor(270, 1.0F), 125)
)
);
} else {
// White arrows for enemies, green for friends
Color arrowColor = FriendStorage.isFriend(player.getGameProfile().getName()) ?
new Color(0, 255, 0, 255) :
new Color(255, 255, 255, 255);
// Draw shadow circle
DisplayUtils.drawShadowCircle(1, 0, 12, ColorUtils.setAlpha(arrowColor.getRGB(), 64));
// Draw arrow with better visibility
drawTriangle(-5, -1F, 5F, 8F, new Color(0, 0, 0, 64));
drawTriangle(-4F, 0F, 4F, 6F, arrowColor);
}
GlStateManager.enableBlend();
GlStateManager.popMatrix();
}
}
lastYaw = mc.player.rotationYaw;
lastPitch = mc.player.rotationPitch;
}
public static void drawTriangle(float x, float y, float width, float height, Color color) {
GL11.glPushMatrix();
GL11.glDisable(GL11.GL_TEXTURE_2D);
enableSmoothLine(1);
GL11.glRotatef(180 + 90, 0F, 0F, 1.0F);
// fill.
GL11.glBegin(9);
ColorUtils.setColor(color.getRGB());
GL11.glVertex2f(x, y - 2);
GL11.glVertex2f(x + width, y + height);
GL11.glVertex2f(x + width, y);
GL11.glVertex2f(x, y - 2);
GL11.glEnd();
GL11.glBegin(9);
ColorUtils.setColor(color.brighter().getRGB());
GL11.glVertex2f(x + width, y);
GL11.glVertex2f(x + width, y + height);
GL11.glVertex2f(x + width * 2, y - 2);
GL11.glVertex2f(x + width, y);
GL11.glEnd();
// line.
GL11.glBegin(3);
ColorUtils.setColor(color.getRGB());
GL11.glVertex2f(x, y - 2);
GL11.glVertex2f(x + width, y + height);
GL11.glVertex2f(x + width, y);
GL11.glVertex2f(x, y - 2);
GL11.glEnd();
GL11.glBegin(3);
ColorUtils.setColor(color.brighter().getRGB());
GL11.glVertex2f(x + width, y);
GL11.glVertex2f(x + width, y + height);
GL11.glVertex2f(x + width * 2, y - 2);
GL11.glVertex2f(x + width, y);
GL11.glEnd();
disableSmoothLine();
GL11.glEnable(GL11.GL_TEXTURE_2D);
GL11.glRotatef(-180 - 90, 0F, 0F, 1.0F);
GL11.glPopMatrix();
}
private static void enableSmoothLine(float width) {
GL11.glDisable(GL11.GL_ALPHA_TEST);
GL11.glEnable(GL11.GL_BLEND);
GL11.glBlendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA);
GL11.glDepthMask(false);
GL11.glEnable(GL11.GL_LINE_SMOOTH);
GL11.glHint(GL11.GL_LINE_SMOOTH_HINT, GL11.GL_NICEST);
GL11.glLineWidth(width);
}
private static void disableSmoothLine() {
GL11.glEnable(GL11.GL_ALPHA_TEST);
GL11.glDepthMask(true);
GL11.glDisable(GL11.GL_LINE_SMOOTH);
GL11.glHint(GL11.GL_LINE_SMOOTH_HINT, GL11.GL_NICEST);
}
}
ошибок нет, только варнинги, но вместо арровсов фиоло-черные квадратики, хотя фотки добавлял
FriendStorage
DisplayUtils
ColorUtils
Theme
import im.expensive.utils.render.color.ColorUtils;
import im.expensive.utils.render.rect.DisplayUtils;
import im.expensive.commandstorage.FriendStorage; хелп
у чат гпт попросил он высрал это
package im.expensive.functions.impl.render;
import com.google.common.eventbus.Subscribe;
import com.mojang.blaze3d.platform.GlStateManager;
import im.expensive.command.friends.FriendStorage;
import im.expensive.events.EventDisplay;
import im.expensive.functions.api.Category;
import im.expensive.functions.api.Function;
import im.expensive.functions.api.FunctionRegister;
import im.expensive.utils.math.MathUtil;
import im.expensive.functions.settings.impl.ModeSetting;
import im.expensive.utils.math.Vector4i;
import net.minecraft.util.ResourceLocation;
import im.expensive.functions.impl.render.HUD;
import im.expensive.utils.player.MoveUtils;
import im.expensive.utils.player.PlayerUtils;
import im.expensive.utils.render.ColorUtils;
import im.expensive.utils.render.DisplayUtils;
import net.minecraft.client.entity.player.AbstractClientPlayerEntity;
import net.minecraft.client.gui.screen.inventory.InventoryScreen;
import net.minecraft.client.settings.PointOfView;
import net.minecraft.util.math.MathHelper;
import org.lwjgl.opengl.GL11;
import java.awt.*;
@FunctionRegister(name = "Pointers", type = Category.Render, description = "Показывает стрелки к игрокам на экране. Белые стрелки для врагов, зеленые для друзей.")
public class Pointers extends Function {
public float animationStep;
private final ModeSetting design = new ModeSetting("Дизайн стрелки", "Client", "Client", "Celestial", "Nursultan");
private static final ResourceLocation ARROWS_TEX = new ResourceLocation("expensive/images/arrows/arrows.png");
private float lastYaw;
private float lastPitch;
private float animatedYaw;
private float animatedPitch;
public Pointers() {
addSettings(design);
}
@Subscribe
public void onDisplay(EventDisplay e) {
if (mc.player == null || mc.world == null || e.getType() != EventDisplay.Type.PRE) {
return;
}
animatedYaw = MathUtil.fast(animatedYaw, (mc.player.moveStrafing) * 10,
5);
animatedPitch = MathUtil.fast(animatedPitch,
(mc.player.moveForward) * 10, 5);
float size = 70;
if (mc.currentScreen instanceof InventoryScreen) {
size += 80;
}
if (MoveUtils.isMoving()) {
size += 10;
}
animationStep = MathUtil.fast(animationStep, size, 6);
if (mc.gameSettings.getPointOfView() == PointOfView.FIRST_PERSON) {
for (AbstractClientPlayerEntity player : mc.world.getPlayers()) {
if (!PlayerUtils.isNameValid(player.getNameClear()) || mc.player == player)
continue;
double x = player.lastTickPosX + (player.getPosX() - player.lastTickPosX) * mc.getRenderPartialTicks()
- mc.getRenderManager().info.getProjectedView().getX();
double z = player.lastTickPosZ + (player.getPosZ() - player.lastTickPosZ) * mc.getRenderPartialTicks()
- mc.getRenderManager().info.getProjectedView().getZ();
double cos = MathHelper.cos((float) (mc.getRenderManager().info.getYaw() * (Math.PI * 2 / 360)));
double sin = MathHelper.sin((float) (mc.getRenderManager().info.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)) + window.getScaledWidth() / 2f;
double y2 = animationStep * MathHelper.sin((float) Math.toRadians(angle)) + window.getScaledHeight() / 2f;
x2 += animatedYaw;
y2 += animatedPitch;
GlStateManager.pushMatrix();
GlStateManager.disableBlend();
GlStateManager.translated(x2, y2, 0);
GlStateManager.rotatef(angle, 0, 0, 1);
// Choose rendering style
if (design.is("Nursultan")) {
// gradient textured arrow (from thread reference)
DisplayUtils.drawImageAlpha(
ARROWS_TEX,
-8.0F,
-9.0F,
18,
18,
new Vector4i(
ColorUtils.setAlpha(HUD.getColor(0, 1.0F), 125),
ColorUtils.setAlpha(HUD.getColor(90, 1.0F), 125),
ColorUtils.setAlpha(HUD.getColor(180, 1.0F), 125),
ColorUtils.setAlpha(HUD.getColor(270, 1.0F), 125)
)
);
} else {
// White arrows for enemies, green for friends
Color arrowColor = FriendStorage.isFriend(player.getGameProfile().getName()) ?
new Color(0, 255, 0, 255) :
new Color(255, 255, 255, 255);
// Draw shadow circle
DisplayUtils.drawShadowCircle(1, 0, 12, ColorUtils.setAlpha(arrowColor.getRGB(), 64));
// Draw arrow with better visibility
drawTriangle(-5, -1F, 5F, 8F, new Color(0, 0, 0, 64));
drawTriangle(-4F, 0F, 4F, 6F, arrowColor);
}
GlStateManager.enableBlend();
GlStateManager.popMatrix();
}
}
lastYaw = mc.player.rotationYaw;
lastPitch = mc.player.rotationPitch;
}
public static void drawTriangle(float x, float y, float width, float height, Color color) {
GL11.glPushMatrix();
GL11.glDisable(GL11.GL_TEXTURE_2D);
enableSmoothLine(1);
GL11.glRotatef(180 + 90, 0F, 0F, 1.0F);
// fill.
GL11.glBegin(9);
ColorUtils.setColor(color.getRGB());
GL11.glVertex2f(x, y - 2);
GL11.glVertex2f(x + width, y + height);
GL11.glVertex2f(x + width, y);
GL11.glVertex2f(x, y - 2);
GL11.glEnd();
GL11.glBegin(9);
ColorUtils.setColor(color.brighter().getRGB());
GL11.glVertex2f(x + width, y);
GL11.glVertex2f(x + width, y + height);
GL11.glVertex2f(x + width * 2, y - 2);
GL11.glVertex2f(x + width, y);
GL11.glEnd();
// line.
GL11.glBegin(3);
ColorUtils.setColor(color.getRGB());
GL11.glVertex2f(x, y - 2);
GL11.glVertex2f(x + width, y + height);
GL11.glVertex2f(x + width, y);
GL11.glVertex2f(x, y - 2);
GL11.glEnd();
GL11.glBegin(3);
ColorUtils.setColor(color.brighter().getRGB());
GL11.glVertex2f(x + width, y);
GL11.glVertex2f(x + width, y + height);
GL11.glVertex2f(x + width * 2, y - 2);
GL11.glVertex2f(x + width, y);
GL11.glEnd();
disableSmoothLine();
GL11.glEnable(GL11.GL_TEXTURE_2D);
GL11.glRotatef(-180 - 90, 0F, 0F, 1.0F);
GL11.glPopMatrix();
}
private static void enableSmoothLine(float width) {
GL11.glDisable(GL11.GL_ALPHA_TEST);
GL11.glEnable(GL11.GL_BLEND);
GL11.glBlendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA);
GL11.glDepthMask(false);
GL11.glEnable(GL11.GL_LINE_SMOOTH);
GL11.glHint(GL11.GL_LINE_SMOOTH_HINT, GL11.GL_NICEST);
GL11.glLineWidth(width);
}
private static void disableSmoothLine() {
GL11.glEnable(GL11.GL_ALPHA_TEST);
GL11.glDepthMask(true);
GL11.glDisable(GL11.GL_LINE_SMOOTH);
GL11.glHint(GL11.GL_LINE_SMOOTH_HINT, GL11.GL_NICEST);
}
}
ошибок нет, только варнинги, но вместо арровсов фиоло-черные квадратики, хотя фотки добавлял