From 0f017f6b519c6e9f8a30e281970880790becce98 Mon Sep 17 00:00:00 2001 From: Alejandro Aguilera Date: Sun, 7 Apr 2013 01:33:10 +0200 Subject: [PATCH] Lilypads are now properly oriented. --- overviewer_core/src/iterate.c | 17 ++++++++++++++++- overviewer_core/textures.py | 16 ++++++++++++---- 2 files changed, 28 insertions(+), 5 deletions(-) diff --git a/overviewer_core/src/iterate.c b/overviewer_core/src/iterate.c index 2bc0a23..ee88f69 100644 --- a/overviewer_core/src/iterate.c +++ b/overviewer_core/src/iterate.c @@ -402,6 +402,20 @@ generate_pseudo_data(RenderState *state, unsigned char ancilData) { } else { return check_adjacent_blocks(state, x, y, z, state->block); } + } else if (state->block == 111) { /* lilypads */ + int wx,wz,wy,rotation; + long pr; + /* calculate the global block coordinates of this position */ + wx = (state->chunkx * 16) + x; + wz = (state->chunkz * 16) + z; + wy = (state->chunky * 16) + y; + /* lilypads orientation is obtained with these magic numbers */ + /* magic numbers obtained from: */ + /* http://llbit.se/?p=1537 */ + pr = (wx * 3129871) ^ (wz * 116129781) ^ (wy); + pr = pr * pr * 42317861 + pr * 11; + rotation = 3 & (pr >> 16); + return rotation; } @@ -549,7 +563,8 @@ chunk_render(PyObject *self, PyObject *args) { (state.block == 71) || (state.block == 79) || (state.block == 85) || (state.block == 90) || (state.block == 101) || (state.block == 102) || - (state.block == 113) || (state.block == 139)) { + (state.block == 111) || (state.block == 113) || + (state.block == 139)) { ancilData = generate_pseudo_data(&state, ancilData); state.block_pdata = ancilData; } else { diff --git a/overviewer_core/textures.py b/overviewer_core/textures.py index 72db9c4..115a892 100644 --- a/overviewer_core/textures.py +++ b/overviewer_core/textures.py @@ -3433,12 +3433,20 @@ block(blockid=110, top_image="textures/blocks/mycel_top.png", side_image="textur # lilypad # At the moment of writing this lilypads has no ancil data and their -# orientation depends on their position on the map. Because lilypads had -# ancildata, leave some data values just in case an old map have some -# with ancil data. +# orientation depends on their position on the map. So it uses pseudo +# ancildata. @material(blockid=111, data=range(4), transparent=True) def lilypad(self, blockid, data): - t = self.load_image_texture("textures/blocks/waterlily.png") + t = self.load_image_texture("textures/blocks/waterlily.png").copy() + if data == 0: + t = t.rotate(180) + elif data == 1: + t = t.rotate(270) + elif data == 2: + t = t + elif data == 3: + t = t.rotate(90) + return self.build_full_block(None, None, None, None, None, t) # nether brick