Fix issue #269 for both spigot and canary - make sure new stairs don't cause same issue again.

This commit is contained in:
walterhiggins 2015-08-29 19:07:19 +01:00
parent 0dbff00703
commit bff23932a7
3 changed files with 36 additions and 44 deletions

View file

@ -98,18 +98,10 @@ function applyFacing( block, metadata ){
function face(direction){
property(block).set('facing', lookup.facing[direction]);
}
switch( block.typeId ){
case blocks.stairs.oak:
case blocks.stairs.cobblestone:
case blocks.stairs.brick:
case blocks.stairs.stone:
case blocks.stairs.nether:
case blocks.stairs.sandstone:
case blocks.stairs.spruce:
case blocks.stairs.jungle:
case blocks.stairs.quartz:
if ( blocks.isStair(block.typeId) ){
face( ['east','west','south','north'] [metadata] );
break;
} else {
switch( block.typeId ){
case blocks.sign:
case blocks.ladder:
// bug: furnace, chest, dispenser don't always use the right metadata
@ -125,6 +117,7 @@ function applyFacing( block, metadata ){
break;
}
}
}
function applyColors( block, metadata ){
switch( block.typeId){
case blocks.wool.white:

View file

@ -325,5 +325,12 @@ blocks.rainbow = [
blocks.stained_glass.blue,
blocks.stained_glass.purple
];
blocks.isStair = function(id){
var p;
for (p in this.stairs){
if (this.stairs[p] == id)
return true;
}
return false;
};
module.exports = blocks;

View file

@ -773,19 +773,10 @@ function getBlockIdAndMeta( b ) {
if (typeof b === 'number' || /^[0-9]+$/.test(b)) {
// wph 20130414 - use sensible defaults for certain blocks e.g. stairs
// should face the drone.
switch (b) {
case blocks.stairs.birch:
case blocks.stairs.brick:
case blocks.stairs.cobblestone:
case blocks.stairs.jungle:
case blocks.stairs.nether:
case blocks.stairs.oak:
case blocks.stairs.quartz:
case blocks.stairs.sandstone:
case blocks.stairs.spruce:
case blocks.stairs.stone:
if ( blocks.isStair(b) ) {
defaultMeta = Drone.PLAYER_STAIRS_FACING[ this.dir % 4 ];
break;
} else {
switch (b) {
case blocks.sign:
case blocks.ladder:
// bug: furnace, chest, dispenser don't always use the right metadata
@ -800,6 +791,7 @@ function getBlockIdAndMeta( b ) {
defaultMeta = ( 12 + ( ( this.dir + 2 ) * 4 ) ) % 16;
break;
}
}
return [ b, defaultMeta ];
}
if ( typeof b === 'string' ) {