the game where you go into mines and start crafting! but for consoles (forked directly from smartcmd's github)
at main 73 lines 1.7 kB view raw
1#include "stdafx.h" 2#include "..\Minecraft.World\JavaMath.h" 3#include "..\Minecraft.World\Random.h" 4#include "FlameParticle.h" 5 6FlameParticle::FlameParticle(Level *level, double x, double y, double z, double xd, double yd, double zd) : Particle(level, x, y, z, xd, yd, zd) 7{ 8 this->xd=this->xd*0.01f+xd; 9 this->yd=this->yd*0.01f+yd; 10 this->zd=this->zd*0.01f+zd; 11 x+=(random->nextFloat()-random->nextFloat())*0.05f; 12 y+=(random->nextFloat()-random->nextFloat())*0.05f; 13 z+=(random->nextFloat()-random->nextFloat())*0.05f; 14 15 oSize = size; 16 rCol = gCol = bCol = 1.0f; 17 18 lifetime = (int)(8/(Math::random()*0.8+0.2))+4; 19 noPhysics = true; 20 setMiscTex(48); 21} 22 23void FlameParticle::render(Tesselator *t, float a, float xa, float ya, float za, float xa2, float za2) 24{ 25 float s = (age + a) / (float) lifetime; 26 size = oSize * (1 - s*s*0.5f); 27 Particle::render(t, a, xa, ya, za, xa2, za2); 28} 29 30// 4J - brought forward from 1.8.2 31int FlameParticle::getLightColor(float a) 32{ 33 float l = (age + a) / lifetime; 34 if (l < 0) l = 0; 35 if (l > 1) l = 1; 36 int br = Particle::getLightColor(a); 37 38 int br1 = (br) & 0xff; 39 int br2 = (br >> 16) & 0xff; 40 br1 += (int) (l * 15 * 16); 41 if (br1 > 15 * 16) br1 = 15 * 16; 42 return br1 | br2 << 16; 43} 44 45float FlameParticle::getBrightness(float a) 46{ 47 float l = (age+a)/lifetime; 48 if (l<0) l = 0; 49 if (l>1) l = 1; 50 float br = Particle::getBrightness(a); 51 52 return br*l+(1-l); 53} 54 55void FlameParticle::tick() 56{ 57 xo = x; 58 yo = y; 59 zo = z; 60 61 if (age++ >= lifetime) remove(); 62 63 move(xd, yd, zd); 64 xd *= 0.96f; 65 yd *= 0.96f; 66 zd *= 0.96f; 67 68 if (onGround) 69 { 70 xd *= 0.7f; 71 zd *= 0.7f; 72 } 73}