Skip to content

Commit

Permalink
cursor_on and precise_target: allow decimal inputs
Browse files Browse the repository at this point in the history
  • Loading branch information
mcmonkey4eva committed Oct 10, 2020
1 parent 268bef0 commit dbcdae3
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 12 deletions.
Expand Up @@ -1569,8 +1569,8 @@ else if (mtr.angle == BlockFace.EAST) {
// Note that this will return null if there is no solid block in range.
// -->
registerSpawnedOnlyTag("cursor_on", (attribute, object) -> {
int range = attribute.getIntContext(1);
if (range < 1) {
double range = attribute.getDoubleContext(1);
if (range <= 0) {
range = 200;
}
RayTraceResult traced = object.getWorld().rayTraceBlocks(object.getEyeLocation(), object.getEyeLocation().getDirection(), range);
Expand Down
Expand Up @@ -1463,8 +1463,8 @@ public static void registerTags() {
// Optionally, specify a maximum range to find the location from (defaults to 200).
// -->
registerTag("precise_impact_normal", (attribute, object) -> {
int range = attribute.getIntContext(1);
if (range < 1) {
double range = attribute.getDoubleContext(1);
if (range <= 0) {
range = 200;
}
RayTraceResult traced = object.getWorld().rayTraceBlocks(object, object.getDirection(), range);
Expand All @@ -1482,8 +1482,8 @@ public static void registerTags() {
// Optionally, specify a maximum range to find the location from (defaults to 200).
// -->
registerTag("precise_cursor_on_block", (attribute, object) -> {
int range = attribute.getIntContext(1);
if (range < 1) {
double range = attribute.getDoubleContext(1);
if (range <= 0) {
range = 200;
}
RayTraceResult traced = object.getWorld().rayTraceBlocks(object, object.getDirection(), range);
Expand All @@ -1501,8 +1501,8 @@ public static void registerTags() {
// Optionally, specify a maximum range to find the location from (defaults to 200).
// -->
registerTag("precise_cursor_on", (attribute, object) -> {
int range = attribute.getIntContext(1);
if (range < 1) {
double range = attribute.getDoubleContext(1);
if (range <= 0) {
range = 200;
}
RayTraceResult traced = object.getWorld().rayTraceBlocks(object, object.getDirection(), range);
Expand All @@ -1520,8 +1520,8 @@ public static void registerTags() {
// Optionally, specify a maximum range to find the entity from (defaults to 100).
// -->
registerTag("precise_target", (attribute, object) -> {
int range = attribute.getIntContext(1);
if (range < 1) {
double range = attribute.getDoubleContext(1);
if (range <= 0) {
range = 100;
}
RayTraceResult result;
Expand Down Expand Up @@ -1558,8 +1558,8 @@ public static void registerTags() {
// Optionally, specify a maximum range to find the entity from (defaults to 100).
// -->
registerTag("precise_target_position", (attribute, object) -> {
int range = attribute.getIntContext(1);
if (range < 1) {
double range = attribute.getDoubleContext(1);
if (range <= 0) {
range = 100;
}
RayTraceResult result = object.getWorld().rayTraceEntities(object, object.getDirection(), range);
Expand Down

0 comments on commit dbcdae3

Please sign in to comment.