Исходник Партиклы expensive 2.0 ready

Начинающий
Статус
Оффлайн
Регистрация
26 Янв 2024
Сообщения
70
Реакции[?]
1
Поинты[?]
1K
Партиклы для expensive 2.0 с импортами, да код не идеальный, я начинающий так что пж не бейте палками
Пожалуйста, авторизуйтесь для просмотра ссылки.

Пожалуйста, авторизуйтесь для просмотра ссылки.

Пожалуйста, авторизуйтесь для просмотра ссылки.


Java:
import net.minecraft.util.Direction;
import net.minecraft.util.ResourceLocation;
import net.minecraft.util.math.AxisAlignedBB;
import net.minecraft.util.math.BlockPos;
import net.minecraft.util.math.vector.Vector3d;
import org.joml.Vector2d;
import wtf.expensive.events.Event;
import wtf.expensive.events.impl.player.EventMotion;
import wtf.expensive.events.impl.render.EventRender;
import wtf.expensive.modules.Function;
import wtf.expensive.modules.FunctionAnnotation;
import wtf.expensive.modules.Type;
import wtf.expensive.modules.settings.imp.ModeSetting;
import wtf.expensive.modules.settings.imp.SliderSetting;
import wtf.expensive.util.IMinecraft;
import wtf.expensive.util.math.MathUtil;
import wtf.expensive.util.render.BloomHelper;
import wtf.expensive.util.render.ColorUtil;
import wtf.expensive.util.render.ProjectionUtils;
import wtf.expensive.util.render.RenderUtil;
import wtf.expensive.util.render.animation.AnimationMath;
import wtf.expensive.util.world.WorldUtil;

import java.awt.*;
import java.util.concurrent.CopyOnWriteArrayList;
import java.util.concurrent.ThreadLocalRandom;

@FunctionAnnotation(name = "Particles", type = Type.Render)
public class ParticlesFunction extends Function {

private final ModeSetting mode = new ModeSetting("Type", "Heart", "Heart", "Star", "Dollar", "Snow", "Point");
private SliderSetting maxPoints = new SliderSetting("Количество партиклов", 2.5f, 0.1f, 10.0f, 0.1f);

public ParticlesFunction() {
this.addSettings(maxPoints, mode);
}

CopyOnWriteArrayList<ParticlesFunction.Point> points = new CopyOnWriteArrayList<>();

@Override
public void onEvent(final Event event) {
if (IMinecraft.mc.world == null || IMinecraft.mc.player == null) return;
if (event instanceof EventMotion e) {
if (IMinecraft.mc.player.ticksExisted % 3 == 0) {
createPoints(IMinecraft.mc.player.getPositionVec().add(ThreadLocalRandom.current().nextFloat(-100, 100), ThreadLocalRandom.current().nextFloat(0, 100), ThreadLocalRandom.current().nextFloat(-100, 100)));
}
}
if (event instanceof EventRender e) {
//if (points.size() > maxPoints.getValue().floatValue()) {
// points.remove(0);
// }
for (ParticlesFunction.Point point : points) {
long alive = (System.currentTimeMillis() - point.createdTime);
if (alive > point.aliveTime || !IMinecraft.mc.player.canVectorBeSeenFixed(point.position)) {
points.remove(point);
continue;
}

Vector2d pos = ProjectionUtils.project(point.position.x, point.position.y, point.position.z);

if (pos != null) {
float sizeDefault = point.size;
point.update();

float size = 0.5f;

if (mode.is("Snow")) {
RenderUtil.Render2D.drawImage(new ResourceLocation("expensive/images/snow.png"), (float) pos.x, (float) pos.y, 6, 6, ColorUtil.getColorStyle(points.indexOf(point)));
} else if (mode.is("Dollar")) {
RenderUtil.Render2D.drawImage(new ResourceLocation("expensive/images/dollar.png"), (float) pos.x, (float) pos.y, 6, 6, ColorUtil.getColorStyle(points.indexOf(point)));
} else if (mode.is("Heart")) {
RenderUtil.Render2D.drawImage(new ResourceLocation("expensive/images/heart.png"), (float) pos.x, (float) pos.y, 6, 6, ColorUtil.getColorStyle(points.indexOf(point)));
} else if (mode.is("Star")) {
RenderUtil.Render2D.drawImage(new ResourceLocation("expensive/images/star.png"), (float) pos.x, (float) pos.y, 6, 6, ColorUtil.getColorStyle(points.indexOf(point)));
} else if (mode.is("Point")){
BloomHelper.registerRenderCall(() -> {
RenderUtil.Render2D.drawRoundCircle((float) pos.x, (float) pos.y, (sizeDefault + 1) * size, Color.BLACK.getRGB());
RenderUtil.Render2D.drawRoundCircle((float) pos.x, (float) pos.y, sizeDefault * size, ColorUtil.getColorStyle(points.indexOf(point)));
});
RenderUtil.Render2D.drawRoundCircle((float) pos.x, (float) pos.y, (sizeDefault + 1) * size, Color.BLACK.getRGB());
RenderUtil.Render2D.drawRoundCircle((float) pos.x, (float) pos.y, sizeDefault * size, ColorUtil.getColorStyle(points.indexOf(point)));
}
}
}
}
}
private void createPoints(Vector3d position) {
for (int i = 0; i < maxPoints.getValue().intValue(); i++) {
Vector3d positon = position.add (
ThreadLocalRandom.current().nextFloat(-100, 100),
ThreadLocalRandom.current().nextFloat(0, 100),
ThreadLocalRandom.current().nextFloat(-100, 100)
);
points.add(new Point(positon));
}
}

private 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(ThreadLocalRandom.current().nextFloat(-0.01f, 0.01f), 0, ThreadLocalRandom.current().nextFloat(-0.01f, 0.01f));
this.animatedMotion = new Vector3d(0, 0, 0);
size = ThreadLocalRandom.current().nextFloat(4, 7);
aliveTime = ThreadLocalRandom.current().nextLong(7500, 15000);
}


public void update() {
if (isGround()) {
points.remove(points);
} else {
motion.y = MathUtil.randomizeFloat(-0.01f, 0.01f);
motion.y *= 0.31;
motion.x *= 0.31;
motion.z *= 0.31;
}


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.1, position.z - 0.1, position.x + 0.1, position.y + 0.1, position.z + 0.1);
return WorldUtil.TotemUtil.getSphere(new BlockPos(position), 3, 6, false, true, 0)
.stream()
.anyMatch(blockPos -> !IMinecraft.mc.world.getBlockState(blockPos).isAir() &&
bb.intersects(new AxisAlignedBB(blockPos)) &&
AxisAlignedBB.calcSideHit(new AxisAlignedBB(blockPos.add(0, 1, 0)), position, new double[]{
2D
}, null, 0.1f, 0.1f, 0.1f) == Direction.DOWN);
}
}
}
 
Начинающий
Статус
Оффлайн
Регистрация
19 Ноя 2023
Сообщения
200
Реакции[?]
2
Поинты[?]
2K
/del сливали куча раз + в сурсах wissend и т.д. есть
Спиздил
/del сливали куча раз + в сурсах wissend и т.д. есть
Спиздил
/del сливали куча раз + в сурсах wissend и т.д. есть
Спиздил
 
Начинающий
Статус
Оффлайн
Регистрация
3 Сен 2023
Сообщения
173
Реакции[?]
3
Поинты[?]
0
Спасибо а то я жалкий Пастер не смог с виседа спиздить делай ещо
 
Начинающий
Статус
Оффлайн
Регистрация
20 Дек 2023
Сообщения
126
Реакции[?]
0
Поинты[?]
0
Партиклы для expensive 2.0 с импортами, да код не идеальный, я начинающий так что пж не бейте палками
Пожалуйста, авторизуйтесь для просмотра ссылки.

Пожалуйста, авторизуйтесь для просмотра ссылки.

Пожалуйста, авторизуйтесь для просмотра ссылки.


Java:
import net.minecraft.util.Direction;
import net.minecraft.util.ResourceLocation;
import net.minecraft.util.math.AxisAlignedBB;
import net.minecraft.util.math.BlockPos;
import net.minecraft.util.math.vector.Vector3d;
import org.joml.Vector2d;
import wtf.expensive.events.Event;
import wtf.expensive.events.impl.player.EventMotion;
import wtf.expensive.events.impl.render.EventRender;
import wtf.expensive.modules.Function;
import wtf.expensive.modules.FunctionAnnotation;
import wtf.expensive.modules.Type;
import wtf.expensive.modules.settings.imp.ModeSetting;
import wtf.expensive.modules.settings.imp.SliderSetting;
import wtf.expensive.util.IMinecraft;
import wtf.expensive.util.math.MathUtil;
import wtf.expensive.util.render.BloomHelper;
import wtf.expensive.util.render.ColorUtil;
import wtf.expensive.util.render.ProjectionUtils;
import wtf.expensive.util.render.RenderUtil;
import wtf.expensive.util.render.animation.AnimationMath;
import wtf.expensive.util.world.WorldUtil;

import java.awt.*;
import java.util.concurrent.CopyOnWriteArrayList;
import java.util.concurrent.ThreadLocalRandom;

@FunctionAnnotation(name = "Particles", type = Type.Render)
public class ParticlesFunction extends Function {

private final ModeSetting mode = new ModeSetting("Type", "Heart", "Heart", "Star", "Dollar", "Snow", "Point");
private SliderSetting maxPoints = new SliderSetting("Количество партиклов", 2.5f, 0.1f, 10.0f, 0.1f);

public ParticlesFunction() {
this.addSettings(maxPoints, mode);
}

CopyOnWriteArrayList<ParticlesFunction.Point> points = new CopyOnWriteArrayList<>();

@Override
public void onEvent(final Event event) {
if (IMinecraft.mc.world == null || IMinecraft.mc.player == null) return;
if (event instanceof EventMotion e) {
if (IMinecraft.mc.player.ticksExisted % 3 == 0) {
createPoints(IMinecraft.mc.player.getPositionVec().add(ThreadLocalRandom.current().nextFloat(-100, 100), ThreadLocalRandom.current().nextFloat(0, 100), ThreadLocalRandom.current().nextFloat(-100, 100)));
}
}
if (event instanceof EventRender e) {
//if (points.size() > maxPoints.getValue().floatValue()) {
// points.remove(0);
// }
for (ParticlesFunction.Point point : points) {
long alive = (System.currentTimeMillis() - point.createdTime);
if (alive > point.aliveTime || !IMinecraft.mc.player.canVectorBeSeenFixed(point.position)) {
points.remove(point);
continue;
}

Vector2d pos = ProjectionUtils.project(point.position.x, point.position.y, point.position.z);

if (pos != null) {
float sizeDefault = point.size;
point.update();

float size = 0.5f;

if (mode.is("Snow")) {
RenderUtil.Render2D.drawImage(new ResourceLocation("expensive/images/snow.png"), (float) pos.x, (float) pos.y, 6, 6, ColorUtil.getColorStyle(points.indexOf(point)));
} else if (mode.is("Dollar")) {
RenderUtil.Render2D.drawImage(new ResourceLocation("expensive/images/dollar.png"), (float) pos.x, (float) pos.y, 6, 6, ColorUtil.getColorStyle(points.indexOf(point)));
} else if (mode.is("Heart")) {
RenderUtil.Render2D.drawImage(new ResourceLocation("expensive/images/heart.png"), (float) pos.x, (float) pos.y, 6, 6, ColorUtil.getColorStyle(points.indexOf(point)));
} else if (mode.is("Star")) {
RenderUtil.Render2D.drawImage(new ResourceLocation("expensive/images/star.png"), (float) pos.x, (float) pos.y, 6, 6, ColorUtil.getColorStyle(points.indexOf(point)));
} else if (mode.is("Point")){
BloomHelper.registerRenderCall(() -> {
RenderUtil.Render2D.drawRoundCircle((float) pos.x, (float) pos.y, (sizeDefault + 1) * size, Color.BLACK.getRGB());
RenderUtil.Render2D.drawRoundCircle((float) pos.x, (float) pos.y, sizeDefault * size, ColorUtil.getColorStyle(points.indexOf(point)));
});
RenderUtil.Render2D.drawRoundCircle((float) pos.x, (float) pos.y, (sizeDefault + 1) * size, Color.BLACK.getRGB());
RenderUtil.Render2D.drawRoundCircle((float) pos.x, (float) pos.y, sizeDefault * size, ColorUtil.getColorStyle(points.indexOf(point)));
}
}
}
}
}
private void createPoints(Vector3d position) {
for (int i = 0; i < maxPoints.getValue().intValue(); i++) {
Vector3d positon = position.add (
ThreadLocalRandom.current().nextFloat(-100, 100),
ThreadLocalRandom.current().nextFloat(0, 100),
ThreadLocalRandom.current().nextFloat(-100, 100)
);
points.add(new Point(positon));
}
}

private 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(ThreadLocalRandom.current().nextFloat(-0.01f, 0.01f), 0, ThreadLocalRandom.current().nextFloat(-0.01f, 0.01f));
this.animatedMotion = new Vector3d(0, 0, 0);
size = ThreadLocalRandom.current().nextFloat(4, 7);
aliveTime = ThreadLocalRandom.current().nextLong(7500, 15000);
}


public void update() {
if (isGround()) {
points.remove(points);
} else {
motion.y = MathUtil.randomizeFloat(-0.01f, 0.01f);
motion.y *= 0.31;
motion.x *= 0.31;
motion.z *= 0.31;
}


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.1, position.z - 0.1, position.x + 0.1, position.y + 0.1, position.z + 0.1);
return WorldUtil.TotemUtil.getSphere(new BlockPos(position), 3, 6, false, true, 0)
.stream()
.anyMatch(blockPos -> !IMinecraft.mc.world.getBlockState(blockPos).isAir() &&
bb.intersects(new AxisAlignedBB(blockPos)) &&
AxisAlignedBB.calcSideHit(new AxisAlignedBB(blockPos.add(0, 1, 0)), position, new double[]{
2D
}, null, 0.1f, 0.1f, 0.1f) == Direction.DOWN);
}
}
}
/del сливали куча раз + в сурсах wissend и т.д. есть
 
Похожие темы
Сверху Снизу