Начинающий
- Статус
- Оффлайн
- Регистрация
- 9 Авг 2024
- Сообщения
- 10
- Реакции
- 0
- Выберите загрузчик игры
- Fabric
Java:
package tech.javelin.client.modules.impl.misc;
import com.darkmagician6.eventapi.EventTarget;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;
import net.minecraft.client.util.math.MatrixStack;
import net.minecraft.util.Identifier;
import net.minecraft.util.math.MathHelper;
import net.minecraft.util.math.RotationAxis;
import net.minecraft.util.math.Vec3d;
import tech.javelin.Javelin;
import tech.javelin.base.events.impl.player.EventUpdate;
import tech.javelin.base.events.impl.render.EventRender2D;
import tech.javelin.base.font.Fonts;
import tech.javelin.client.modules.api.Category;
import tech.javelin.client.modules.api.Module;
import tech.javelin.client.modules.api.ModuleAnnotation;
import tech.javelin.client.modules.api.setting.impl.BooleanSetting;
import tech.javelin.client.modules.api.setting.impl.NumberSetting;
import tech.javelin.utility.render.display.base.color.ColorRGBA;
@ModuleAnnotation(
name = "LootChristmas",
description = "GPS для подарков",
category = Category.MISC
)
public class LootChristmas extends Module {
public static final Module INSTANCE = new LootChristmas();
private final List<Vec3d> points = new ArrayList<>(Arrays.asList(
new Vec3d(-1, 62, 17),
new Vec3d(-1, 45, 97),
new Vec3d(42, 61, 7),
new Vec3d(7, 58, 160),
new Vec3d(100, 55, 55),
new Vec3d(-1, 43, -105),
new Vec3d(8, 60, -67),
new Vec3d(-4, 141, 87),
new Vec3d(-1, 189, 97),
new Vec3d(-1, 77, 145),
new Vec3d(-75, 65, 73),
new Vec3d(-102, 100, -18),
new Vec3d(82, 29, 100),
new Vec3d(-100, 91, 33),
new Vec3d(-48, 84, -11),
new Vec3d(-1, 180, -75),
new Vec3d(-1, 125, -49),
new Vec3d(-1, 87, 60),
new Vec3d(-45, 46, 206),
new Vec3d(-108, 50, 38),
new Vec3d(170, 48, -12),
new Vec3d(-6, 78, 99),
new Vec3d(136, 45, 142),
new Vec3d(-90, 142, 204),
new Vec3d(-45, 111, 23),
new Vec3d(113, 53, -1),
new Vec3d(1, 45, -149),
new Vec3d(53, 60, -75),
new Vec3d(6, 12, 147),
new Vec3d(79, 17, 64),
new Vec3d(-137, 156, 180)
));
private final NumberSetting index = new NumberSetting("Подарок №", 1, 1, 31, 1);
private final BooleanSetting next = new BooleanSetting("Следующий подарок", false);
private final BooleanSetting prev = new BooleanSetting("Предыдущий подарок", false);
public LootChristmas() {
}
@EventTarget
public void onUpdate(EventUpdate event) {
if (next.isEnabled()) {
float nextVal = index.getCurrent() + 1;
if (nextVal > points.size()) nextVal = 1;
index.setCurrent(nextVal);
next.setEnabled(false);
}
if (prev.isEnabled()) {
float prevVal = index.getCurrent() - 1;
if (prevVal < 1) prevVal = points.size();
index.setCurrent(prevVal);
prev.setEnabled(false);
}
}
@EventTarget
public void onRender2D(EventRender2D event) {
if (mc.player == null || mc.world == null || mc.gameRenderer == null || mc.gameRenderer.getCamera() == null) return;
Vec3d targetPos = points.get((int) index.getCurrent() - 1);
double[] pos = calculateScreenPosition(targetPos);
drawArrow(event, pos[0], pos[1], pos[2], targetPos);
}
private double[] calculateScreenPosition(Vec3d target) {
Vec3d cameraPos = mc.gameRenderer.getCamera().getPos();
double x = target.x - cameraPos.x;
double z = target.z - cameraPos.z;
float yawRadians = (float) Math.toRadians(mc.gameRenderer.getCamera().getYaw());
double cos = MathHelper.cos(yawRadians);
double sin = MathHelper.sin(yawRadians);
double rotY = -(z * cos - x * sin);
double rotX = -(x * cos + z * sin);
float angle = (float) Math.toDegrees(Math.atan2(rotY, rotX));
float radius = 80;
double x2 = radius * MathHelper.cos((float) Math.toRadians(angle)) + mc.getWindow().getScaledWidth() / 2.0f;
double y2 = radius * MathHelper.sin((float) Math.toRadians(angle)) + mc.getWindow().getScaledHeight() / 2.0f;
return new double[]{x2, y2, angle};
}
private void drawArrow(EventRender2D event, double x, double y, double angle, Vec3d targetPos) {
MatrixStack ms = event.getContext().getMatrices();
ms.push();
ms.translate((float) x, (float) y, 0);
ms.multiply(RotationAxis.POSITIVE_Z.rotationDegrees((float) (angle + 90.0f)));
ms.translate(-(float) x, -(float) y, 0);
float size = 12.0f;
ColorRGBA color = Javelin.getInstance().getThemeManager().getCurrentTheme().getColor();
Identifier arrowTexture = Javelin.id("icons/arrow.png");
event.getContext().drawTexture(arrowTexture, (float) x - size / 2.0f, (float) y - 7.0f, size, 14.0f, color);
ms.pop();
double distance = mc.player.getPos().distanceTo(targetPos);
String distText = String.format("%.1f m", distance);
double yDiff = targetPos.y - mc.player.getY();
String heightAdvice = "";
if (Math.abs(yDiff) > 2.0) {
heightAdvice = yDiff > 0 ? " (§aВВЕРХ§f)" : " (§cВНИЗ§f)";
}
String fullText = distText + heightAdvice;
float textX = (float) x;
float textY = (float) y + 15;
float textWidth = Fonts.REGULAR.getWidth(fullText, 12.0f);
event.getContext().drawText(Fonts.REGULAR.getFont(12.0f), fullText, textX - textWidth / 2.0f, textY, ColorRGBA.WHITE);
}
}
Пожалуйста, авторизуйтесь для просмотра ссылки.
(no ad)Эта функция для лута подарков на сервере CakeWorld и она подходит под сервер ReallyWorld.
Чтобы она работала в вашем чите просто поменяйте путь к вашей стрелке из .gps
Вот и все не судите строго моя первая тема.