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 "NetherPortalParticle.h"
3#include "..\Minecraft.World\JavaMath.h"
4#include "..\Minecraft.World\Random.h"
5#include "Minecraft.h"
6
7// 4J Stu - This class was originally "PortalParticle" but I have split the two uses of the particle
8// Only the nether portal uses this particle
9
10NetherPortalParticle::NetherPortalParticle(Level *level, double x, double y, double z, double xd, double yd, double zd) : Particle(level, x, y, z, xd, yd, zd)
11{
12 this->xd = xd;
13 this->yd = yd;
14 this->zd = zd;
15 this->xStart = this->x = x;
16 this->yStart = this->y = y;
17 this->zStart = this->z = z;
18
19 float br = random->nextFloat()*0.6f+0.4f;
20 oSize = size = random->nextFloat()*0.2f+0.5f;
21 //rCol = gCol = bCol = 1.0f*br;
22 //gCol *= 0.3f;
23 //rCol *= 0.9f;
24
25 // Default colour (0.9f, 0.3f, 1.0f)
26 // 0xE64DFF
27
28 unsigned int colour = Minecraft::GetInstance()->getColourTable()->getColor( eMinecraftColour_Particle_NetherPortal );
29 int r = (colour>>16)&0xFF;
30 int g = (colour>>8)&0xFF;
31 int b = colour&0xFF;
32 rCol = (r/255.0f)*br;
33 gCol = (g/255.0f)*br;
34 bCol = (b/255.0f)*br;
35
36 lifetime = (int) (Math::random()*10) + 40;
37 noPhysics = true;
38 setMiscTex((int)(Math::random()*8));
39}
40
41void NetherPortalParticle::render(Tesselator *t, float a, float xa, float ya, float za, float xa2, float za2)
42{
43 float s = (age + a) / (float) lifetime;
44 s = 1-s;
45 s = s*s;
46 s = 1-s;
47 size = oSize * (s);
48 Particle::render(t, a, xa, ya, za, xa2, za2);
49}
50
51// 4J - brought forward from 1.8.2
52int NetherPortalParticle::getLightColor(float a)
53{
54 int br = Particle::getLightColor(a);
55
56 float pos = age/(float)lifetime;
57 pos = pos*pos;
58 pos = pos*pos;
59
60 int br1 = (br) & 0xff;
61 int br2 = (br >> 16) & 0xff;
62 br2 += (int) (pos * 15 * 16);
63 if (br2 > 15 * 16) br2 = 15 * 16;
64 return br1 | br2 << 16;
65}
66
67float NetherPortalParticle::getBrightness(float a)
68{
69 float br = Particle::getBrightness(a);
70 float pos = age/(float)lifetime;
71 pos = pos*pos;
72 pos = pos*pos;
73 return br*(1-pos)+pos;
74}
75
76void NetherPortalParticle::tick()
77{
78 xo = x;
79 yo = y;
80 zo = z;
81
82 float pos = age/(float)lifetime;
83 float a = pos;
84 pos = -pos+pos*pos*2;
85// pos = pos*pos;
86// pos = pos*pos;
87 pos = 1-pos;
88
89 x = xStart+xd*pos;
90 y = yStart+yd*pos+(1-a);
91 z = zStart+zd*pos;
92
93
94// spd+=0.002/lifetime*age;
95
96 if (age++ >= lifetime) remove();
97
98// move(xd*spd, yd*spd, zd*spd);
99}