the game where you go into mines and start crafting! but for consoles (forked directly from smartcmd's github)
1#include "stdafx.h"
2#include "..\Minecraft.World\JavaMath.h"
3#include "RedDustParticle.h"
4
5void RedDustParticle::init(Level *level, double x, double y, double z, float scale, float rCol, float gCol, float bCol)
6{
7 xd *= 0.1f;
8 yd *= 0.1f;
9 zd *= 0.1f;
10
11 // 4J Stu - If they are all 0 then this particle has been created differently
12 // If just red is 0 it could be because we have made redstone a completely different colour (eg blue)
13 if (rCol == 0 && gCol == 0 && bCol == 0)
14 {
15 rCol = 1;
16 }
17 float brr = (float) Math::random() * 0.4f + 0.6f;
18 this->rCol = ((float) (Math::random() * 0.2f) + 0.8f) * rCol * brr;
19 this->gCol = ((float) (Math::random() * 0.2f) + 0.8f) * gCol * brr;
20 this->bCol = ((float) (Math::random() * 0.2f) + 0.8f) * bCol * brr;
21 size *= 0.75f;
22 size *= scale;
23 oSize = size;
24
25 lifetime = (int) (8 / (Math::random() * 0.8 + 0.2));
26 lifetime = (int)(lifetime * scale);
27 noPhysics = false;
28}
29
30RedDustParticle::RedDustParticle(Level *level, double x, double y, double z, float rCol, float gCol, float bCol) : Particle(level, x, y, z, 0, 0, 0)
31{
32 init(level, x, y, z, 1, rCol, gCol, bCol);
33}
34
35RedDustParticle::RedDustParticle(Level *level, double x, double y, double z, float scale, float rCol, float gCol, float bCol) : Particle(level, x, y, z, 0, 0, 0)
36{
37 init(level, x, y, z, scale, rCol, gCol, bCol);
38}
39
40void RedDustParticle::render(Tesselator *t, float a, float xa, float ya, float za, float xa2, float za2)
41{
42 float l = ((age + a) / lifetime) * 32;
43 if (l < 0) l = 0;
44 if (l > 1) l = 1;
45
46 size = oSize * l;
47 Particle::render(t, a, xa, ya, za, xa2, za2);
48}
49
50void RedDustParticle::tick()
51{
52 xo = x;
53 yo = y;
54 zo = z;
55
56 if (age++ >= lifetime) remove();
57
58 setMiscTex(7 - age * 8 / lifetime);
59
60 move(xd, yd, zd);
61 if (y == yo)
62 {
63 xd *= 1.1;
64 zd *= 1.1;
65 }
66 xd *= 0.96f;
67 yd *= 0.96f;
68 zd *= 0.96f;
69
70 if (onGround)
71 {
72 xd *= 0.7f;
73 zd *= 0.7f;
74 }
75}