added youtube link.

This commit is contained in:
walterhiggins 2013-01-04 01:05:11 +00:00
parent 8a298953c2
commit 165a2873b3
2 changed files with 24 additions and 9 deletions

View file

@ -44,13 +44,15 @@ public class CommandScript extends CommandBase {
public static PlayerPos getPlayerPosImpl() public static PlayerPos getPlayerPosImpl()
{ {
PlayerPos pos = new PlayerPos(); PlayerPos pos = new PlayerPos();
EntityPlayer player = (EntityPlayer)CommandScript.sender; if (CommandScript.sender instanceof EntityPlayer){
EntityPlayer player = (EntityPlayer)CommandScript.sender;
pos.x = player.posX; pos.x = player.posX;
pos.y = player.posY; pos.y = player.posY;
pos.z = player.posZ; pos.z = player.posZ;
pos.rotationYaw = player.rotationYaw; pos.rotationYaw = player.rotationYaw;
return pos; return pos;
}
return null;
} }
public static PlayerPos getMousePosImpl() public static PlayerPos getMousePosImpl()
{ {
@ -85,8 +87,13 @@ public class CommandScript extends CommandBase {
} }
public static void putBlockImpl(int x, int y, int z, int blockId, int meta){ public static void putBlockImpl(int x, int y, int z, int blockId, int meta){
EntityPlayer player = (EntityPlayer)CommandScript.sender; World world = null;
player.worldObj.setBlockAndMetadata(x,y,z,blockId,meta); if (CommandScript.sender instanceof EntityPlayer){
world = ((EntityPlayer)(CommandScript.sender)).worldObj;
}else if (CommandScript.sender instanceof TileEntity){
world = ((TileEntity)(CommandScript.sender)).getWorldObj();
}
world.setBlockAndMetadata(x,y,z,blockId,meta);
} }
// //
// returns the block id and metadata at a given location in the world // returns the block id and metadata at a given location in the world
@ -143,6 +150,8 @@ public class CommandScript extends CommandBase {
importer.defineProperty("player", player,ScriptableObject.DONTENUM); importer.defineProperty("player", player,ScriptableObject.DONTENUM);
importer.defineProperty("world", player.worldObj,ScriptableObject.DONTENUM); importer.defineProperty("world", player.worldObj,ScriptableObject.DONTENUM);
} }
((ScriptableObject)(this.scope)).defineProperty("sender", par1ICommandSender,ScriptableObject.DONTENUM);
if (System.out !=null){ if (System.out !=null){
System.out.println(this.scope); System.out.println(this.scope);
} }

View file

@ -1,3 +1,9 @@
//
// Create a floor of colored tiles some of which emit light.
// The tiles change color every second creating a strobe-lit dance-floor.
//
// See it in action here => http://www.youtube.com/watch?v=UEooBt6NTFo
//
load($SCRIPT_DIR + "/../drone.js"); load($SCRIPT_DIR + "/../drone.js");
Drone.extend('dancefloor',function(width,length) Drone.extend('dancefloor',function(width,length)
{ {