Merge branch 'snapshot'
Conflicts: overviewer_core/src/iterate.c
This commit is contained in:
@@ -273,7 +273,7 @@ generate_pseudo_data(RenderState *state, unsigned char ancilData) {
|
|||||||
*/
|
*/
|
||||||
int x = state->x, y = state->y, z = state->z;
|
int x = state->x, y = state->y, z = state->z;
|
||||||
unsigned char data = 0;
|
unsigned char data = 0;
|
||||||
|
|
||||||
if (state->block == 2) { /* grass */
|
if (state->block == 2) { /* grass */
|
||||||
/* return 0x10 if grass is covered in snow */
|
/* return 0x10 if grass is covered in snow */
|
||||||
if (get_data(state, BLOCKS, x, y+1, z) == 78)
|
if (get_data(state, BLOCKS, x, y+1, z) == 78)
|
||||||
@@ -543,6 +543,17 @@ generate_pseudo_data(RenderState *state, unsigned char ancilData) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
return ancilData;
|
return ancilData;
|
||||||
|
} else if (state->block == 175) { /* doublePlants */
|
||||||
|
/* use bottom block data format plus one bit for top
|
||||||
|
* block (0x8)
|
||||||
|
*/
|
||||||
|
if( get_data(state, BLOCKS, x, y-1, z) == 175 ) {
|
||||||
|
data = get_data(state, DATA, x, y-1, z) | 0x8;
|
||||||
|
} else {
|
||||||
|
data = ancilData;
|
||||||
|
}
|
||||||
|
|
||||||
|
return data;
|
||||||
}
|
}
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
@@ -689,7 +700,8 @@ chunk_render(PyObject *self, PyObject *args) {
|
|||||||
(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 == 111) || (state.block == 113) ||
|
(state.block == 111) || (state.block == 113) ||
|
||||||
(state.block == 139) || is_stairs(state.block)) {
|
(state.block == 139) || (state.block == 175) ||
|
||||||
|
is_stairs(state.block)) {
|
||||||
ancilData = generate_pseudo_data(&state, ancilData);
|
ancilData = generate_pseudo_data(&state, ancilData);
|
||||||
state.block_pdata = ancilData;
|
state.block_pdata = ancilData;
|
||||||
} else {
|
} else {
|
||||||
@@ -711,6 +723,7 @@ chunk_render(PyObject *self, PyObject *args) {
|
|||||||
if (t != NULL && t != Py_None)
|
if (t != NULL && t != Py_None)
|
||||||
{
|
{
|
||||||
PyObject *src, *mask, *mask_light;
|
PyObject *src, *mask, *mask_light;
|
||||||
|
int do_rand = (state.block == 31 /*|| state.block == 38 || state.block == 175*/);
|
||||||
int randx = 0, randy = 0;
|
int randx = 0, randy = 0;
|
||||||
src = PyTuple_GetItem(t, 0);
|
src = PyTuple_GetItem(t, 0);
|
||||||
mask = PyTuple_GetItem(t, 0);
|
mask = PyTuple_GetItem(t, 0);
|
||||||
@@ -719,7 +732,7 @@ chunk_render(PyObject *self, PyObject *args) {
|
|||||||
if (mask == Py_None)
|
if (mask == Py_None)
|
||||||
mask = src;
|
mask = src;
|
||||||
|
|
||||||
if (state.block == 31) {
|
if (do_rand) {
|
||||||
/* add a random offset to the postion of the tall grass to make it more wild */
|
/* add a random offset to the postion of the tall grass to make it more wild */
|
||||||
randx = rand() % 6 + 1 - 3;
|
randx = rand() % 6 + 1 - 3;
|
||||||
randy = rand() % 6 + 1 - 3;
|
randy = rand() % 6 + 1 - 3;
|
||||||
@@ -729,7 +742,7 @@ chunk_render(PyObject *self, PyObject *args) {
|
|||||||
|
|
||||||
render_mode_draw(rendermode, src, mask, mask_light);
|
render_mode_draw(rendermode, src, mask, mask_light);
|
||||||
|
|
||||||
if (state.block == 31) {
|
if (do_rand) {
|
||||||
/* undo the random offsets */
|
/* undo the random offsets */
|
||||||
state.imgx -= randx;
|
state.imgx -= randx;
|
||||||
state.imgy -= randy;
|
state.imgy -= randy;
|
||||||
|
|||||||
@@ -74,6 +74,10 @@ static void
|
|||||||
base_draw(void *data, RenderState *state, PyObject *src, PyObject *mask, PyObject *mask_light) {
|
base_draw(void *data, RenderState *state, PyObject *src, PyObject *mask, PyObject *mask_light) {
|
||||||
PrimitiveBase *self = (PrimitiveBase *)data;
|
PrimitiveBase *self = (PrimitiveBase *)data;
|
||||||
|
|
||||||
|
/* in order to detect top parts of doublePlant grass & ferns */
|
||||||
|
unsigned char below_block = get_data(state, BLOCKS, state->x, state->y-1, state->z);
|
||||||
|
unsigned char below_data = get_data(state, DATA, state->x, state->y-1, state->z);
|
||||||
|
|
||||||
/* draw the block! */
|
/* draw the block! */
|
||||||
alpha_over(state->img, src, mask, state->imgx, state->imgy, 0, 0);
|
alpha_over(state->img, src, mask, state->imgx, state->imgy, 0, 0);
|
||||||
|
|
||||||
@@ -102,7 +106,11 @@ base_draw(void *data, RenderState *state, PyObject *src, PyObject *mask, PyObjec
|
|||||||
/* vines */
|
/* vines */
|
||||||
state->block == 106 ||
|
state->block == 106 ||
|
||||||
/* lily pads */
|
/* lily pads */
|
||||||
state->block == 111)
|
state->block == 111 ||
|
||||||
|
/* doublePlant grass & ferns */
|
||||||
|
(state->block == 175 && (state->block_data == 2 || state->block_data == 3)) ||
|
||||||
|
/* doublePlant grass & ferns tops */
|
||||||
|
(state->block == 175 && below_block == 175 && (below_data == 2 || below_data == 3)) )
|
||||||
{
|
{
|
||||||
/* do the biome stuff! */
|
/* do the biome stuff! */
|
||||||
PyObject *facemask = mask;
|
PyObject *facemask = mask;
|
||||||
@@ -155,6 +163,10 @@ base_draw(void *data, RenderState *state, PyObject *src, PyObject *mask, PyObjec
|
|||||||
/* lily pads */
|
/* lily pads */
|
||||||
color_table = self->grasscolor;
|
color_table = self->grasscolor;
|
||||||
break;
|
break;
|
||||||
|
case 175:
|
||||||
|
/* doublePlant grass & ferns */
|
||||||
|
color_table = self->grasscolor;
|
||||||
|
break;
|
||||||
default:
|
default:
|
||||||
break;
|
break;
|
||||||
};
|
};
|
||||||
|
|||||||
@@ -712,7 +712,7 @@ class Textures(object):
|
|||||||
"""
|
"""
|
||||||
img = Image.new("RGBA", (24,24), self.bgcolor)
|
img = Image.new("RGBA", (24,24), self.bgcolor)
|
||||||
|
|
||||||
front = tex.resize((14, 11), Image.ANTIALIAS)
|
front = tex.resize((14, 12), Image.ANTIALIAS)
|
||||||
alpha_over(img, front, (5,9))
|
alpha_over(img, front, (5,9))
|
||||||
return img
|
return img
|
||||||
|
|
||||||
@@ -864,7 +864,18 @@ def grass(self, blockid, data):
|
|||||||
return img
|
return img
|
||||||
|
|
||||||
# dirt
|
# dirt
|
||||||
block(blockid=3, top_image="assets/minecraft/textures/blocks/dirt.png")
|
@material(blockid=3, data=range(3), solid=True)
|
||||||
|
def dirt_blocks(self, blockid, data):
|
||||||
|
side_img = self.load_image_texture("assets/minecraft/textures/blocks/dirt.png")
|
||||||
|
if data == 0: # normal
|
||||||
|
img = self.build_block(self.load_image_texture("assets/minecraft/textures/blocks/dirt.png"), side_img)
|
||||||
|
if data == 1: # grassless
|
||||||
|
img = self.build_block(self.load_image_texture("assets/minecraft/textures/blocks/dirt.png"), side_img)
|
||||||
|
if data == 2: # podzol
|
||||||
|
side_img = self.load_image_texture("assets/minecraft/textures/blocks/dirt_podzol_side.png")
|
||||||
|
img = self.build_block(self.load_image_texture("assets/minecraft/textures/blocks/dirt_podzol_top.png"), side_img)
|
||||||
|
return img
|
||||||
|
|
||||||
# cobblestone
|
# cobblestone
|
||||||
block(blockid=4, top_image="assets/minecraft/textures/blocks/cobblestone.png")
|
block(blockid=4, top_image="assets/minecraft/textures/blocks/cobblestone.png")
|
||||||
|
|
||||||
@@ -950,7 +961,14 @@ def lava(self, blockid, data):
|
|||||||
return self.build_block(lavatex, lavatex)
|
return self.build_block(lavatex, lavatex)
|
||||||
|
|
||||||
# sand
|
# sand
|
||||||
block(blockid=12, top_image="assets/minecraft/textures/blocks/sand.png")
|
@material(blockid=12, data=range(2), solid=True)
|
||||||
|
def sand_blocks(self, blockid, data):
|
||||||
|
if data == 0: # normal
|
||||||
|
img = self.build_block(self.load_image_texture("assets/minecraft/textures/blocks/sand.png"), self.load_image_texture("assets/minecraft/textures/blocks/sand.png"))
|
||||||
|
if data == 1: # red
|
||||||
|
img = self.build_block(self.load_image_texture("assets/minecraft/textures/blocks/red_sand.png"), self.load_image_texture("assets/minecraft/textures/blocks/red_sand.png"))
|
||||||
|
return img
|
||||||
|
|
||||||
# gravel
|
# gravel
|
||||||
block(blockid=13, top_image="assets/minecraft/textures/blocks/gravel.png")
|
block(blockid=13, top_image="assets/minecraft/textures/blocks/gravel.png")
|
||||||
# gold ore
|
# gold ore
|
||||||
@@ -1443,8 +1461,16 @@ def wool(self, blockid, data):
|
|||||||
|
|
||||||
# dandelion
|
# dandelion
|
||||||
sprite(blockid=37, imagename="assets/minecraft/textures/blocks/flower_dandelion.png")
|
sprite(blockid=37, imagename="assets/minecraft/textures/blocks/flower_dandelion.png")
|
||||||
# rose
|
|
||||||
sprite(blockid=38, imagename="assets/minecraft/textures/blocks/flower_rose.png")
|
# flowers
|
||||||
|
@material(blockid=38, data=range(10), transparent=True)
|
||||||
|
def flower(self, blockid, data):
|
||||||
|
flower_map = ["rose", "blue_orchid", "allium", "houstonia", "tulip_red", "tulip_orange",
|
||||||
|
"tulip_white", "tulip_pink", "oxeye_daisy", "dandelion"]
|
||||||
|
texture = self.load_image_texture("assets/minecraft/textures/blocks/flower_%s.png" % flower_map[data])
|
||||||
|
|
||||||
|
return self.build_billboard(texture)
|
||||||
|
|
||||||
# brown mushroom
|
# brown mushroom
|
||||||
sprite(blockid=39, imagename="assets/minecraft/textures/blocks/mushroom_brown.png")
|
sprite(blockid=39, imagename="assets/minecraft/textures/blocks/mushroom_brown.png")
|
||||||
# red mushroom
|
# red mushroom
|
||||||
@@ -3821,7 +3847,7 @@ def beacon(self, blockid, data):
|
|||||||
|
|
||||||
return img
|
return img
|
||||||
|
|
||||||
# cobbleston and mossy cobblestone walls
|
# cobblestone and mossy cobblestone walls
|
||||||
# one additional bit of data value added for mossy and cobblestone
|
# one additional bit of data value added for mossy and cobblestone
|
||||||
@material(blockid=139, data=range(32), transparent=True, nospawn=True)
|
@material(blockid=139, data=range(32), transparent=True, nospawn=True)
|
||||||
def cobblestone_wall(self, blockid, data):
|
def cobblestone_wall(self, blockid, data):
|
||||||
@@ -4156,3 +4182,27 @@ def stained_clay(self, blockid, data):
|
|||||||
|
|
||||||
#coal block
|
#coal block
|
||||||
block(blockid=173, top_image="assets/minecraft/textures/blocks/coal_block.png")
|
block(blockid=173, top_image="assets/minecraft/textures/blocks/coal_block.png")
|
||||||
|
|
||||||
|
# packed ice block
|
||||||
|
block(blockid=174, top_image="assets/minecraft/textures/blocks/ice_packed.png")
|
||||||
|
|
||||||
|
@material(blockid=175, data=range(16), transparent=True)
|
||||||
|
def flower(self, blockid, data):
|
||||||
|
double_plant_map = ["sunflower", "syringa", "grass", "fern", "rose", "paeonia", "paeonia", "paeonia"]
|
||||||
|
plant = double_plant_map[data & 0x7]
|
||||||
|
|
||||||
|
if data & 0x8:
|
||||||
|
part = "top"
|
||||||
|
else:
|
||||||
|
part = "bottom"
|
||||||
|
|
||||||
|
png = "assets/minecraft/textures/blocks/double_plant_%s_%s.png" % (plant,part)
|
||||||
|
texture = self.load_image_texture(png)
|
||||||
|
img = self.build_billboard(texture)
|
||||||
|
|
||||||
|
#sunflower top
|
||||||
|
if data == 8:
|
||||||
|
bloom_tex = self.load_image_texture("assets/minecraft/textures/blocks/double_plant_sunflower_front.png")
|
||||||
|
alpha_over(img, bloom_tex.resize((14, 11), Image.ANTIALIAS), (5,5))
|
||||||
|
|
||||||
|
return img
|
||||||
|
|||||||
Reference in New Issue
Block a user