-
Автор темы
- #1
Перед прочтением основного контента ниже, пожалуйста, обратите внимание на обновление внутри секции Майна на нашем форуме. У нас появились:
- бесплатные читы для Майнкрафт — любое использование на свой страх и риск;
- маркетплейс Майнкрафт — абсолютно любая коммерция, связанная с игрой, за исключением продажи читов (аккаунты, предоставления услуг, поиск кодеров читов и так далее);
- приватные читы для Minecraft — в этом разделе только платные хаки для игры, покупайте группу "Продавец" и выставляйте на продажу свой софт;
- обсуждения и гайды — всё тот же раздел с вопросами, но теперь модернизированный: поиск нужных хаков, пати с игроками-читерами и другая полезная информация.
Спасибо!
Код:
public static ColorSetting PickColor = new ColorSetting("Color", (new Color(255, 255, 255)).getRGB());
private final ArrayList<FirePart> FIRE_PARTS_LIST = new ArrayList();
private final ResourceLocation FIRE_PART_TEX = new ResourceLocation("test/textures/firepart.png");
private final Tessellator tessellator = Tessellator.getInstance();
private final BufferBuilder buffer = this.tessellator.getBuffer();
public static int getAlphaFromColor(int color) {
return color >> 24 & 0xFF;
}
public static int getColor1(int brightness) {
return getColor(brightness, brightness, brightness, 255);
}
public static int getColor(int red, int green, int blue) {
return getColor(red, green, blue, 255);
}
public static int getColor(int red, int green, int blue, int alpha) {
int color = 0;
color |= alpha << 24;
color |= red << 16;
color |= green << 8;
return color |= blue;
}
public static int getColor(int red, int green, int blue, float alpha) {
int color = 0;
color |= (int) alpha << 24;
color |= red << 16;
color |= green << 8;
return color |= blue;
}
public static int getColor(int brightness) {
return getColor(brightness, brightness, brightness, 255);
}
public static int getColor(int brightness, int alpha) {
return getColor(brightness, brightness, brightness, alpha);
}
public static int swapAlpha(int color, float alpha) {
int f = color >> 16 & 0xFF;
int f1 = color >> 8 & 0xFF;
int f2 = color & 0xFF;
return getColor(f, f1, f2, (int) alpha);
}
private long getMaxPartAliveTime() {
return 6000L;
}
private int getPartColor(FirePart part, float alphaPC) {
int color = this.PickColor.getColor().getRGB();
return swapAlpha(color, (float) getAlphaFromColor(color) * part.getAlphaPC() * alphaPC);
}
private float getRandom(double min, double max) {
return (float) MathUtility.getRandomInRange((int) min, (int) max);
}
private Vec3d generateVecForPart(double rangeXZ, double rangeY) {
Vec3d pos = mc.player.getPositionVector().add(this.getRandom(-rangeXZ, rangeXZ), this.getRandom(-rangeY / 2.0, rangeY), this.getRandom(-rangeXZ, rangeXZ));
for (int i = 0; i < 30; ++i) {
pos = mc.player.getPositionVector().add(this.getRandom(-rangeXZ, rangeXZ), this.getRandom(-rangeY / 2.0, rangeY), this.getRandom(-rangeXZ, rangeXZ));
}
return pos;
}
private void setupGLDrawsFireParts(Runnable partsRender, boolean tex) {
double glX = RenderManager.renderPosX;
double glY = RenderManager.renderPosY;
double glZ = RenderManager.renderPosZ;
GL11.glPushMatrix();
GlStateManager.tryBlendFuncSeparate(GlStateManager.SourceFactor.SRC_ALPHA, GlStateManager.DestFactor.ONE, GlStateManager.SourceFactor.ONE, GlStateManager.DestFactor.ZERO);
FireFlies.mc.entityRenderer.disableLightmap();
GL11.glEnable(3042);
GL11.glLineWidth(1.0f);
if (tex) {
GL11.glEnable(3553);
} else {
GL11.glDisable(3553);
}
GL11.glDisable(2896);
GL11.glShadeModel(7425);
GL11.glDisable(3008);
GL11.glDisable(2884);
GL11.glDepthMask(false);
GL11.glTranslated(-glX, -glY, -glZ);
partsRender.run();
GL11.glTranslated(glX, glY, glZ);
GL11.glDepthMask(true);
GL11.glEnable(2884);
GL11.glEnable(3008);
GL11.glLineWidth(1.0f);
GL11.glShadeModel(7424);
GL11.glEnable(3553);
GlStateManager.resetColor();
GlStateManager.tryBlendFuncSeparate(GlStateManager.SourceFactor.SRC_ALPHA, GlStateManager.DestFactor.ONE_MINUS_SRC_ALPHA, GlStateManager.SourceFactor.ONE, GlStateManager.DestFactor.ZERO);
GL11.glPopMatrix();
}
private void bindResource(ResourceLocation toBind) {
mc.getTextureManager().bindTexture(toBind);
}
private void drawBindedTexture(float x, float y, float x2, float y2, int c, int c2, int c3, int c4) {
this.buffer.begin(7, DefaultVertexFormats.POSITION_TEX_COLOR);
this.buffer.pos(x, y).tex(0.0, 0.0).color(c).endVertex();
this.buffer.pos(x, y2).tex(0.0, 1.0).color(c).endVertex();
this.buffer.pos(x2, y2).tex(1.0, 1.0).color(c).endVertex();
this.buffer.pos(x2, y).tex(1.0, 0.0).color(c).endVertex();
this.tessellator.draw();
}
private void drawBindedTexture(float x, float y, float x2, float y2, int c) {
this.drawBindedTexture(x, y, x2, y2, c, c, c, c);
}
private void drawPart(FirePart part, float pTicks, float alphaPC) {
int color = this.getPartColor(part, alphaPC);
alphaPC *= part.getAlphaPC();
this.drawSparkPartsList(color, part, alphaPC, pTicks);
this.drawTrailPartsList(color, part, alphaPC);
Vec3d pos = part.getRenderPosVec(pTicks);
GL11.glPushMatrix();
GL11.glTranslated(pos.getX(), pos.getY(), pos.getZ());
GL11.glNormal3d(1.0, 1.0, 1.0);
GL11.glRotated(-FireFlies.mc.getRenderManager().playerViewY, 0.0, 1.0, 0.0);
GL11.glRotated(FireFlies.mc.getRenderManager().playerViewX, FireFlies.mc.gameSettings.thirdPersonView == 2 ? -1.0 : 1.0, 0.0, 0.0);
GL11.glScaled(-0.1, -0.1, 0.1);
float scale = 7.0f * alphaPC;
this.drawBindedTexture(-scale / 2.0f, -scale / 2.0f, scale / 2.0f, scale / 2.0f, color);
this.drawBindedTexture(-(scale *= 8.0f) / 2.0f, -scale / 2.0f, scale / 2.0f, scale / 2.0f, swapAlpha(swapDark(color, 0.2f), (float) getAlphaFromColor(color) / 5.0f));
this.drawBindedTexture(-(scale *= 3.0f) / 2.0f, -scale / 2.0f, scale / 2.0f, scale / 2.0f, swapAlpha(swapDark(color, 0.2f), (float) getAlphaFromColor(color) / 7.0f));
GL11.glPopMatrix();
}
public static int swapDark(int color, float dark) {
int f = color >> 16 & 0xFF;
int f1 = color >> 8 & 0xFF;
int f2 = color & 0xFF;
return getColor((int) ((float) f * dark), (int) ((float) f1 * dark), (int) ((float) f2 * dark));
}
@EventTarget
public void onRender(EventUpdate test) {
this.stateAnim.to = 1;
if (mc.player.ticksExisted == 1) {
this.FIRE_PARTS_LIST.forEach(part -> part.setToRemove());
}
this.FIRE_PARTS_LIST.forEach(FirePart::updatePart);
this.FIRE_PARTS_LIST.removeIf(FirePart::isToRemove);
if (mc.player.ticksExisted % (int) (15 + 1.0f) == 0) {
this.FIRE_PARTS_LIST.add(new FirePart(this.generateVecForPart(10.0, 4.0), this.getMaxPartAliveTime()));
this.FIRE_PARTS_LIST.add(new FirePart(this.generateVecForPart(6.0, 5.0), this.getMaxPartAliveTime()));
}
}
@EventTarget
public void onRender(EventRender3D partialTicks) {
this.stateAnim.to = 1;
if (!this.FIRE_PARTS_LIST.isEmpty() && this.stateAnim.getAnim() > 0.003921569f) {
this.setupGLDrawsFireParts(() -> {
this.bindResource(this.FIRE_PART_TEX);
this.FIRE_PARTS_LIST.forEach(part -> this.drawPart((FirePart) part, partialTicks.getPartialTicks(), this.stateAnim.getAnim()));
}, true);
}
}
private void drawSparkPartsList(int color, FirePart firePart, float alphaPC, float partialTicks) {
if (firePart.SPARK_PARTS.size() < 2) {
return;
}
GL11.glDisable(3553);
GL11.glEnable(3042);
GL11.glDisable(3008);
GL11.glEnable(2832);
GL11.glPointSize(1.5f + 6.0f * MathUtility.clamp(1.0f - (mc.player.getSmoothDistanceToCoord((float) firePart.getPosVec().x, (float) firePart.getPosVec().y + 1.6f, (float) firePart.getPosVec().z) - 3.0f) / 10.0f, 0.0f, 1.0f));
GL11.glBegin(0);
for (SparkPart spark : firePart.SPARK_PARTS) {
int c = swapAlpha(getOverallColorFrom(-1, color, (float) spark.timePC()), (float) getAlphaFromColor(color) * alphaPC * (1.0f - (float) spark.timePC()));
glColor(c);
GL11.glVertex3d(spark.getRenderPosX(partialTicks), spark.getRenderPosY(partialTicks), spark.getRenderPosZ(partialTicks));
}
GL11.glEnd();
GlStateManager.resetColor();
GL11.glEnable(3008);
GL11.glEnable(3553);
}
public static int getOverallColorFrom(int color1, int color2, float percentTo2) {
int red1 = getRedFromColor(color1);
int green1 = getGreenFromColor(color1);
int blue1 = getBlueFromColor(color1);
int alpha1 = getAlphaFromColor(color1);
int red2 = getRedFromColor(color2);
int green2 = getGreenFromColor(color2);
int blue2 = getBlueFromColor(color2);
int alpha2 = getAlphaFromColor(color2);
int finalRed = (int) ((float) red1 * (1.0f - percentTo2) + (float) red2 * percentTo2);
int finalGreen = (int) ((float) green1 * (1.0f - percentTo2) + (float) green2 * percentTo2);
int finalBlue = (int) ((float) blue1 * (1.0f - percentTo2) + (float) blue2 * percentTo2);
int finalAlpha = (int) ((float) alpha1 * (1.0f - percentTo2) + (float) alpha2 * percentTo2);
return getColor(finalRed, finalGreen, finalBlue, finalAlpha);
}
public static int getRedFromColor(int color) {
return color >> 16 & 0xFF;
}
public static int getGreenFromColor(int color) {
return color >> 8 & 0xFF;
}
public static int getBlueFromColor(int color) {
return color & 0xFF;
}
public static int getOverallColorFrom(int color1, int color2) {
int red1 = getRedFromColor(color1);
int green1 = getGreenFromColor(color1);
int blue1 = getBlueFromColor(color1);
int alpha1 = getAlphaFromColor(color1);
int red2 = getRedFromColor(color2);
int green2 = getGreenFromColor(color2);
int blue2 = getBlueFromColor(color2);
int alpha2 = getAlphaFromColor(color2);
int finalRed = (red1 + red2) / 2;
int finalGreen = (green1 + green2) / 2;
int finalBlue = (blue1 + blue2) / 2;
int finalAlpha = (alpha1 + alpha2) / 2;
return getColor(finalRed, finalGreen, finalBlue, finalAlpha);
}
private void drawTrailPartsList(int color, FirePart firePart, float alphaPC) {
if (firePart.TRAIL_PARTS.size() < 2) {
return;
}
GL11.glDisable(3553);
GL11.glLineWidth(1.0E-5f + 8.0f * MathUtility.clamp(1.0f - (mc.player.getSmoothDistanceToCoord((float) firePart.getPosVec().x, (float) firePart.getPosVec().y + 1.6f, (float) firePart.getPosVec().z) - 3.0f) / 20.0f, 0.0f, 1.0f));
GL11.glEnable(3042);
GL11.glDisable(3008);
GL11.glEnable(2848);
GL11.glHint(3154, 4354);
int point = 0;
int pointsCount = firePart.TRAIL_PARTS.size();
GL11.glBegin(3);
for (TrailPart trail : firePart.TRAIL_PARTS) {
float sizePC = (float) point / (float) pointsCount;
sizePC = ((double) sizePC > 0.5 ? 1.0f - sizePC : sizePC) * 2.0f;
sizePC = sizePC > 1.0f ? 1.0f : (sizePC < 0.0f ? 0.0f : sizePC);
int c = swapAlpha(color, (float) getAlphaFromColor(color) * alphaPC * sizePC);
glColor(c);
GL11.glVertex3d(trail.x, trail.y, trail.z);
++point;
}
GL11.glEnd();
GlStateManager.resetColor();
GL11.glEnable(3008);
GL11.glDisable(2848);
GL11.glHint(3154, 4352);
GL11.glLineWidth(1.0f);
GL11.glEnable(3553);
}
private class FirePart {
List<TrailPart> TRAIL_PARTS = new ArrayList<TrailPart>();
List<SparkPart> SPARK_PARTS = new ArrayList<SparkPart>();
Vec3d prevPos;
Vec3d pos;
AnimationUtils alphaPC = new AnimationUtils(0.0f, 1.0f, 0.02f);
int msChangeSideRate = this.getMsChangeSideRate();
float moveYawSet = FireFlies.this.getRandom(0.0, 360.0);
float speed = FireFlies.this.getRandom(0.1, 0.25);
float yMotion = FireFlies.this.getRandom(-0.075, 0.1);
float moveYaw = this.moveYawSet;
float maxAlive;
long startTime;
long rateTimer = this.startTime = System.currentTimeMillis();
boolean toRemove;
public FirePart(Vec3d pos, float maxAlive) {
this.pos = pos;
this.prevPos = pos;
this.maxAlive = maxAlive;
}
public float getTimePC() {
return MathUtility.clamp((float) (System.currentTimeMillis() - this.startTime) / this.maxAlive, 0.0f, 1.0f);
}
public void setAlphaPCTo(float to) {
this.alphaPC.to = to;
}
public float getAlphaPC() {
return this.alphaPC.getAnim();
}
public Vec3d getPosVec() {
return this.pos;
}
public Vec3d getRenderPosVec(float pTicks) {
Vec3d pos = this.getPosVec();
return pos.add(-(this.prevPos.getX() - pos.getX()) * (double) pTicks, -(this.prevPos.getY() - pos.getY()) * (double) pTicks, -(this.prevPos.getZ() - pos.getZ()) * (double) pTicks);
}
public void updatePart() {
if (System.currentTimeMillis() - this.rateTimer >= (long) this.msChangeSideRate) {
this.msChangeSideRate = this.getMsChangeSideRate();
this.rateTimer = System.currentTimeMillis();
this.moveYawSet = FireFlies.this.getRandom(0.0, 360.0);
}
this.moveYaw = MathUtility.lerp(this.moveYaw, this.moveYawSet, 0.065f);
float motionX = -((float) Math.sin(Math.toRadians(this.moveYaw))) * (this.speed /= 1.005f);
float motionZ = (float) Math.cos(Math.toRadians(this.moveYaw)) * this.speed;
this.prevPos = this.pos;
float scaleBox = 0.1f;
float delente = !Module.mc.world.getCollisionBoxes(null, new AxisAlignedBB(this.pos.x - (double) (scaleBox / 2.0f), this.pos.y, this.pos.z - (double) (scaleBox / 2.0f), this.pos.x + (double) (scaleBox / 2.0f), this.pos.y + (double) scaleBox, this.pos.z + (double) (scaleBox / 2.0f))).isEmpty() ? 0.3f : 1.0f;
this.pos = this.pos.add(motionX / delente, (this.yMotion /= 1.02f) / delente, motionZ / delente);
if (this.getTimePC() >= 1.0f) {
this.setAlphaPCTo(0.0f);
if (this.getAlphaPC() < 0.003921569f) {
this.setToRemove();
}
}
this.TRAIL_PARTS.add(new TrailPart(this, 400));
if (!this.TRAIL_PARTS.isEmpty()) {
this.TRAIL_PARTS.removeIf(TrailPart::toRemove);
}
for (int i = 0; i < 2; ++i) {
this.SPARK_PARTS.add(new SparkPart(this, 300));
}
this.SPARK_PARTS.forEach(SparkPart::motionSparkProcess);
if (!this.SPARK_PARTS.isEmpty()) {
this.SPARK_PARTS.removeIf(SparkPart::toRemove);
}
}
public void setToRemove() {
this.toRemove = true;
}
public boolean isToRemove() {
return this.toRemove;
}
int getMsChangeSideRate() {
return (int) FireFlies.this.getRandom(300.5, 900.5);
}
}
private class SparkPart {
double posX;
double posY;
double posZ;
double prevPosX;
double prevPosY;
double prevPosZ;
double speed = Math.random() / 30.0;
double radianYaw = Math.random() * 360.0;
double radianPitch = -90.0 + Math.random() * 180.0;
long startTime = System.currentTimeMillis();
int maxTime;
SparkPart(FirePart part, int maxTime) {
this.maxTime = maxTime;
this.posX = part.getPosVec().getX();
this.posY = part.getPosVec().getY();
this.posZ = part.getPosVec().getZ();
this.prevPosX = this.posX;
this.prevPosY = this.posY;
this.prevPosZ = this.posZ;
}
double timePC() {
return MathUtility.clamp((float) (System.currentTimeMillis() - this.startTime) / (float) this.maxTime, 0.0f, 1.0f);
}
boolean toRemove() {
return this.timePC() == 1.0;
}
void motionSparkProcess() {
double radYaw = Math.toRadians(this.radianYaw);
this.prevPosX = this.posX;
this.prevPosY = this.posY;
this.prevPosZ = this.posZ;
this.posX += Math.sin(radYaw) * this.speed;
this.posY += Math.cos(Math.toRadians(this.radianPitch - 90.0)) * this.speed;
this.posZ += Math.cos(radYaw) * this.speed;
}
double getRenderPosX(float partialTicks) {
return this.prevPosX + (this.posX - this.prevPosX) * (double) partialTicks;
}
double getRenderPosY(float partialTicks) {
return this.prevPosY + (this.posY - this.prevPosY) * (double) partialTicks;
}
double getRenderPosZ(float partialTicks) {
return this.prevPosZ + (this.posZ - this.prevPosZ) * (double) partialTicks;
}
}
private class TrailPart {
double x;
double y;
double z;
long startTime = System.currentTimeMillis();
int maxTime;
public TrailPart(FirePart part, int maxTime) {
this.maxTime = maxTime;
this.x = part.getPosVec().getX();
this.y = part.getPosVec().getY();
this.z = part.getPosVec().getZ();
}
public float getTimePC() {
return MathUtility.clamp((float) (System.currentTimeMillis() - this.startTime) / (long) this.maxTime, 0.0f, 1.0f);
}
public boolean toRemove() {
return this.getTimePC() == 1.0f;
}
}
}
кто шарит помогите