the game where you go into mines and start crafting! but for consoles (forked directly from smartcmd's github)
at main 71 lines 1.7 kB view raw
1#include "stdafx.h" 2#include "..\Minecraft.World\JavaMath.h" 3#include "EchantmentTableParticle.h" 4 5EchantmentTableParticle::EchantmentTableParticle(Level *level, double x, double y, double z, double xd, double yd, double zd) : Particle(level, x, y, z, xd, yd, zd) 6{ 7 this->xd = xd; 8 this->yd = yd; 9 this->zd = zd; 10 this->xStart = this->x = x; 11 this->yStart = this->y = y; 12 this->zStart = this->z = z; 13 14 unsigned int clr = Minecraft::GetInstance()->getColourTable()->getColor( eMinecraftColour_Particle_EnchantmentTable ); //0xE5E5FF 15 double r = ( (clr>>16)&0xFF )/255.0f, g = ( (clr>>8)&0xFF )/255.0, b = ( clr&0xFF )/255.0; 16 17 float br = random->nextFloat() * 0.6f + 0.4f; 18 rCol = r * br; 19 gCol = g * br; 20 bCol = b * br; 21 22 oSize = size = random->nextFloat() * 0.5f + 0.2f; 23 24 lifetime = (int) (Math::random() * 10) + 30; 25 noPhysics = true; 26 setMiscTex( (int) (Math::random() * 26 + 1 + 14 * 16) ); 27} 28 29int EchantmentTableParticle::getLightColor(float a) 30{ 31 int br = Particle::getLightColor(a); 32 33 float pos = age / (float) lifetime; 34 pos = pos * pos; 35 pos = pos * pos; 36 37 int br1 = (br) & 0xff; 38 int br2 = (br >> 16) & 0xff; 39 br2 += (int) (pos * 15 * 16); 40 if (br2 > 15 * 16) br2 = 15 * 16; 41 return br1 | br2 << 16; 42} 43 44float EchantmentTableParticle::getBrightness(float a) 45{ 46 float br = Particle::getBrightness(a); 47 float pos = age / (float) lifetime; 48 pos = pos * pos; 49 pos = pos * pos; 50 return br * (1 - pos) + pos; 51} 52 53void EchantmentTableParticle::tick() 54{ 55 xo = x; 56 yo = y; 57 zo = z; 58 59 float pos = age / (float) lifetime; 60 61 pos = 1 - pos; 62 63 float pp = 1 - pos; 64 pp = pp * pp; 65 pp = pp * pp; 66 x = xStart + xd * pos; 67 y = yStart + yd * pos - pp * 1.2f; 68 z = zStart + zd * pos; 69 70 if (age++ >= lifetime) remove(); 71}