Начинающий
Начинающий
- Статус
- Оффлайн
- Регистрация
- 2 Июн 2021
- Сообщения
- 13
- Реакции
- 0
- Выберите загрузчик игры
- Прочие моды
всем привет, сделал круглый прицел, на юг видел мало, поэтому заливаю
я надеюсь тутор никому не нужен, но для вялых огурцов вот:
1. копируем код ниже
2. ищем java class "Crosshair"
3. вставляем код
4. меняем импорты Ctrl+R
5. заходим в игру и тестим
сс ниже(ес че это просто все цвета которые у меня в темах)
я надеюсь тутор никому не нужен, но для вялых огурцов вот:
1. копируем код ниже
2. ищем java class "Crosshair"
3. вставляем код
4. меняем импорты Ctrl+R
5. заходим в игру и тестим
сс ниже(ес че это просто все цвета которые у меня в темах)
Crosshair.java:
package swag.recode.functions.impl.render;
// code by swagrecode yougame.biz
import com.google.common.eventbus.Subscribe;
import swag.recode.events.EventDisplay;
import swag.recode.functions.api.Category;
import swag.recode.functions.api.Function;
import swag.recode.functions.api.FunctionRegister;
import swag.recode.functions.settings.Setting;
import swag.recode.functions.settings.impl.BooleanSetting;
import swag.recode.functions.settings.impl.ModeSetting;
import swag.recode.functions.settings.impl.SliderSetting;
import swag.recode.utils.math.MathUtil;
import swag.recode.utils.render.ColorUtils;
import swag.recode.utils.render.DisplayUtils;
import net.minecraft.client.settings.PointOfView;
import net.minecraft.util.math.RayTraceResult.Type;
import java.awt.*;
@FunctionRegister(name = "Crosshair", type = Category.Render)
public class Crosshair extends Function {
private final ModeSetting mode = new ModeSetting("Вид", "Кругляш", "Кругляш", "Орбиз", "Класический");
private final SliderSetting radius = new SliderSetting("Радиус", 3f, 3f, 6f, 0.1f);
private final BooleanSetting staticCrosshair = new BooleanSetting("Статический", true);
/*private float lastYaw;
private float lastPitch;
private float animatedYaw;
private float animatedPitch;
private float animation;
private float animationSize;
private final int outlineColor = Color.BLACK.getRGB();
private final int entityColor = Color.RED.getRGB();*/
private float lastYaw;
private float lastPitch;
private float animatedYaw;
private float animatedPitch;
private float animation;
private float animationSize;
private final int outlineColor;
private final int entityColor;
public Crosshair() {
//addSettings(mode, staticCrosshair);
this.outlineColor = Color.BLACK.getRGB();
this.entityColor = Color.RED.getRGB();
this.addSettings(new Setting[]{this.mode, this.staticCrosshair, this.radius});
}
@Subscribe
public void onDisplay(EventDisplay e) {
if (mc.player == null || mc.world == null || e.getType() != EventDisplay.Type.POST) {
return;
}
float x = mc.getMainWindow().getScaledWidth() / 2f;
float y = mc.getMainWindow().getScaledHeight() / 2f;
float padding = 5.0F;
float cooldown;
float length;
switch (mode.getIndex()) {
case 0 -> {
//this.addSettings(new Setting[]{this.radius});
cooldown = 5.0F;
int color = ColorUtils.interpolate(HUD.getColor(1), HUD.getColor(1), 1.0F - this.animation);
if (!(Boolean) this.staticCrosshair.get()) {
x += this.animatedYaw;
y += this.animatedPitch;
}
this.animationSize = MathUtil.fast(this.animationSize, (1.0F - mc.player.getCooledAttackStrength(1.0F)) * 260.0F, 10.0F);
length = 3.0F + ((Boolean) this.staticCrosshair.get() ? 0.0F : this.animationSize);
if (mc.gameSettings.getPointOfView() == PointOfView.FIRST_PERSON) {
DisplayUtils.drawCircle2(x, y, 0.0F, 360.0F, radius.get(), 3.0F, false, ColorUtils.getColor(90));
}
}
case 1 -> {
float size = 5;
animatedYaw = MathUtil.fast(animatedYaw,
((lastYaw - mc.player.rotationYaw) + mc.player.moveStrafing) * size,
5);
animatedPitch = MathUtil.fast(animatedPitch,
((lastPitch - mc.player.rotationPitch) + mc.player.moveForward) * size, 5);
animation = MathUtil.fast(animation, mc.objectMouseOver.getType() == Type.ENTITY ? 1 : 0, 5);
int color = ColorUtils.interpolate(HUD.getColor(1), HUD.getColor(1), 1 - animation);
if (!staticCrosshair.get()) {
x += animatedYaw;
y += animatedPitch;
}
animationSize = MathUtil.fast(animationSize, (1 - mc.player.getCooledAttackStrength(1)) * 3, 10);
float radius = 3 + (staticCrosshair.get() ? 0 : animationSize);
if (mc.gameSettings.getPointOfView() == PointOfView.FIRST_PERSON) {
DisplayUtils.drawShadowCircle(x, y, radius * 2, ColorUtils.setAlpha(color, 64));
DisplayUtils.drawCircle(x, y, radius, color);
}
lastYaw = mc.player.rotationYaw;
lastPitch = mc.player.rotationPitch;
}
case 2 -> {
if (mc.gameSettings.getPointOfView() != PointOfView.FIRST_PERSON) return;
cooldown = 1 - mc.player.getCooledAttackStrength(0);
float thickness = 1;
/*float */length = 3;
float gap = 2 + 8 * cooldown;
int color = mc.pointedEntity != null ? entityColor : -1;
drawOutlined(x - thickness / 2, y - gap - length, thickness, length, color);
drawOutlined(x - thickness / 2, y + gap, thickness, length, color);
drawOutlined(x - gap - length, y - thickness / 2, length, thickness, color);
drawOutlined(x + gap, y - thickness / 2, length, thickness, color);
}
}
}
private void drawOutlined(
final float x,
final float y,
final float w,
final float h,
final int hex
) {
DisplayUtils.drawRectW(x - 0.5, y - 0.5, w + 1, h + 1, outlineColor);
DisplayUtils.drawRectW(x, y, w, h, hex);
}
}