Fixed rendering of new height and depth limit in 1.18

This commit is contained in:
Andrew Francis Thomas 2021-12-15 15:26:45 -07:00
parent 7171af5873
commit a24ad4cb55
4 changed files with 13 additions and 13 deletions

View File

@ -178,7 +178,7 @@ bool load_chunk(RenderState* state, int32_t x, int32_t z, uint8_t required) {
if (!ycoord)
continue;
sectiony = PyLong_AsLong(ycoord);
sectiony = PyLong_AsLong(ycoord) + 4;
if (sectiony >= 0 && sectiony < SECTIONS_PER_CHUNK)
load_chunk_section(dest, sectiony, section);
}
@ -353,7 +353,7 @@ generate_pseudo_data(RenderState* state, uint16_t ancilData) {
/* calculate the global block coordinates of this position */
wx = (state->chunkx * 16) + x;
wz = (state->chunkz * 16) + z;
wy = (state->chunky * 16) + y;
wy = ((state->chunky - 4) * 16) + y;
/* lilypads orientation is obtained with these magic numbers */
/* magic numbers obtained from: */
/* http://llbit.se/?p=1537 */

View File

@ -31,7 +31,7 @@
// increment this value if you've made a change to the c extension
// and want to force users to rebuild
#define OVERVIEWER_EXTENSION_VERSION 107
#define OVERVIEWER_EXTENSION_VERSION 108
#include <stdbool.h>
#include <stdint.h>
@ -78,7 +78,7 @@ PyObject* resize_half_wrap(PyObject* self, PyObject* args);
typedef struct _RenderMode RenderMode;
/* in iterate.c */
#define SECTIONS_PER_CHUNK 16
#define SECTIONS_PER_CHUNK 24
typedef struct {
/* whether this chunk is loaded: use load_chunk to load */
int32_t loaded;

View File

@ -1081,7 +1081,7 @@ class TileSet(object):
max_chunk_mtime = 0
for col, row, chunkx, chunky, chunkz, chunk_mtime in chunks:
xpos = -192 + (col - colstart) * 192
ypos = -96 + (row - rowstart) * 96 + (16 - 1 - chunky) * 192
ypos = -96 + (row - rowstart) * 96 + (24 - 1 - chunky) * 192
if chunk_mtime > max_chunk_mtime:
max_chunk_mtime = chunk_mtime
@ -1324,12 +1324,12 @@ def get_tiles_by_chunk(chunkcol, chunkrow):
colrange = (tilecol,)
# If this chunk is in a row divisible by 4, then it touches the
# tile above it as well. Also touches the next 4 tiles down (16
# tile above it as well. Also touches the next 6 tiles down (24
# rows)
if chunkrow % 4 == 0:
rowrange = range(tilerow - 4, tilerow + 32 + 1, 4)
rowrange = range(tilerow - 4, tilerow + 48 + 1, 4)
else:
rowrange = range(tilerow, tilerow + 32 + 1, 4)
rowrange = range(tilerow, tilerow + 48 + 1, 4)
return product(colrange, rowrange)
@ -1360,12 +1360,12 @@ def get_chunks_by_tile(tile, regionset):
# First do the odd. For each chunk in the tile's odd column the tile
# "passes through" three chunk sections.
oddcol_sections = []
for i, y in enumerate(reversed(range(16))):
for i, y in enumerate(reversed(range(24))):
for row in range(tile.row + 3 - i * 2, tile.row - 2 - i * 2, -2):
oddcol_sections.append((tile.col + 1, row, y))
evencol_sections = []
for i, y in enumerate(reversed(range(16))):
for i, y in enumerate(reversed(range(24))):
for row in range(tile.row + 4 - i * 2, tile.row - 3 - i * 2, -2):
evencol_sections.append((tile.col + 2, row, y))
evencol_sections.append((tile.col, row, y))

View File

@ -200,8 +200,8 @@ class World(object):
## clamp spawnY to a sane value, in-chunk value
if spawnY < 0:
spawnY = 0
if spawnY > 255:
spawnY = 255
if spawnY > 319:
spawnY = 319
## The chunk that holds the spawn location
chunkX = spawnX//16
@ -236,7 +236,7 @@ class World(object):
spawnY += 1
# Next section, start at local 0
inChunkY = 0
return spawnX, 256, spawnZ
return spawnX, 320, spawnZ
class RegionSet(object):
"""This object is the gateway to a particular Minecraft dimension within a