Permalink
Browse files

Modification to get_command_block().

get_command_block() will now return a locationArray which contains the
yaw and pitch for command block minecarts, and not for command block
blocks.
  • Loading branch information...
Pieter12345 committed Sep 28, 2017
1 parent e8e01b8 commit 6c92a12b0851d64a8aed4556d88a03b0daa8c5cc
Showing with 5 additions and 7 deletions.
  1. +5 −7 src/main/java/com/laytonsmith/core/functions/Meta.java
@@ -719,18 +719,16 @@ public Boolean runAsync() {
public Construct exec(Target t, Environment environment, Construct... args) throws ConfigRuntimeException {
MCCommandSender sender = environment.getEnv(CommandHelperEnvironment.class).GetCommandSender();
MCLocation loc;
String type;
CArray ret;
if(sender instanceof MCBlockCommandSender) {
loc = ((MCBlockCommandSender) sender).getBlock().getLocation();
type = "block";
ret = ObjectGenerator.GetGenerator().location(loc, false); // Do not include pitch/yaw.
} else if(sender instanceof MCCommandMinecart) {
loc = ((MCCommandMinecart) sender).getLocation();
type = "minecart";
ret = ObjectGenerator.GetGenerator().location(loc, true); // Include pitch/yaw.
} else {
return CNull.NULL;
}
CArray ret = ObjectGenerator.GetGenerator().location(loc);
ret.set("type", new CString(type, t), t);
return ret;
}
@@ -747,8 +745,8 @@ public String getName() {
@Override
public String docs() {
return "locationArray {} If this command was being run from a command block block or minecart, this will"
+ " return the location of the block or minecart with an additional \"type\" key with value"
+ " \"block\" or \"minecart\" for command block blocks and command block minecarts respectively."
+ " return the location of the block or minecart."
+ " The yaw and pitch will only be included in the locationArray for minecart command blocks."
+ " If a player or console ran this command (or any other command sender), this will return null.";
}

0 comments on commit 6c92a12

Please sign in to comment.