the game where you go into mines and start crafting! but for consoles (forked directly from smartcmd's github)
1#include "stdafx.h"
2#include "net.minecraft.world.level.h"
3#include "ReadOnlyChunkCache.h"
4#include "Biome.h"
5
6ReadOnlyChunkCache::ReadOnlyChunkCache(Level *level, ChunkStorage *storage)
7{
8 chunks = LevelChunkArray(LEN * LEN);
9 emptyPixels = byteArray(Level::CHUNK_TILE_COUNT);
10
11 this->level = level;
12 this->storage = storage;
13}
14
15ReadOnlyChunkCache::~ReadOnlyChunkCache()
16{
17 for(unsigned int i = 0; i < chunks.length; ++i)
18 delete chunks[i];
19
20 delete[] chunks.data;
21
22 delete[] emptyPixels.data;
23}
24
25bool ReadOnlyChunkCache::hasChunk(int x, int z)
26{
27 int slot = (x & LEN_MASK) | ((z & LEN_MASK) * LEN);
28 return chunks[slot] != NULL && (chunks[slot]->isAt(x, z));
29}
30
31LevelChunk *ReadOnlyChunkCache::create(int x, int z)
32{
33 return getChunk(x, z);
34}
35
36LevelChunk *ReadOnlyChunkCache::getChunk(int x, int z)
37{
38 int slot = (x & LEN_MASK) | ((z & LEN_MASK) * LEN);
39 // 4J - removed try/catch
40// try {
41 if (!hasChunk(x, z))
42 {
43 LevelChunk *newChunk = load(x, z);
44 if (newChunk == NULL)
45 {
46 newChunk = new EmptyLevelChunk(level, emptyPixels, x, z);
47 }
48 chunks[slot] = newChunk;
49 }
50 return chunks[slot];
51// } catch (Exception e) {
52// e.printStackTrace();
53// return null;
54// }
55}
56
57LevelChunk *ReadOnlyChunkCache::load(int x, int z)
58{
59 // 4J - remove try/catch
60// try {
61 return storage->load(level, x, z);
62// } catch (IOException e) {
63// e.printStackTrace();
64// return null;
65// }
66}
67 // 4J - TODO - was synchronized
68void ReadOnlyChunkCache::postProcess(ChunkSource *parent, int x, int z)
69{
70}
71
72bool ReadOnlyChunkCache::save(bool force, ProgressListener *progressListener)
73{
74 return true;
75}
76
77bool ReadOnlyChunkCache::tick()
78{
79 return false;
80}
81
82bool ReadOnlyChunkCache::shouldSave()
83{
84 return false;
85}
86
87wstring ReadOnlyChunkCache::gatherStats()
88{
89 return L"ReadOnlyChunkCache";
90}
91
92vector<Biome::MobSpawnerData *> *ReadOnlyChunkCache::getMobsAt(MobCategory *mobCategory, int x, int y, int z)
93{
94 return NULL;
95}
96
97TilePos *ReadOnlyChunkCache::findNearestMapFeature(Level *level, const wstring& featureName, int x, int y, int z)
98{
99 return NULL;
100}