Lilypads are now properly oriented.
This commit is contained in:
@@ -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 {
|
||||
|
||||
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user