Fix doors and stairs for 1.7

This commit is contained in:
walterhiggins 2014-12-27 19:03:30 +00:00
parent eddaa2f8b1
commit 8056da0d3b
2 changed files with 19 additions and 13 deletions

View file

@ -26,7 +26,7 @@ easy addition of 'Mods' and extensions to Minecraft. ScriptCraft is a
difficult but CanaryMod makes it easy. Follow these steps to difficult but CanaryMod makes it easy. Follow these steps to
Install ScriptCraft on your computer... Install ScriptCraft on your computer...
1. [Download and install CanaryMod][dlcm] (choose either Recommended, Beta or Development) . Then follow the [CanaryMod 1. [Download and install CanaryMod][dlcm] then follow the [CanaryMod
Installation Instructions][cmadmin]. Installation Instructions][cmadmin].
2. Start the CanaryMod server, then once it has started up, stop it 2. Start the CanaryMod server, then once it has started up, stop it
@ -96,7 +96,7 @@ If you don't already know Javascript, don't worry, you'll learn a little
about Programming and Javascript along the way. You've set up a about Programming and Javascript along the way. You've set up a
Minecraft server and are ready to connect ... Minecraft server and are ready to connect ...
1. Launch Minecraft (keep the Bukkit Command window open). 1. Launch Minecraft.
2. Click 'Multi-Player' 2. Click 'Multi-Player'
3. Click 'Add Server' 3. Click 'Add Server'
4. Type any name you like in the name field then type `localhost` in the 4. Type any name you like in the name field then type `localhost` in the

View file

@ -5,7 +5,13 @@ var utils = require('utils'),
bkPlayer = org.bukkit.entity.Player, bkPlayer = org.bukkit.entity.Player,
bkSign = org.bukkit.block.Sign, bkSign = org.bukkit.block.Sign,
bkTreeType = org.bukkit.TreeType, bkTreeType = org.bukkit.TreeType,
bkMaterial = org.bukkit.Material; bkMaterial = org.bukkit.Material,
bountiful = false;
if (__plugin.canary){
bountiful = parseFloat(server.canaryModVersion) > 1.7;
}
/********************************************************************* /*********************************************************************
## Drone Plugin ## Drone Plugin
@ -579,7 +585,7 @@ function putBlock( x, y, z, blockId, metadata, world ) {
if ( block.typeId != blockId || block.data != metadata ) { if ( block.typeId != blockId || block.data != metadata ) {
if (__plugin.canary) { if (__plugin.canary) {
world.setBlockAt(x, y, z, blockId, metadata); world.setBlockAt(x, y, z, blockId, metadata);
if (block.getProperties){ if ( bountiful ){
// TODO we are in 1.8 // TODO we are in 1.8
var prop = require('blockhelper').property; var prop = require('blockhelper').property;
block = world.getBlockAt(x,y,z); block = world.getBlockAt(x,y,z);
@ -597,7 +603,6 @@ function putBlock( x, y, z, blockId, metadata, world ) {
prop(block).set('facing',metadata); prop(block).set('facing',metadata);
block.update(); block.update();
} }
break;
} }
} }
return; return;
@ -637,7 +642,7 @@ function putSign( drone, x, y, z, world, texts, blockId, meta, immediate ) {
sign.setTextOnLine( text, i ); sign.setTextOnLine( text, i );
sign.update(); sign.update();
}; };
if ( block.getProperties ) { if ( bountiful ) {
// 1.8 // 1.8
var prop = require('blockhelper').property; var prop = require('blockhelper').property;
prop(block).set('facing',(drone.dir+2)%4); prop(block).set('facing',(drone.dir+2)%4);
@ -1145,6 +1150,7 @@ Drone.prototype.cuboid0 = function( block, w, h, d ) {
return this.move( 'start_point' ); return this.move( 'start_point' );
}; };
function door( doorMaterial, hinge) { function door( doorMaterial, hinge) {
if ( typeof doorMaterial == 'undefined' ) { if ( typeof doorMaterial == 'undefined' ) {
doorMaterial = 64; // wood doorMaterial = 64; // wood
@ -1154,12 +1160,12 @@ function door( doorMaterial, hinge) {
} }
this.then(function(){ this.then(function(){
putBlock( this.x, this.y, this.z, doorMaterial, this.dir, this.world ); putBlock( this.x, this.y, this.z, doorMaterial, this.dir, this.world );
putBlock( this.x, this.y+1, this.z, doorMaterial, 8, this.world ); putBlock( this.x, this.y+1, this.z, doorMaterial, hinge=='left' ? 8 : 9, this.world );
var lower = this.world.getBlockAt(this.x,this.y,this.z); if ( bountiful ){
var upper = this.world.getBlockAt(this.x,this.y+1,this.z);
if (upper.getProperties){
// 1.8 // 1.8
var prop = require('blockhelper').property; var prop = require('blockhelper').property;
var lower = this.world.getBlockAt(this.x,this.y,this.z);
var upper = this.world.getBlockAt(this.x,this.y+1,this.z);
prop(upper) prop(upper)
.set('half','upper') .set('half','upper')
.set('hinge',hinge); .set('hinge',hinge);
@ -1222,11 +1228,11 @@ function stairs(blockType, width, height){
while (height > 0) { while (height > 0) {
_traverse[this.dir].width(this, width, function(){ _traverse[this.dir].width(this, width, function(){
putBlock(that.x, that.y, that.z, blockType, 0, that.world); putBlock(that.x, that.y, that.z, blockType, Drone.PLAYER_STAIRS_FACING[that.dir], that.world);
var block = that.world.getBlockAt(that.x,that.y,that.z); if ( bountiful ){
if (block.getProperties){
// 1.8 // 1.8
var prop = require('blockhelper').property; var prop = require('blockhelper').property;
var block = that.world.getBlockAt(that.x,that.y,that.z);
prop(block).set('facing',that.dir); prop(block).set('facing',that.dir);
block.update(); block.update();
} }