the game where you go into mines and start crafting! but for consoles (forked directly from smartcmd's github)
at main 80 lines 2.4 kB view raw
1#include "stdafx.h" 2#include "..\Minecraft.World\Mth.h" 3#include "CreeperModel.h" 4#include "ModelPart.h" 5 6// 4J - added 7void CreeperModel::_init(float g) 8{ 9 int yo = 4; 10 11 head = new ModelPart(this, 0, 0); 12 head->addBox(-4, - 8, -4, 8, 8, 8, g); // Head 13 head->setPos(0, (float)(yo), 0); 14 15 hair = new ModelPart(this, 32, 0); 16 hair->addBox(-4, -8, -4, 8, 8, 8, g + 0.5f); // Head 17 hair->setPos(0, (float)(yo), 0); 18 19 body = new ModelPart(this, 16, 16); 20 body->addBox(-4, 0, -2, 8, 12, 4, g); // Body 21 body->setPos(0, (float)(yo), 0); 22 23 leg0 = new ModelPart(this, 0, 16); 24 leg0->addBox(-2, 0, -2, 4, 6, 4, g); // Leg0 25 leg0->setPos(-2, (float)(12 + yo), 4); 26 27 leg1 = new ModelPart(this, 0, 16); 28 leg1->addBox(-2, 0, -2, 4, 6, 4, g); // Leg1 29 leg1->setPos(2, (float)(12 + yo), 4); 30 31 leg2 = new ModelPart(this, 0, 16); 32 leg2->addBox(-2, 0, -2, 4, 6, 4, g); // Leg2 33 leg2->setPos(-2, (float)(12 + yo), -4); 34 35 leg3 = new ModelPart(this, 0, 16); 36 leg3->addBox(-2, 0, -2, 4, 6, 4, g); // Leg3 37 leg3->setPos(2, (float)(12 + yo), -4); 38 39 // 4J added - compile now to avoid random performance hit first time cubes are rendered 40 head->compile(1.0f/16.0f); 41 hair->compile(1.0f/16.0f); 42 body->compile(1.0f/16.0f); 43 leg0->compile(1.0f/16.0f); 44 leg1->compile(1.0f/16.0f); 45 leg2->compile(1.0f/16.0f); 46 leg3->compile(1.0f/16.0f); 47} 48 49CreeperModel::CreeperModel() : Model() 50{ 51 _init(0); 52} 53 54CreeperModel::CreeperModel(float g) : Model() 55{ 56 _init(g); 57} 58 59void CreeperModel::render(shared_ptr<Entity> entity, float time, float r, float bob, float yRot, float xRot, float scale, bool usecompiled) 60{ 61 setupAnim(time, r, bob, yRot, xRot, scale, entity); 62 63 head->render(scale, usecompiled); 64 body->render(scale, usecompiled); 65 leg0->render(scale, usecompiled); 66 leg1->render(scale, usecompiled); 67 leg2->render(scale, usecompiled); 68 leg3->render(scale, usecompiled); 69} 70 71void CreeperModel::setupAnim(float time, float r, float bob, float yRot, float xRot, float scale, shared_ptr<Entity> entity, unsigned int uiBitmaskOverrideAnim) 72{ 73 head->yRot = yRot / (float) (180 / PI); 74 head->xRot = xRot / (float) (180 / PI); 75 76 leg0->xRot = (Mth::cos(time * 0.6662f) * 1.4f) * r; 77 leg1->xRot = (Mth::cos(time * 0.6662f + PI) * 1.4f) * r; 78 leg2->xRot = (Mth::cos(time * 0.6662f + PI) * 1.4f) * r; 79 leg3->xRot = (Mth::cos(time * 0.6662f) * 1.4f) * r; 80}