the game where you go into mines and start crafting! but for consoles (forked directly from smartcmd's github)
at main 61 lines 1.8 kB view raw
1#include "stdafx.h" 2#include "CritParticle.h" 3#include "..\Minecraft.World\net.minecraft.world.entity.h" 4#include "..\Minecraft.World\Random.h" 5#include "..\Minecraft.World\net.minecraft.world.phys.h" 6#include "..\Minecraft.World\net.minecraft.world.level.h" 7 8void CritParticle::_init(Level *level, shared_ptr<Entity> entity, ePARTICLE_TYPE type) 9{ 10 life = 0; 11 this->entity = entity; 12 lifeTime = 3; 13 particleName = type; 14 // 4J-PB - can't use a shared_from_this in the constructor 15 //tick(); 16} 17 18CritParticle::CritParticle(Level *level, shared_ptr<Entity> entity) : Particle(level, entity->x, entity->bb->y0 + entity->bbHeight / 2, entity->z, entity->xd, entity->yd, entity->zd) 19{ 20 _init(level,entity,eParticleType_crit); 21} 22 23CritParticle::CritParticle(Level *level, shared_ptr<Entity> entity, ePARTICLE_TYPE type) : Particle(level, entity->x, entity->bb->y0 + entity->bbHeight / 2, entity->z, entity->xd, entity->yd, entity->zd) 24{ 25 _init(level, entity, type); 26} 27 28// 4J - Added this so that we can use some shared_ptr functions that were needed in the ctor 29void CritParticle::CritParticlePostConstructor(void) 30{ 31 tick(); 32} 33 34void CritParticle::render(Tesselator *t, float a, float xa, float ya, float za, float xa2, float za2) 35{ 36} 37 38void CritParticle::tick() 39{ 40 for (int i=0; i<16; i++) 41 { 42 double xa = random->nextFloat()*2-1; 43 double ya = random->nextFloat()*2-1; 44 double za = random->nextFloat()*2-1; 45 if (xa*xa+ya*ya+za*za>1) continue; 46 double x = entity->x+xa*entity->bbWidth/4; 47 double y = entity->bb->y0+entity->bbHeight/2+ya*entity->bbHeight/4; 48 double z = entity->z+za*entity->bbWidth/4; 49 level->addParticle(particleName, x, y, z, xa, ya+0.2, za); 50 } 51 life++; 52 if (life >= lifeTime) 53 { 54 remove(); 55 } 56} 57 58int CritParticle::getParticleTexture() 59{ 60 return ParticleEngine::ENTITY_PARTICLE_TEXTURE; 61}