the game where you go into mines and start crafting! but for consoles (forked directly from smartcmd's github)
at main 94 lines 2.5 kB view raw
1#include "stdafx.h" 2#include "EnderParticle.h" 3#include "..\Minecraft.World\JavaMath.h" 4#include "..\Minecraft.World\Random.h" 5 6// 4J Stu - This class was originally "PortalParticle" but I have split the two uses of the particle 7// End creatures/items (e.g. EnderMan, EyeOfEnder, etc) use this particle 8 9EnderParticle::EnderParticle(Level *level, double x, double y, double z, double xd, double yd, double zd) : Particle(level, x, y, z, xd, yd, zd) 10{ 11 this->xd = xd; 12 this->yd = yd; 13 this->zd = zd; 14 this->xStart = this->x = x; 15 this->yStart = this->y = y; 16 this->zStart = this->z = z; 17 18 // 4J-JEV: Set particle colour from colour-table. 19 unsigned int col = Minecraft::GetInstance()->getColourTable()->getColor( eMinecraftColour_Particle_Ender ); //0xE54CFF 20 rCol = ( (col>>16)&0xFF )/255.0f, gCol = ( (col>>8)&0xFF )/255.0, bCol = ( col&0xFF )/255.0; 21 22 float br = random->nextFloat() * 0.6f + 0.4f; 23 rCol *= br; gCol *= br; bCol *= br; 24 25 //rCol = gCol = bCol = 1.0f*br; 26 //gCol *= 0.3f; 27 //rCol *= 0.9f; 28 29 oSize = size = random->nextFloat()*0.2f+0.5f; 30 31 lifetime = (int) (Math::random()*10) + 40; 32 noPhysics = true; 33 setMiscTex((int)(Math::random()*8)); 34} 35 36void EnderParticle::render(Tesselator *t, float a, float xa, float ya, float za, float xa2, float za2) 37{ 38 float s = (age + a) / (float) lifetime; 39 s = 1-s; 40 s = s*s; 41 s = 1-s; 42 size = oSize * (s); 43 Particle::render(t, a, xa, ya, za, xa2, za2); 44} 45 46// 4J - brought forward from 1.8.2 47int EnderParticle::getLightColor(float a) 48{ 49 int br = Particle::getLightColor(a); 50 51 float pos = age/(float)lifetime; 52 pos = pos*pos; 53 pos = pos*pos; 54 55 int br1 = (br) & 0xff; 56 int br2 = (br >> 16) & 0xff; 57 br2 += (int) (pos * 15 * 16); 58 if (br2 > 15 * 16) br2 = 15 * 16; 59 return br1 | br2 << 16; 60} 61 62float EnderParticle::getBrightness(float a) 63{ 64 float br = Particle::getBrightness(a); 65 float pos = age/(float)lifetime; 66 pos = pos*pos; 67 pos = pos*pos; 68 return br*(1-pos)+pos; 69} 70 71void EnderParticle::tick() 72{ 73 xo = x; 74 yo = y; 75 zo = z; 76 77 float pos = age/(float)lifetime; 78 float a = pos; 79 pos = -pos+pos*pos*2; 80// pos = pos*pos; 81// pos = pos*pos; 82 pos = 1-pos; 83 84 x = xStart+xd*pos; 85 y = yStart+yd*pos+(1-a); 86 z = zStart+zd*pos; 87 88 89// spd+=0.002/lifetime*age; 90 91 if (age++ >= lifetime) remove(); 92 93// move(xd*spd, yd*spd, zd*spd); 94}