0

Revert "Update chests to work with snapshot 12w21b. Add ender chests. Improve some comments."

This reverts commit b245bbe8b3.
This commit is contained in:
Aaron Griffith
2012-06-04 21:57:42 -04:00
parent 365c67cf94
commit a60b56c507
2 changed files with 83 additions and 203 deletions

View File

@@ -321,46 +321,71 @@ generate_pseudo_data(RenderState *state, unsigned char ancilData) {
}
return final_data;
} else if (state->block == 54) { /* normal chests */
/* Orientation is given by ancilData, pseudo data needed to
* choose from single or double chest and the correct half of
* the chest. */
/* Add two bits to ancilData to store single or double chest
* and which half of the chest it is: bit 0x10 = second half
* bit 0x8 = first half */
} else if (state-> block == 54) { /* chests */
/* the top 2 bits are used to store the type of chest
* (single or double), the 2 bottom bits are used for
* orientation, look textures.py for more information. */
unsigned char chest_data = 0, final_data = 0;
/* if placed alone chests always face west, return 0 to make a
* chest facing west */
unsigned char chest_data = 0, air_data = 0, final_data = 0;
/* search for chests */
chest_data = check_adjacent_blocks(state, x, y, z, 54);
if (chest_data == 1) { /* another chest in the upper-left */
final_data = final_data | 0x10 | ancilData;
/* search for air */
air_data = check_adjacent_blocks(state, x, y, z, 0);
} else if (chest_data == 2) { /* in the bottom-left */
final_data = final_data | 0x8 | ancilData;
if (chest_data == 1) { /* another chest in the east */
final_data = final_data | 0x8; /* only can face to north or south */
if ( (air_data & 0x2) == 2 ) {
final_data = final_data | 0x1; /* facing north */
} else {
final_data = final_data | 0x3; /* facing south */
}
} else if (chest_data == 4) { /*in the bottom-right */
final_data = final_data | 0x8 | ancilData;
} else if (chest_data == 2) { /* in the north */
final_data = final_data | 0x4; /* only can face to east or west */
if ( !((air_data & 0x4) == 4) ) { /* 0 = west */
final_data = final_data | 0x2; /* facing east */
}
} else if (chest_data == 8) { /*in the upper-right */
final_data = final_data | 0x10 | ancilData;
} else if (chest_data == 4) { /*in the west */
final_data = final_data | 0x4;
if ( (air_data & 0x2) == 2 ) {
final_data = final_data | 0x1; /* facing north */
} else {
final_data = final_data | 0x3; /* facing south */
}
} else if (chest_data == 8) { /*in the south */
final_data = final_data | 0x8;
if ( !((air_data & 0x4) == 4) ) {
final_data = final_data | 0x2; /* facing east */
}
} else if (chest_data == 0) {
/* Single chest, determine the orientation */
final_data = ancilData;
if ( ((air_data & 0x8) == 0) && ((air_data & 0x2) == 2) ) { /* block in +x and no block in -x */
final_data = final_data | 0x1; /* facing north */
} else if ( ((air_data & 0x2) == 0) && ((air_data & 0x8) == 8)) {
final_data = final_data | 0x3;
} else if ( ((air_data & 0x4) == 0) && ((air_data & 0x1) == 1)) {
final_data = final_data | 0x2;
} /* else, facing west, value = 0 */
} else {
/* more than one adjacent chests! That shouldn't be
* possible! render as normal chest */
/* more than one adjacent chests! render as normal chest */
return 0;
}
return final_data;
} else if ((state->block == 101) || (state->block == 102)) {
/* iron bars and glass panes:
* they seem to stick to almost everything but air,
* they seem to stick to almost everything but air, but
* not sure yet! Still a TODO! */
/* return check adjacent blocks with air, bit inverted */
return check_adjacent_blocks(state, x, y, z, 0) ^ 0x0f;