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