// Decompiled with: CFR 0.152
// Class Version: 17
import com.google.common.eventbus.Subscribe;
import java.util.ArrayList;
import java.util.List;
import java.util.concurrent.ThreadLocalRandom;
import net.minecraft.client.entity.player.ClientPlayerEntity;
import net.minecraft.entity.Entity;
import net.minecraft.util.ResourceLocation;
/*
* Illegal identifiers - recommend switching to table mode
*/
@LILIIIILILIIILILLLLLIIIIILLLIIILIIIIIILLLLI(name="Particle New", category=LLLLILIIIIIIILLIILILILILILLLIIIILLILIILILLI.Render)
public class Particles
extends Module {
private final ModeSetting textureMode = new ModeSetting("Вид", "Bloom", "Bloom", "Random", "Cross", "Quad", "Star", "ARBUZ", "Heart", "King", "Треугольник", "Amogus", "Dollars", "skull", "Snow");
private final ModeListSetting elements = new ModeListSetting("Триггер", (IIILLLILIILIILLLLIILLLILLIIILIIIILII[])new BooleanSetting[]{new BooleanSetting("Удар", true), new BooleanSetting("Ходьба", true), new BooleanSetting("Бросаемый предмет", true), new BooleanSetting("Прыжок", true)});
public final SliderSetting sizeOfParticles = new SliderSetting("Количество при атаке", 15.0f, 3.0f, 50.0f, 1.0f);
public final SliderSetting sizeOfParticlesWhenWalk = new SliderSetting("Количество при ходьбе", 3.0f, 1.0f, 5.0f, 1.0f);
public final BooleanSetting randomColor = new BooleanSetting("Рандомный цвет", false);
public final SliderSetting explosionPower = new SliderSetting("Сила взрыва", 1.0f, 0.1f, 5.0f, 0.1f);
public final SliderSetting explosionSpeed = new SliderSetting("Скорость взрыва", 1.0f, 0.1f, 3.0f, 0.1f);
private final List<Particle3D> targetParticles = new ArrayList<>();
private final List<Particle3D> flameParticles = new ArrayList<>();
private ResourceLocation texture() {
int r = ThreadLocalRandom.current().nextInt(1, 9);
if (this.textureMode.is("Bloom")) {
return new ResourceLocation("alphanight/images/firefly.png");
}
if (this.textureMode.is("Random")) {
return new ResourceLocation("alphanight/images/modules/particle/" + r + ".png");
}
if (this.textureMode.is("Cross")) {
return new ResourceLocation("alphanight/images/p1.png");
}
if (this.textureMode.is("ARBUZ")) {
return new ResourceLocation("alphanight/images/Arbuz.png");
}
if (this.textureMode.is("Quad")) {
return new ResourceLocation("alphanight/images/p2.png");
}
if (this.textureMode.is("Star")) {
return new ResourceLocation("alphanight/images/p3.png");
}
if (this.textureMode.is("Heart")) {
return new ResourceLocation("alphanight/images/p4.png");
}
if (this.textureMode.is("King")) {
return new ResourceLocation("alphanight/images/p5.png");
}
if (this.textureMode.is("Треугольник")) {
return new ResourceLocation("alphanight/images/p6.png");
}
if (this.textureMode.is("Amogus")) {
return new ResourceLocation("alphanight/images/p7.png");
}
if (this.textureMode.is("Dollars")) {
return new ResourceLocation("alphanight/images/p8.png");
}
if (this.textureMode.is("skull")) {
return new ResourceLocation("alphanight/images/p10.png");
}
if (this.textureMode.is("Snow")) {
return new ResourceLocation("alphanight/images/p11.png");
}
return null;
}
public Particles() {
this.addSettings(this.textureMode, this.elements, this.explosionPower, this.explosionSpeed, this.sizeOfParticles, this.sizeOfParticlesWhenWalk, this.randomColor);
}
@Override
public void onEnable() {
super.onEnable();
this.targetParticles.clear();
this.flameParticles.clear();
}
@Subscribe
public void onAttack(AttackEvent event) {
Entity target = event.entity;
float power = ((Float)this.explosionPower.get()).floatValue();
float speedMultiplier = ((Float)this.explosionSpeed.get()).floatValue();
if (((Boolean)this.elements.getValueByName("Удар").get()).booleanValue()) {
int i = 0;
while ((float)i < ((Float)this.sizeOfParticles.get()).floatValue()) {
double theta = Math.PI * 2 * Math.random();
double phi = Math.acos(2.0 * Math.random() - 1.0);
double x = Math.sin(phi) * Math.cos(theta);
double y = Math.sin(phi) * Math.sin(theta);
double z = Math.cos(phi);
Vector3d direction = new Vector3d(x, y, z).mul((double)power * (0.5 + Math.random() * 0.5)).mul(speedMultiplier);
direction.add(MathUtil.random(-0.2f, 0.2f), MathUtil.random(-0.2f, 0.2f), MathUtil.random(-0.2f, 0.2f));
targetParticles.add(new Particle3D(new org.joml.Vector3d(target.getPosX(), target.getPosY() + MathUtil.random(0, target.getHeight()), target.getPosZ()),
new org.joml.Vector3d(MathUtil.random(-motion, motion), MathUtil.random(-2, 0.1f), MathUtil.random(-motion, motion)), targetParticles.size(), ColorUtils.random().hashCode()));
++i;
}
}
}
@Subscribe
public void onJump(JumpEvent e) {
ClientPlayerEntity target = .null.player;
float motion = 3.0f * ((Float)this.explosionSpeed.get()).floatValue();
if (((Boolean)this.elements.getValueByName("Прыжок").get()).booleanValue()) {
int i = 0;
while ((float)i < ((Float)this.sizeOfParticles.get()).floatValue()) {
flameParticles.add(new Particle3D(new org.joml.Vector3d(target.getPosX(), target.getPosY(), target.getPosZ()), new org.joml.Vector3d(MathUtil.random(-motion, motion), MathUtil.random(-2, 0.1f), MathUtil.random(-motion, motion)), targetParticles.size(), ColorUtils.random().hashCode()));
++i;
}
}
}
@Subscribe
public void onMotion(EventMotion e) {
float speedFactor;
block7: {
block8: {
if (!((Boolean)this.elements.getValueByName("Ходьба").get()).booleanValue()) break block7;
if (.null.player.lastTickPosX != .null.player.getPosX()) break block8;
if (.null.player.lastTickPosY != .null.player.getPosY()) break block8;
if (.null.player.lastTickPosZ == .null.player.getPosZ()) break block7;
}
speedFactor = ((Float)this.explosionSpeed.get()).floatValue();
int i = 0;
while ((float)i < ((Float)this.sizeOfParticlesWhenWalk.get()).floatValue()) {
flameParticles.add(new Particle3D(new org.joml.Vector3d(mc.player.getPosX() + MathUtil.random(-0.5f, 0.5f), mc.player.getPosY() + MathUtil.random(0.4f, mc.player.getHeight() / 2), mc.player.getPosZ() + MathUtil.random(-0.5f, 0.5f)), new org.joml.Vector3d(MathUtil.random(-0.1f, 0.1f), 0, MathUtil.random(-0.1f, 0.1f)).mul(2 * (1 + Math.random())), flameParticles.size(), ColorUtils.random().hashCode()));
++i;
}
}
if (((Boolean)this.elements.getValueByName("Бросаемый предмет").get()).booleanValue()) {
speedFactor = ((Float)this.explosionSpeed.get()).floatValue();
for (.null entity : .null.world.getAllEntities()) {
if (!(entity instanceof ThrowableEntity)) continue;
ThrowableEntity p = (ThrowableEntity)entity;
for (int i = 0; i < 3; ++i) {
flameParticles.add(new Particle3D(new org.joml.Vector3d(mc.player.getPosX() + MathUtil.random(-0.5f, 0.5f), mc.player.getPosY() + MathUtil.random(0.4f, mc.player.getHeight() / 2), mc.player.getPosZ() + MathUtil.random(-0.5f, 0.5f)), new org.joml.Vector3d(MathUtil.random(-0.1f, 0.1f), 0, MathUtil.random(-0.1f, 0.1f)).mul(2 * (1 + Math.random())), flameParticles.size(), ColorUtils.random().hashCode()));
}
}
}
this.targetParticles.removeIf(particle -> particle.getTime().isReached(5000L));
this.flameParticles.removeIf(particle -> particle.getTime().isReached(3500L));
}
@Subscribe
public void onChange(EventChangeWorld e) {
this.targetParticles.clear();
this.flameParticles.clear();
}
@Subscribe
public void onRender(DEngineEvent event) {
float size;
float z;
float y;
float x;
Vector3d v;
int color;
MatrixStack matrix = event.getMatrix();
boolean light = GL11.glIsEnabled(2896);
RenderSystem.pushMatrix();
matrix.push();
RenderSystem.enableBlend();
RenderSystem.disableAlphaTest();
RenderSystem.depthMask(false);
RenderSystem.disableCull();
if (light) {
RenderSystem.disableLighting();
}
GL11.glShadeModel(7425);
RenderSystem.blendFuncSeparate((GlStateManager.SourceFactor)GlStateManager.SourceFactor.SRC_ALPHA, GlStateManager.DestFactor.ONE, GlStateManager.SourceFactor.ONE, GlStateManager.DestFactor.ZERO);
float pos = 0.1f;
matrix.push();
if (!this.targetParticles.isEmpty()) {
this.targetParticles.forEach(Particle3D::update);
for (Particle3D particle3D : this.targetParticles) {
RectUtil.bindTexture(particle3D.getTexture());
if ((int)particle3D.getAnimation().getValue() != 255 && !particle3D.getTime().isReached(500L)) {
particle3D.getAnimation().run(255.0);
}
if ((int)particle3D.getAnimation().getValue() != 0 && particle3D.getTime().isReached(2000L)) {
particle3D.getAnimation().run(0.0);
}
color = ColorUtils.setAlpha(Theme.MainColor(0), (int)particle3D.getAnimation().getValue());
if (((Boolean)this.randomColor.get()).booleanValue()) {
color = ColorUtils.setAlpha(particle3D.getColor(), (int)particle3D.getAnimation().getValue());
}
v = particle3D.getPosition();
x = (float)v.x;
y = (float)v.y;
z = (float)v.z;
matrix.push();
RectUtil.setupOrientationMatrix(matrix, x, y, z);
matrix.rotate(mc.getRenderManager().getCameraOrientation());
matrix.rotate(new Quaternion(new Vector3f(0.0f, 0.0f, 1.0f), particle3D.rotation, false));
matrix.push();
GL11.glBlendFunc(770, 1);
matrix.translate(0.0, pos / 2.5f, 0.0);
RectUtil.drawRect(matrix, -pos, -pos, pos, pos, color, color, color, color, true, true);
size = pos / 2.5f;
color = ColorUtils.setAlpha(-1, (int)particle3D.getAnimation().getValue());
GL11.glBlendFunc(770, 771);
matrix.pop();
matrix.pop();
}
}
matrix.pop();
matrix.push();
if (!this.flameParticles.isEmpty()) {
this.flameParticles.forEach(Particle3D::update);
for (Particle3D particle3D : this.flameParticles) {
RectUtil.bindTexture(particle3D.getTexture());
if ((int)particle3D.getAnimation().getValue() != 255 && !particle3D.getTime().isReached(500L)) {
particle3D.getAnimation().run(255.0);
}
if ((int)particle3D.getAnimation().getValue() != 0 && particle3D.getTime().isReached(800L)) {
particle3D.getAnimation().run(0.0);
}
color = ColorUtils.setAlpha(Theme.MainColor(0), (int)particle3D.getAnimation().getValue());
if (((Boolean)this.randomColor.get()).booleanValue()) {
color = ColorUtils.setAlpha(particle3D.getColor(), (int)particle3D.getAnimation().getValue());
}
v = particle3D.getPosition();
x = (float)v.x;
y = (float)v.y;
z = (float)v.z;
matrix.push();
RectUtil.setupOrientationMatrix(matrix, x, y, z);
matrix.rotate(mc.getRenderManager().getCameraOrientation());
matrix.rotate(new Quaternion(new Vector3f(0.0f, 0.0f, 1.0f), particle3D.rotation, false));
matrix.push();
GL11.glBlendFunc(770, 1);
matrix.translate(0.0, pos / 2.0f, 0.0);
RectUtil.drawRect(matrix, -pos, -pos, pos, pos, color, color, color, color, true, true);
size = pos / 2.0f;
color = ColorUtils.setAlpha(-1, (int)particle3D.getAnimation().getValue());
GL11.glBlendFunc(770, 771);
matrix.pop();
matrix.pop();
}
}
matrix.pop();
RenderSystem.blendFuncSeparate((GlStateManager.SourceFactor)GlStateManager.SourceFactor.SRC_ALPHA, GlStateManager.DestFactor.ONE_MINUS_SRC_ALPHA, GlStateManager.SourceFactor.ONE, GlStateManager.DestFactor.ZERO);
.null.clearCurrentColor();
GL11.glShadeModel(7424);
if (light) {
RenderSystem.enableLighting();
}
RenderSystem.enableCull();
RenderSystem.depthMask(true);
RenderSystem.enableAlphaTest();
matrix.pop();
RenderSystem.popMatrix();
}
}
public static class Particle3D {
private final int index;
private final int color;
private final TimerUtility time = new TimerUtility();
private final CompactAnimation animation = new CompactAnimation(Easing.LINEAR, 500L);
private ResourceLocation texture;
public final org.joml.Vector3d position;
private final org.joml.Vector3d delta;
private float rotate = 0.0f;
private float rotation;
public Particle3D(org.joml.Vector3d position, org.joml.Vector3d velocity, int index, int color) {
this.this$0 = this$0;
this.position = position;
this.delta = new Vector3d(velocity.x * 0.05, velocity.y * 0.05, velocity.z * 0.05);
this.index = index;
this.color = color;
this.texture = this$0.texture();
this.time.reset();
}
public void update() {
.null block3;
.null block2;
this.rotation = this.rotate % 1000.0f / 50.0f;
.null block1 = BlockUtils.getBlock(this.position.x, this.position.y, this.position.z + this.delta.z);
if (this.isValidBlock(block1)) {
this.delta.z *= -0.6;
}
if (this.isValidBlock(block2 = BlockUtils.getBlock(this.position.x, this.position.y + this.delta.y, this.position.z))) {
this.delta.x *= (double)0.99f;
this.delta.z *= (double)0.99f;
this.delta.y *= -0.5;
}
if (this.isValidBlock(block3 = BlockUtils.getBlock(this.position.x + this.delta.x, this.position.y, this.position.z))) {
this.delta.x *= -0.6;
}
this.updateWithoutPhysics();
this.rotate += 1.0f;
}
private boolean isValidBlock(.null block) {
return !(block instanceof AirBlock) && !(block instanceof BushBlock) && !(block instanceof .null) && !(block instanceof TorchBlock) && !(block instanceof .null) && !(block instanceof AbstractPressurePlateBlock) && !(block instanceof CarpetBlock) && !(block instanceof FlowingFluidBlock);
}
public void updateWithoutPhysics() {
this.position.x += this.delta.x;
this.position.y += this.delta.y;
this.position.z += this.delta.z;
this.delta.x *= (double)0.99f;
this.delta.y -= (double)5.0E-4f;
this.delta.z *= (double)0.99f;
}
public int getIndex() {
return this.index;
}
public int getColor() {
return this.color;
}
public TimerUtility getTime() {
return this.time;
}
public CompactAnimation getAnimation() {
return this.animation;
}
public ResourceLocation getTexture() {
return this.texture;
}
public Vector3d getPosition() {
return this.position;
}
public Vector3d getDelta() {
return this.delta;
}
public float getRotate() {
return this.rotate;
}
public float getRotation() {
return this.rotation;
}
}