Merge branch 'master' into 1.16

This commit is contained in:
gnembon committed 2020-07-08 00:48:56 -03:00
commit bba9f4e88d
5 files changed
+55 -6

No files matched your search

@@ -75,6 +75,7 @@ public class PlayerCommand
.then(literal("west").executes(manipulation(ap -> ap.look(Direction.WEST))))
.then(literal("up").executes(manipulation(ap -> ap.look(Direction.UP))))
.then(literal("down").executes(manipulation(ap -> ap.look(Direction.DOWN))))
.then(literal("at").then(argument("position", Vec3ArgumentType.vec3()).executes(PlayerCommand::lookAt)))
.then(argument("direction", RotationArgumentType.rotation())
.executes(c -> manipulate(c, ap -> ap.look(RotationArgumentType.getRotation(c, "direction").toAbsoluteRotation(c.getSource())))))
).then(literal("turn")
@@ -206,6 +207,15 @@ public class PlayerCommand
return 1;
}
private static int lookAt(CommandContext<ServerCommandSource> context)
{
return manipulate(context, ap -> {
try {
ap.lookAt(Vec3ArgumentType.getVec3(context, "position"));
} catch (CommandSyntaxException ignored) {}
});
}
@FunctionalInterface
interface SupplierWithCommandSyntaxException<T>
{