the game where you go into mines and start crafting! but for consoles (forked directly from smartcmd's github)
at main 58 lines 1.9 kB view raw
1#include "stdafx.h" 2#include "TntRenderer.h" 3#include "TextureAtlas.h" 4#include "TileRenderer.h" 5#include "..\Minecraft.World\net.minecraft.world.entity.item.h" 6#include "..\Minecraft.World\net.minecraft.world.level.tile.h" 7 8TntRenderer::TntRenderer() 9{ 10 renderer = new TileRenderer(); 11 this->shadowRadius = 0.5f; 12} 13 14void TntRenderer::render(shared_ptr<Entity> _tnt, double x, double y, double z, float rot, float a) 15{ 16 // 4J - dynamic cast required because we aren't using templates/generics in our version 17 shared_ptr<PrimedTnt> tnt = dynamic_pointer_cast<PrimedTnt>(_tnt); 18 19 glPushMatrix(); 20 glTranslatef((float) x, (float) y, (float) z); 21 if (tnt->life - a + 1 < 10) 22 { 23 float g = 1 - ((tnt->life - a + 1) / 10.0f); 24 if (g < 0) g = 0; 25 if (g > 1) g = 1; 26 g = g * g; 27 g = g * g; 28 float s = 1.0f + g * 0.3f; 29 glScalef(s, s, s); 30 } 31 32 float br = (1 - ((tnt->life - a + 1) / 100.0f)) * 0.8f; 33 bindTexture(tnt); 34 // 4J - change brought forward from 1.8.2 35 float brightness = SharedConstants::TEXTURE_LIGHTING ? 1.0f : tnt->getBrightness(a); 36 renderer->renderTile(Tile::tnt, 0, brightness); 37 if (tnt->life / 5 % 2 == 0) 38 { 39 glDisable(GL_TEXTURE_2D); 40 glDisable(GL_LIGHTING); 41 glEnable(GL_BLEND); 42 glBlendFunc(GL_SRC_ALPHA, GL_DST_ALPHA); 43 glColor4f(1, 1, 1, br); 44 renderer->setColor = false; // 4J added so that renderTile doesn't set its own colour here 45 renderer->renderTile(Tile::tnt, 0, 1); 46 renderer->setColor = true; // 4J added so that renderTile doesn't set its own colour here 47 glColor4f(1, 1, 1, 1); 48 glDisable(GL_BLEND); 49 glEnable(GL_LIGHTING); 50 glEnable(GL_TEXTURE_2D); 51 } 52 glPopMatrix(); 53} 54 55ResourceLocation *TntRenderer::getTextureLocation(shared_ptr<Entity> mob) 56{ 57 return &TextureAtlas::LOCATION_BLOCKS; 58}