the game where you go into mines and start crafting! but for consoles (forked directly from smartcmd's github)
at main 61 lines 2.2 kB view raw
1#include "stdafx.h" 2#include "SpiderRenderer.h" 3#include "SpiderModel.h" 4#include "..\Minecraft.World\net.minecraft.world.entity.monster.h" 5 6ResourceLocation SpiderRenderer::SPIDER_LOCATION = ResourceLocation(TN_MOB_SPIDER); 7ResourceLocation SpiderRenderer::SPIDER_EYES_LOCATION = ResourceLocation(TN_MOB_SPIDER_EYES); 8 9SpiderRenderer::SpiderRenderer() : MobRenderer(new SpiderModel(), 1.0f) 10{ 11 this->setArmor(new SpiderModel()); 12} 13 14float SpiderRenderer::getFlipDegrees(shared_ptr<LivingEntity> spider) 15{ 16 return 180; 17} 18 19int SpiderRenderer::prepareArmor(shared_ptr<LivingEntity> _spider, int layer, float a) 20{ 21 // 4J - dynamic cast required because we aren't using templates/generics in our version 22 shared_ptr<Spider> spider = dynamic_pointer_cast<Spider>(_spider); 23 24 if (layer!=0) return -1; 25 MemSect(31); 26 bindTexture(&SPIDER_EYES_LOCATION); 27 MemSect(0); 28 // 4J - changes brought forward from 1.8.2 29 float br = 1.0f; // was (1-spider->getBrightness(1))*0.5f; 30 glEnable(GL_BLEND); 31 // 4J Stu - We probably don't need to do this on 360 either (as we force it back on the renderer) 32 // However we do want it off for other platforms that don't force it on in the render lib CBuff handling 33 // Several texture packs have fully transparent bits that break if this is off 34#ifdef _XBOX 35 glDisable(GL_ALPHA_TEST); 36#endif 37 // 4J - changes brought forward from 1.8.2 38 glBlendFunc(GL_ONE, GL_ONE); 39 if (spider->isInvisible()) glDepthMask(false); 40 else glDepthMask(true); 41 42 if (SharedConstants::TEXTURE_LIGHTING) 43 { 44 // 4J - was 0xf0f0 but that looks like it is a mistake - maybe meant to be 0xf000f0 to enable both sky & block lighting? choosing 0x00f0 here instead 45 // as most likely replicates what the java game does, without breaking our lighting (which doesn't like UVs out of the 0 to 255 range) 46 int col = 0x00f0; 47 int u = col % 65536; 48 int v = col / 65536; 49 50 glMultiTexCoord2f(GL_TEXTURE1, u / 1.0f, v / 1.0f); 51 glColor4f(1, 1, 1, 1); 52 } 53 // 4J - this doesn't seem right - surely there should be an else in here? 54 glColor4f(1, 1, 1, br); 55 return 1; 56} 57 58ResourceLocation *SpiderRenderer::getTextureLocation(shared_ptr<Entity> mob) 59{ 60 return &SPIDER_LOCATION; 61}