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\Mth.h"
3#include "NoteParticle.h"
4
5void NoteParticle::init(Level *level, double x, double y, double z, double xa, double ya, double za, float scale)
6{
7 xd *= 0.01f;
8 yd *= 0.01f;
9 zd *= 0.01f;
10 yd += 0.2;
11
12 /*
13 unsigned int cMin = Minecraft::GetInstance()->getColourTable()->getColor( eMinecraftColour_Particle_NoteMin );
14 unsigned int cMax = Minecraft::GetInstance()->getColourTable()->getColor( eMinecraftColour_Particle_NoteMax );
15 double rMin = ( (cMin>>16)&0xFF )/255.0f, gMin = ( (cMin>>8)&0xFF )/255.0, bMin = ( cMin&0xFF )/255.0;
16 double rMax = ( (cMax>>16)&0xFF )/255.0f, gMax = ( (cMax>>8)&0xFF )/255.0, bMax = ( cMax&0xFF )/255.0;
17
18 rCol = Mth::sin(((float) xa + 0.0f / 3) * PI * 2) * (rMax - rMin) + rMin;
19 gCol = Mth::sin(((float) xa + 1.0f / 3) * PI * 2) * (gMax - gMin) + gMin;
20 bCol = Mth::sin(((float) xa + 2.0f / 3) * PI * 2) * (bMax - bMin) + bMin;
21 */
22
23 // 4J-JEV: Added,
24 // There are 24 valid colours for this particle input through the 'xa' field (0.0-1.0).
25 int note = (int) floor(0.5 + (xa*24.0)) + (int) eMinecraftColour_Particle_Note_00;
26 unsigned int col = Minecraft::GetInstance()->getColourTable()->getColor( (eMinecraftColour) note );
27
28 rCol = ( (col>>16)&0xFF )/255.0;
29 gCol = ( (col>>8)&0xFF )/255.0;
30 bCol = ( col&0xFF )/255.0;
31
32 size *= 0.75f;
33 size *= scale;
34 oSize = size;
35
36 lifetime = 6;
37 noPhysics = false;
38
39
40 setMiscTex(16 * 4);
41}
42
43NoteParticle::NoteParticle(Level *level, double x, double y, double z, double xa, double ya, double za) : Particle(level, x, y, z, 0, 0, 0)
44{
45 init(level, x, y, z, xa, ya, za, 2);
46}
47
48NoteParticle::NoteParticle(Level *level, double x, double y, double z, double xa, double ya, double za, float scale) : Particle(level, x, y, z, 0, 0, 0)
49{
50 init(level, x, y, z, xa, ya, za, scale);
51}
52
53void NoteParticle::render(Tesselator *t, float a, float xa, float ya, float za, float xa2, float za2)
54{
55 float l = ((age + a) / lifetime) * 32;
56 if (l < 0) l = 0;
57 if (l > 1) l = 1;
58
59 size = oSize * l;
60 Particle::render(t, a, xa, ya, za, xa2, za2);
61}
62
63void NoteParticle::tick()
64{
65 xo = x;
66 yo = y;
67 zo = z;
68
69 if (age++ >= lifetime) remove();
70
71 move(xd, yd, zd);
72 if (y == yo)
73 {
74 xd *= 1.1;
75 zd *= 1.1;
76 }
77 xd *= 0.66f;
78 yd *= 0.66f;
79 zd *= 0.66f;
80
81 if (onGround)
82 {
83 xd *= 0.7f;
84 zd *= 0.7f;
85 }
86
87}