the game where you go into mines and start crafting! but for consoles (forked directly from smartcmd's github)
at main 80 lines 2.1 kB view raw
1#include "stdafx.h" 2#include "TakeAnimationParticle.h" 3#include "EntityRenderDispatcher.h" 4#include "..\Minecraft.World\net.minecraft.world.item.h" 5#include "..\Minecraft.World\net.minecraft.world.level.h" 6#include "..\Minecraft.World\Mth.h" 7 8TakeAnimationParticle::TakeAnimationParticle(Level *level, shared_ptr<Entity> item, shared_ptr<Entity> target, float yOffs) : Particle(level, item->x, item->y, item->z, item->xd, item->yd, item->zd) 9{ 10 // 4J - added initialisers 11 life = 0; 12 lifeTime = 0; 13 14 this->item = item; 15 16 this->target = target; 17 lifeTime = 3; 18 this->yOffs = yOffs; 19 20} 21 22TakeAnimationParticle::~TakeAnimationParticle() 23{ 24} 25 26void TakeAnimationParticle::render(Tesselator *t, float a, float xa, float ya, float za, float xa2, float za2) 27{ 28 float time = (life + a) / lifeTime; 29 time = time*time; 30 31 double xo = item->x; 32 double yo = item->y; 33 double zo = item->z; 34 35 double xt = target->xOld + (target->x - target->xOld) * a; 36 double yt = target->yOld + (target->y - target->yOld) * a+yOffs; 37 double zt = target->zOld + (target->z - target->zOld) * a; 38 39 double xx = xo + (xt - xo) * time; 40 double yy = yo + (yt - yo) * time; 41 double zz = zo + (zt - zo) * time; 42 43 int xTile = Mth::floor(xx); 44 int yTile = Mth::floor(yy + heightOffset / 2.0f); 45 int zTile = Mth::floor(zz); 46 47 // 4J - change brought forward from 1.8.2 48 if (SharedConstants::TEXTURE_LIGHTING) 49 { 50 int col = getLightColor(a); 51 int u = col%65536; 52 int v = col/65536; 53 glMultiTexCoord2f(GL_TEXTURE1, u/1.0f, v/1.0f); 54 glColor4f(1, 1, 1, 1); 55 } 56 else 57 { 58 float br = level->getBrightness(xTile, yTile, zTile); 59 glColor4f(br, br, br, 1); 60 } 61 62 xx-=xOff; 63 yy-=yOff; 64 zz-=zOff; 65 66 67 EntityRenderDispatcher::instance->render(item, (float)xx, (float)yy, (float)zz, item->yRot, a); 68 69} 70 71void TakeAnimationParticle::tick() 72{ 73 life++; 74 if (life == lifeTime) remove(); 75} 76 77int TakeAnimationParticle::getParticleTexture() 78{ 79 return ParticleEngine::ENTITY_PARTICLE_TEXTURE; 80}