From 3c8d7e6442d3cf2bcf8736fa18beb007a3cd2d55 Mon Sep 17 00:00:00 2001 From: Alejandro Aguilera Date: Sun, 8 May 2011 02:10:19 +0200 Subject: [PATCH] Add portals to textures.py, needed changes in chunk.py and iterate.c and added beds to transparent blocks. --- chunk.py | 6 +++--- src/iterate.c | 4 +++- textures.py | 19 ++++++++++++++++++- textures/portal.png | Bin 0 -> 672 bytes 4 files changed, 24 insertions(+), 5 deletions(-) create mode 100644 textures/portal.png diff --git a/chunk.py b/chunk.py index 59ccae0..f44b4db 100644 --- a/chunk.py +++ b/chunk.py @@ -114,9 +114,9 @@ def get_tileentity_data(level): return data # This set holds blocks ids that can be seen through, for occlusion calculations -transparent_blocks = set([ 0, 6, 8, 9, 18, 20, 27, 28, 37, 38, 39, 40, 44, 50, - 51, 52, 53, 55, 59, 63, 64, 65, 66, 67, 68, 69, 70, 71, - 72, 74, 75, 76, 77, 78, 79, 81, 83, 85, 92]) +transparent_blocks = set([ 0, 6, 8, 9, 18, 20, 26, 27, 28, 37, 38, 39, 40, 44, + 50, 51, 52, 53, 55, 59, 63, 64, 65, 66, 67, 68, 69, 70, + 71, 72, 74, 75, 76, 77, 78, 79, 81, 83, 85, 90, 92]) # This set holds block ids that are solid blocks solid_blocks = set([1, 2, 3, 4, 5, 7, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, diff --git a/src/iterate.c b/src/iterate.c index 1828409..7fd3d3f 100644 --- a/src/iterate.c +++ b/src/iterate.c @@ -276,6 +276,8 @@ generate_pseudo_data(RenderState *state, unsigned char ancilData) { return final_data; + } else if (state->block == 90) { + return check_adjacent_blocks(state, x, y, z, state->block); } @@ -398,7 +400,7 @@ chunk_render(PyObject *self, PyObject *args) { PyObject *tmp; unsigned char ancilData = getArrayByte3D(blockdata_expanded, state.x, state.y, state.z); - if ((state.block == 85) || (state.block == 9) || (state.block == 55) || (state.block == 54) || (state.block == 2)) { + if ((state.block == 85) || (state.block == 9) || (state.block == 55) || (state.block == 54) || (state.block == 2) || (state.block == 90)) { ancilData = generate_pseudo_data(&state, ancilData); } diff --git a/textures.py b/textures.py index 8e764c8..28d44f0 100644 --- a/textures.py +++ b/textures.py @@ -1186,6 +1186,22 @@ def generate_special_texture(blockID, data): return (img.convert("RGB"), img.split()[3]) + if blockID == 90: # portal + portaltexture = _load_image("portal.png") + img = Image.new("RGBA", (24,24), (38,92,255,0)) + + side = transform_image_side(portaltexture) + otherside = side.transpose(Image.FLIP_TOP_BOTTOM) + + if data in (1,4): + composite.alpha_over(img, side, (5,4), side) + + if data in (2,8): + composite.alpha_over(img, otherside, (5,4), otherside) + + return (img.convert("RGB"), img.split()[3]) + + if blockID == 92: # cake! (without bites, at the moment) top = terrain_images[121] @@ -1292,7 +1308,7 @@ def getBiomeData(worlddir, chunkX, chunkY): special_blocks = set([ 2, 6, 9, 17, 18, 23, 27, 28, 35, 43, 44, 50, 51, 53, 54, 55, 58, 59, 61, 62, 64, 65, 66, 67, 71, 75, - 76, 85, 86, 91, 92]) + 76, 85, 86, 90, 91, 92]) # this is a map of special blockIDs to a list of all # possible values for ancillary data that it might have. @@ -1326,6 +1342,7 @@ special_map[75] = (1,2,3,4,5) # off redstone torch, orientation special_map[76] = (1,2,3,4,5) # on redstone torch, orientation special_map[85] = range(17) # fences, all the possible combination, uses pseudo data special_map[86] = range(5) # pumpkin, orientation +special_map[90] = (1,2,4,8) # portal, in 2 orientations, 4 cases, uses pseudo data special_map[91] = range(5) # jack-o-lantern, orientation special_map[92] = range(6) # cake! diff --git a/textures/portal.png b/textures/portal.png new file mode 100644 index 0000000000000000000000000000000000000000..c6199204854714620b203859875747d5b13e2a14 GIT binary patch literal 672 zcmeAS@N?(olHy`uVBq!ia0y~yU=RRd4mJh`2Kmqb6B!s77>k44ofy`glX=O&z`&N| z?e4-*$q>Xa_YJ$wGX@3*&H|6fVg?3oVGw3ym^DX&fq{X&#M9T6{WdGR2n$=e)hv*Z zWQl7;iF1B#Zfaf$gL6@8Vo7R>LV0FMhJw4NZ$Nk>pEv^p<8MzF#}JFtt&>j{-8K+# zkrxZP;~H6{I#vGU^e4@qX75}!$1BHEEPUdTLozCt!)~rT!)j6T{fmjgqubZt+qY#t zs$aU~$>+P%lzcPK+uF;^Pjpf!e?3WqM?68wRi4Y@{m)vP3;gMuEFPXNbD#PA#P$Wb zfd%n-c`j3GS~(OM8bz9vd^IPD>|O8Yb8N%OqEkBc>DAF|R{rigDX}HU=FR*cTW&Hi zW$RWMwb^*?(Dz9OD*|E}1Bhu=a7l zbq~dkLjuobe!n`haplL&`z23CbZ-<}J0)q38k_8g=RbEesAXTge%ZqP^7rc#lG`#5 zRsMhF;JI~Ag9y`OnS0f9zMsf;S7eEtGeMp6;DQzX_md7R3a+q;cCuz=PB#QEYHMp=lX^@0o^LxC;a&Ys@@(qPJ>N?LON66D z+U`7M_3~t4%AH%i-Qw7-r~jt?`LuPh!ILXyJ;xTzzx_=1WxQys;=*fJVvjFe$M}Og YRPXb*Ndex<3=9kmp00i_>zopr0C|NQQ~&?~ literal 0 HcmV?d00001