Added support for Trees and changed $SCRIPTPATH to the more understandable $SCRIPT_DIR

This commit is contained in:
walterhiggins 2012-12-28 09:16:25 +00:00
parent 13076a9bf2
commit 872bb46a94

View file

@ -171,7 +171,7 @@ public class CommandScript extends CommandBase {
} }
filename = scriptFile.getAbsolutePath(); filename = scriptFile.getAbsolutePath();
((ScriptableObject)thisObj).defineProperty("$SCRIPT",scriptFile.getAbsolutePath(),ScriptableObject.DONTENUM); ((ScriptableObject)thisObj).defineProperty("$SCRIPT",scriptFile.getAbsolutePath(),ScriptableObject.DONTENUM);
((ScriptableObject)thisObj).defineProperty("$SCRIPTPATH",scriptFile.getParentFile().getAbsolutePath(),ScriptableObject.DONTENUM); ((ScriptableObject)thisObj).defineProperty("$SCRIPT_DIR",scriptFile.getParentFile().getAbsolutePath(),ScriptableObject.DONTENUM);
try { try {
// Here we evalute the entire contents of the file as // Here we evalute the entire contents of the file as
@ -244,6 +244,13 @@ public class CommandScript extends CommandBase {
int b = new Double(args[3].toString()).intValue(); int b = new Double(args[3].toString()).intValue();
int m = new Double(args[4].toString()).intValue(); int m = new Double(args[4].toString()).intValue();
putBlockImpl(x,y,z,b,m); putBlockImpl(x,y,z,b,m);
switch (b){
case 6:
EntityPlayer player = (EntityPlayer)CommandScript.sender;
World world = player.worldObj;
((BlockSapling)Block.sapling).growTree(world,x,y,z,world.rand);
break;
}
} }
public static void putSign(Context cx, Scriptable thisObj,Object[] args, Function funObj){ public static void putSign(Context cx, Scriptable thisObj,Object[] args, Function funObj){
List jsArray = (List)args[0]; List jsArray = (List)args[0];