the game where you go into mines and start crafting! but for consoles (forked directly from smartcmd's github)
at main 64 lines 2.5 kB view raw
1#include "stdafx.h" 2#include "BreakingItemParticle.h" 3#include "Tesselator.h" 4#include "..\Minecraft.World\net.minecraft.world.level.tile.h" 5#include "..\Minecraft.World\net.minecraft.world.item.h" 6#include "..\Minecraft.World\net.minecraft.world.h" 7 8void BreakingItemParticle::_init(Item *item, Textures *textures, int data) 9{ 10 this->setTex(textures, item->getIcon(data)); 11 rCol = gCol = bCol = 1.0f; 12 gravity = Tile::snow->gravity; 13 size /= 2; 14} 15 16BreakingItemParticle::BreakingItemParticle(Level *level, double x, double y, double z, Item *item, Textures *textures, int data) : Particle(level, x, y, z, 0, 0, 0) 17{ 18 _init(item, textures, data); 19} 20 21BreakingItemParticle::BreakingItemParticle(Level *level, double x, double y, double z, double xa, double ya, double za, Item *item, Textures *textures, int data) : Particle(level, x, y, z, 0, 0, 0) 22{ 23 _init(item, textures, data); 24 xd *= 0.1f; 25 yd *= 0.1f; 26 zd *= 0.1f; 27 xd += xa; 28 yd += ya; 29 zd += za; 30} 31 32int BreakingItemParticle::getParticleTexture() 33{ 34 return ParticleEngine::ITEM_TEXTURE; 35} 36 37void BreakingItemParticle::render(Tesselator *t, float a, float xa, float ya, float za, float xa2, float za2) 38{ 39 float u0 = (texX + uo / 4.0f) / 16.0f; 40 float u1 = u0 + 0.999f / 16.0f / 4; 41 float v0 = (texY + vo / 4.0f) / 16.0f; 42 float v1 = v0 + 0.999f / 16.0f / 4; 43 float r = 0.1f * size; 44 45 if (tex != NULL) 46 { 47 u0 = tex->getU((uo / 4.0f) * SharedConstants::WORLD_RESOLUTION); 48 u1 = tex->getU(((uo + 1) / 4.0f) * SharedConstants::WORLD_RESOLUTION); 49 v0 = tex->getV((vo / 4.0f) * SharedConstants::WORLD_RESOLUTION); 50 v1 = tex->getV(((vo + 1) / 4.0f) * SharedConstants::WORLD_RESOLUTION); 51 } 52 53 float x = (float) (xo + (this->x - xo) * a - xOff); 54 float y = (float) (yo + (this->y - yo) * a - yOff); 55 float z = (float) (zo + (this->z - zo) * a - zOff); 56 float br = SharedConstants::TEXTURE_LIGHTING ? 1 : getBrightness(a); // 4J - change brought forward from 1.8.2 57 t->color(br * rCol, br * gCol, br * bCol); 58 59 t->vertexUV((float)(x - xa * r - xa2 * r), (float)( y - ya * r), (float)( z - za * r - za2 * r), (float)( u0), (float)( v1)); 60 t->vertexUV((float)(x - xa * r + xa2 * r), (float)( y + ya * r), (float)( z - za * r + za2 * r), (float)( u0), (float)( v0)); 61 t->vertexUV((float)(x + xa * r + xa2 * r), (float)( y + ya * r), (float)( z + za * r + za2 * r), (float)( u1), (float)( v0)); 62 t->vertexUV((float)(x + xa * r - xa2 * r), (float)( y - ya * r), (float)( z + za * r - za2 * r), (float)( u1), (float)( v1)); 63 64}