the game where you go into mines and start crafting! but for consoles (forked directly from smartcmd's github)
at main 68 lines 1.4 kB view raw
1#include "stdafx.h" 2#include "PlayerCloudParticle.h" 3#include "..\Minecraft.World\JavaMath.h" 4#include "..\Minecraft.World\net.minecraft.world.level.h" 5#include "..\Minecraft.World\net.minecraft.world.entity.player.h" 6#include "..\Minecraft.World\net.minecraft.world.phys.h" 7 8PlayerCloudParticle::PlayerCloudParticle(Level *level, double x, double y, double z, double xa, double ya, double za) : Particle(level,x,y,z,0,0,0) 9{ 10 float scale = 2.5f; 11 xd *= 0.1f; 12 yd *= 0.1f; 13 zd *= 0.1f; 14 xd += xa; 15 yd += ya; 16 zd += za; 17 18 rCol = gCol = bCol = 1 - (float) (Math::random() * 0.3f); 19 size *= 0.75f; 20 size *= scale; 21 oSize = size; 22 23 lifetime = (int) (8 / (Math::random() * 0.8 + 0.3)); 24 lifetime *= scale; 25 noPhysics = false; 26} 27 28void PlayerCloudParticle::render(Tesselator *t, float a, float xa, float ya, float za, float xa2, float za2) 29{ 30 float l = ((age + a) / lifetime) * 32; 31 if (l < 0) l = 0; 32 if (l > 1) l = 1; 33 34 size = oSize * l; 35 Particle::render(t, a, xa, ya, za, xa2, za2); 36} 37 38void PlayerCloudParticle::tick() 39{ 40 xo = x; 41 yo = y; 42 zo = z; 43 44 if (age++ >= lifetime) remove(); 45 46 setMiscTex(7 - age * 8 / lifetime); 47 48 move(xd, yd, zd); 49 xd *= 0.96f; 50 yd *= 0.96f; 51 zd *= 0.96f; 52 shared_ptr<Player> p = level->getNearestPlayer(shared_from_this(), 2); 53 if (p != NULL) 54 { 55 if (y > p->bb->y0) 56 { 57 y+=(p->bb->y0-y)*0.2; 58 yd += (p->yd-yd)*0.2; 59 setPos(x, y, z); 60 } 61 } 62 63 if (onGround) 64 { 65 xd *= 0.7f; 66 zd *= 0.7f; 67 } 68}