0

Lilypads are now properly oriented.

This commit is contained in:
Alejandro Aguilera
2013-04-07 01:33:10 +02:00
parent 4dbca0d8ed
commit 0f017f6b51
2 changed files with 28 additions and 5 deletions

View File

@@ -402,6 +402,20 @@ generate_pseudo_data(RenderState *state, unsigned char ancilData) {
} else { } else {
return check_adjacent_blocks(state, x, y, z, state->block); 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 == 71) || (state.block == 79) ||
(state.block == 85) || (state.block == 90) || (state.block == 85) || (state.block == 90) ||
(state.block == 101) || (state.block == 102) || (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); ancilData = generate_pseudo_data(&state, ancilData);
state.block_pdata = ancilData; state.block_pdata = ancilData;
} else { } else {

View File

@@ -3433,12 +3433,20 @@ block(blockid=110, top_image="textures/blocks/mycel_top.png", side_image="textur
# lilypad # lilypad
# At the moment of writing this lilypads has no ancil data and their # At the moment of writing this lilypads has no ancil data and their
# orientation depends on their position on the map. Because lilypads had # orientation depends on their position on the map. So it uses pseudo
# ancildata, leave some data values just in case an old map have some # ancildata.
# with ancil data.
@material(blockid=111, data=range(4), transparent=True) @material(blockid=111, data=range(4), transparent=True)
def lilypad(self, blockid, data): 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) return self.build_full_block(None, None, None, None, None, t)
# nether brick # nether brick