the game where you go into mines and start crafting! but for consoles (forked directly from smartcmd's github)
at main 65 lines 1.4 kB view raw
1#include "stdafx.h" 2#include "..\Minecraft.World\IntBuffer.h" 3#include "OffsettedRenderList.h" 4 5// 4J added 6OffsettedRenderList::OffsettedRenderList() 7{ 8 x = y = z = 0; 9 xOff = yOff = zOff = 0; 10 lists = MemoryTracker::createIntBuffer(1024 * 64); 11 inited = false; 12 rendered = false; 13} 14 15void OffsettedRenderList::init(int x, int y, int z, double xOff, double yOff, double zOff) 16{ 17 inited = true; 18 lists->clear(); 19 this->x = x; 20 this->y = y; 21 this->z = z; 22 23 this->xOff = (float) xOff; 24 this->yOff = (float) yOff; 25 this->zOff = (float) zOff; 26} 27 28bool OffsettedRenderList::isAt(int x, int y, int z) 29{ 30 if (!inited) return false; 31 return x == this->x && y == this->y && z == this->z; 32} 33 34void OffsettedRenderList::add(int list) 35{ 36 // 4J - added - chunkList::getList returns -1 when chunks aren't visible, we really don't want to end up sending that to glCallLists 37 if( list >= 0 ) 38 { 39 lists->put(list); 40 } 41 if (lists->remaining() == 0) render(); 42} 43 44void OffsettedRenderList::render() 45{ 46 if (!inited) return; 47 if (!rendered) 48 { 49 lists->flip(); 50 rendered = true; 51 } 52 if (lists->remaining() > 0) 53 { 54 glPushMatrix(); 55 glTranslatef(x - xOff, y - yOff, z - zOff); 56 glCallLists(lists); 57 glPopMatrix(); 58 } 59} 60 61void OffsettedRenderList::clear() 62{ 63 inited = false; 64 rendered = false; 65}