the game where you go into mines and start crafting! but for consoles (forked directly from smartcmd's github)
at main 66 lines 1.9 kB view raw
1#include "stdafx.h" 2#include "FootstepParticle.h" 3#include "Textures.h" 4#include "Tesselator.h" 5#include "..\Minecraft.World\Mth.h" 6#include "..\Minecraft.World\net.minecraft.world.level.h" 7#include "ResourceLocation.h" 8 9ResourceLocation FootstepParticle::FOOTPRINT_LOCATION = ResourceLocation(TN_MISC_FOOTSTEP); 10 11FootstepParticle::FootstepParticle(Textures *textures, Level *level, double x, double y, double z) : Particle(level, x, y, z, 0, 0, 0) 12{ 13 // 4J added initialisers 14 life = 0; 15 lifeTime = 0; 16 17 this->textures = textures; 18 xd = yd = zd = 0; 19 lifeTime = 200; 20} 21 22void FootstepParticle::render(Tesselator *t, float a, float xa, float ya, float za, float xa2, float za2) 23{ 24 float time = (life + a) / lifeTime; 25 time = time * time; 26 27 float alpha = 2 - time * 2; 28 if (alpha > 1) alpha = 1; 29 alpha = alpha * 0.2f; 30 31 glDisable(GL_LIGHTING); 32 float r = 2 / 16.0f; 33 34 float xx = (float) (x - xOff); 35 float yy = (float) (y - yOff); 36 float zz = (float) (z - zOff); 37 38 float br = level->getBrightness(Mth::floor(x), Mth::floor(y), Mth::floor(z)); 39 40 textures->bindTexture(&FOOTPRINT_LOCATION); 41 glEnable(GL_BLEND); 42 glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA); 43 44 t->begin(); 45 t->color(br, br, br, alpha); 46 t->vertexUV((float)(xx - r), (float)( yy), (float)( zz + r), (float)( 0), (float)( 1)); 47 t->vertexUV((float)(xx + r), (float)( yy), (float)( zz + r), (float)( 1), (float)( 1)); 48 t->vertexUV((float)(xx + r), (float)( yy), (float)( zz - r), (float)( 1), (float)( 0)); 49 t->vertexUV((float)(xx - r), (float)( yy), (float)( zz - r), (float)( 0), (float)( 0)); 50 t->end(); 51 52 glDisable(GL_BLEND); 53 glEnable(GL_LIGHTING); 54 55} 56 57void FootstepParticle::tick() 58{ 59 life++; 60 if (life == lifeTime) remove(); 61} 62 63int FootstepParticle::getParticleTexture() 64{ 65 return ParticleEngine::ENTITY_PARTICLE_TEXTURE; 66}