Fix issue #269 for both spigot and canary - make sure new stairs don't cause same issue again.
This commit is contained in:
parent
0dbff00703
commit
bff23932a7
3 changed files with 36 additions and 44 deletions
|
@ -98,31 +98,24 @@ 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:
|
||||
face( ['east','west','south','north'][metadata] );
|
||||
break;
|
||||
case blocks.sign:
|
||||
case blocks.ladder:
|
||||
// bug: furnace, chest, dispenser don't always use the right metadata
|
||||
case blocks.furnace:
|
||||
case blocks.furnace_burning:
|
||||
case blocks.chest:
|
||||
case blocks.enderchest:
|
||||
case blocks.dispenser:
|
||||
face( [null,null,'north','south','west','east'][metadata] );
|
||||
break;
|
||||
case blocks.torch:
|
||||
face( ['up'/* default */,'east','west','south','north','up'][metadata] );
|
||||
break;
|
||||
if ( blocks.isStair(block.typeId) ){
|
||||
face( ['east','west','south','north'] [metadata] );
|
||||
} else {
|
||||
switch( block.typeId ){
|
||||
case blocks.sign:
|
||||
case blocks.ladder:
|
||||
// bug: furnace, chest, dispenser don't always use the right metadata
|
||||
case blocks.furnace:
|
||||
case blocks.furnace_burning:
|
||||
case blocks.chest:
|
||||
case blocks.enderchest:
|
||||
case blocks.dispenser:
|
||||
face( [null,null,'north','south','west','east'][metadata] );
|
||||
break;
|
||||
case blocks.torch:
|
||||
face( ['up'/* default */,'east','west','south','north','up'][metadata] );
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
function applyColors( block, metadata ){
|
||||
|
|
|
@ -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;
|
||||
|
|
|
@ -766,29 +766,20 @@ Drone.prototype.debug = function( ) {
|
|||
|
||||
function getBlockIdAndMeta( b ) {
|
||||
var defaultMeta = 0,
|
||||
i = 0,
|
||||
bs,
|
||||
md,
|
||||
sp;
|
||||
i = 0,
|
||||
bs,
|
||||
md,
|
||||
sp;
|
||||
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:
|
||||
defaultMeta = Drone.PLAYER_STAIRS_FACING[ this.dir % 4 ];
|
||||
break;
|
||||
if ( blocks.isStair(b) ) {
|
||||
defaultMeta = Drone.PLAYER_STAIRS_FACING[ this.dir % 4 ];
|
||||
} else {
|
||||
switch (b) {
|
||||
case blocks.sign:
|
||||
case blocks.ladder:
|
||||
// bug: furnace, chest, dispenser don't always use the right metadata
|
||||
// bug: furnace, chest, dispenser don't always use the right metadata
|
||||
case blocks.furnace:
|
||||
case blocks.furnace_burning:
|
||||
case blocks.chest:
|
||||
|
@ -799,6 +790,7 @@ function getBlockIdAndMeta( b ) {
|
|||
case blocks.sign_post:
|
||||
defaultMeta = ( 12 + ( ( this.dir + 2 ) * 4 ) ) % 16;
|
||||
break;
|
||||
}
|
||||
}
|
||||
return [ b, defaultMeta ];
|
||||
}
|
||||
|
|
Reference in a new issue