-
Автор темы
- #1
Перед прочтением основного контента ниже, пожалуйста, обратите внимание на обновление внутри секции Майна на нашем форуме. У нас появились:
- бесплатные читы для Майнкрафт — любое использование на свой страх и риск;
- маркетплейс Майнкрафт — абсолютно любая коммерция, связанная с игрой, за исключением продажи читов (аккаунты, предоставления услуг, поиск кодеров читов и так далее);
- приватные читы для Minecraft — в этом разделе только платные хаки для игры, покупайте группу "Продавец" и выставляйте на продажу свой софт;
- обсуждения и гайды — всё тот же раздел с вопросами, но теперь модернизированный: поиск нужных хаков, пати с игроками-читерами и другая полезная информация.
Спасибо!
не рендерятся партиклы (должны быть при движении игрока)
вот код
@FunctionRegister(name = "EntityTrails", type = Category.Render)
public class EntityTrails extends Function {
private SliderSetting maxPoints = new SliderSetting("Сила", 200, 100, 200, 10);
private Object e;
public EntityTrails() {
this.addSettings(maxPoints);
}
CopyOnWriteArrayList<EntityTrails.Point> points = new CopyOnWriteArrayList<>();
@Subscribe
public void onUpdate(final Event event) {
if (IMinecraft.mc.world == null || IMinecraft.mc.player == null) return;
if (e instanceof EventMotion) {
Vector3d previousPos = new Vector3d(IMinecraft.mc.player.prevPosX, IMinecraft.mc.player.prevPosY, IMinecraft.mc.player.prevPosZ);
Vector3d currentPos = new Vector3d(IMinecraft.mc.player.getPosX(), IMinecraft.mc.player.getPosY(), IMinecraft.mc.player.getPosZ());
if (!previousPos.equals(currentPos)) {
if (IMinecraft.mc.player.ticksExisted % 6 == 0) {
createPoints(currentPos);
}
}
}
if (event instanceof EventRender e) {
if (points.size() > maxPoints.getValue().floatValue()) {
points.remove(0);
}
for (EntityTrails.Point point : points) {
long alive = (System.currentTimeMillis() - point.createdTime);
if (alive > point.aliveTime || !IMinecraft.mc.player.canVectorBeSeenFixed(point.position)) {
points.remove(point);
continue;
}
Vector2f pos = ProjectionUtil.project(point.position.x, point.position.y, point.position.z);
if (pos != null) {
point.update();
DisplayUtils.drawImage(new ResourceLocation("expensive/images/star.png"), (float) pos.x, (float) pos.y, 20, 20, ColorUtils.getColor(points.indexOf(point)));
}
}
}
}
private void createPoints(Vector3d position) {
int numberOfStars = 20; // колво
for (int i = 0; i < numberOfStars; i++) {
Vector3d randomizedPosition = new Vector3d(
position.x + MathUtil.randomizeFloat(-0.5f, 0.5f),
position.y + MathUtil.randomizeFloat(0.0f, 2.0f),
position.z + MathUtil.randomizeFloat(-0.5f, 0.5f)
);
points.add(new Point(randomizedPosition));
}
}
public final class Point {
public Vector3d position;
public Vector3d motion;
public Vector3d animatedMotion;
public long aliveTime;
public float size;
public long createdTime = System.currentTimeMillis();
public Point(Vector3d position) {
this.position = new Vector3d(position.x, position.y, position.z);
this.motion = new Vector3d(MathUtil.randomizeFloat(0.0f, 0.0f), 0, MathUtil.randomizeFloat(0.0f, 0.0f));
this.animatedMotion = new Vector3d(0, 0, 0);
size = MathUtil.randomizeFloat(3, 7);
aliveTime = ThreadLocalRandom.current().nextLong(1000, 3000);
}
public void update() {
if (isGround()) {
points.remove(points);
} else {
motion.y = MathUtil.randomizeFloat(-0.01f, 0.01f);
motion.y *= 1;
motion.x *= 1.001;
motion.z *= 1.001;
}
animatedMotion.x = AnimationMath.fast((float) animatedMotion.x, (float) (motion.x), 1);
animatedMotion.y = AnimationMath.fast((float) animatedMotion.y, (float) (motion.y), 1);
animatedMotion.z = AnimationMath.fast((float) animatedMotion.z, (float) (motion.z), 1);
position = position.add(animatedMotion);
}
boolean isGround() {
Vector3d position = this.position.add(animatedMotion);
AxisAlignedBB bb = new AxisAlignedBB(position.x - 0.1, position.y - 0.3, position.z - 0.1, position.x + 0.1, position.y + 0.3, position.z + 0.1);
return WorldUtils.TotemUtil.getSphere(new BlockPos(position), 1, 2, false, true, 0)
.stream()
.anyMatch(blockPos -> !IMinecraft.mc.world.getBlockState(blockPos).isAir() &&
bb.intersects(new AxisAlignedBB(blockPos)) &&
AxisAlignedBB.calcSideHit(new AxisAlignedBB(blockPos.add(0, 0, 0)), position, new double[]{
2D
}, null, 0.1f, 0.1f, 0.1f) == Direction.UP);
}
}
}
вот код
@FunctionRegister(name = "EntityTrails", type = Category.Render)
public class EntityTrails extends Function {
private SliderSetting maxPoints = new SliderSetting("Сила", 200, 100, 200, 10);
private Object e;
public EntityTrails() {
this.addSettings(maxPoints);
}
CopyOnWriteArrayList<EntityTrails.Point> points = new CopyOnWriteArrayList<>();
@Subscribe
public void onUpdate(final Event event) {
if (IMinecraft.mc.world == null || IMinecraft.mc.player == null) return;
if (e instanceof EventMotion) {
Vector3d previousPos = new Vector3d(IMinecraft.mc.player.prevPosX, IMinecraft.mc.player.prevPosY, IMinecraft.mc.player.prevPosZ);
Vector3d currentPos = new Vector3d(IMinecraft.mc.player.getPosX(), IMinecraft.mc.player.getPosY(), IMinecraft.mc.player.getPosZ());
if (!previousPos.equals(currentPos)) {
if (IMinecraft.mc.player.ticksExisted % 6 == 0) {
createPoints(currentPos);
}
}
}
if (event instanceof EventRender e) {
if (points.size() > maxPoints.getValue().floatValue()) {
points.remove(0);
}
for (EntityTrails.Point point : points) {
long alive = (System.currentTimeMillis() - point.createdTime);
if (alive > point.aliveTime || !IMinecraft.mc.player.canVectorBeSeenFixed(point.position)) {
points.remove(point);
continue;
}
Vector2f pos = ProjectionUtil.project(point.position.x, point.position.y, point.position.z);
if (pos != null) {
point.update();
DisplayUtils.drawImage(new ResourceLocation("expensive/images/star.png"), (float) pos.x, (float) pos.y, 20, 20, ColorUtils.getColor(points.indexOf(point)));
}
}
}
}
private void createPoints(Vector3d position) {
int numberOfStars = 20; // колво
for (int i = 0; i < numberOfStars; i++) {
Vector3d randomizedPosition = new Vector3d(
position.x + MathUtil.randomizeFloat(-0.5f, 0.5f),
position.y + MathUtil.randomizeFloat(0.0f, 2.0f),
position.z + MathUtil.randomizeFloat(-0.5f, 0.5f)
);
points.add(new Point(randomizedPosition));
}
}
public final class Point {
public Vector3d position;
public Vector3d motion;
public Vector3d animatedMotion;
public long aliveTime;
public float size;
public long createdTime = System.currentTimeMillis();
public Point(Vector3d position) {
this.position = new Vector3d(position.x, position.y, position.z);
this.motion = new Vector3d(MathUtil.randomizeFloat(0.0f, 0.0f), 0, MathUtil.randomizeFloat(0.0f, 0.0f));
this.animatedMotion = new Vector3d(0, 0, 0);
size = MathUtil.randomizeFloat(3, 7);
aliveTime = ThreadLocalRandom.current().nextLong(1000, 3000);
}
public void update() {
if (isGround()) {
points.remove(points);
} else {
motion.y = MathUtil.randomizeFloat(-0.01f, 0.01f);
motion.y *= 1;
motion.x *= 1.001;
motion.z *= 1.001;
}
animatedMotion.x = AnimationMath.fast((float) animatedMotion.x, (float) (motion.x), 1);
animatedMotion.y = AnimationMath.fast((float) animatedMotion.y, (float) (motion.y), 1);
animatedMotion.z = AnimationMath.fast((float) animatedMotion.z, (float) (motion.z), 1);
position = position.add(animatedMotion);
}
boolean isGround() {
Vector3d position = this.position.add(animatedMotion);
AxisAlignedBB bb = new AxisAlignedBB(position.x - 0.1, position.y - 0.3, position.z - 0.1, position.x + 0.1, position.y + 0.3, position.z + 0.1);
return WorldUtils.TotemUtil.getSphere(new BlockPos(position), 1, 2, false, true, 0)
.stream()
.anyMatch(blockPos -> !IMinecraft.mc.world.getBlockState(blockPos).isAir() &&
bb.intersects(new AxisAlignedBB(blockPos)) &&
AxisAlignedBB.calcSideHit(new AxisAlignedBB(blockPos.add(0, 0, 0)), position, new double[]{
2D
}, null, 0.1f, 0.1f, 0.1f) == Direction.UP);
}
}
}