From dbcdae393de64d784368469c05d2a64c13966376 Mon Sep 17 00:00:00 2001 From: Alex 'mcmonkey' Goodwin Date: Sat, 10 Oct 2020 09:37:15 -0700 Subject: [PATCH] cursor_on and precise_target: allow decimal inputs --- .../denizen/objects/EntityTag.java | 4 ++-- .../denizen/objects/LocationTag.java | 20 +++++++++---------- 2 files changed, 12 insertions(+), 12 deletions(-) diff --git a/plugin/src/main/java/com/denizenscript/denizen/objects/EntityTag.java b/plugin/src/main/java/com/denizenscript/denizen/objects/EntityTag.java index acdc4923b2..4483564740 100644 --- a/plugin/src/main/java/com/denizenscript/denizen/objects/EntityTag.java +++ b/plugin/src/main/java/com/denizenscript/denizen/objects/EntityTag.java @@ -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); diff --git a/plugin/src/main/java/com/denizenscript/denizen/objects/LocationTag.java b/plugin/src/main/java/com/denizenscript/denizen/objects/LocationTag.java index 2790a263f3..0aac90e72f 100644 --- a/plugin/src/main/java/com/denizenscript/denizen/objects/LocationTag.java +++ b/plugin/src/main/java/com/denizenscript/denizen/objects/LocationTag.java @@ -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); @@ -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); @@ -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); @@ -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; @@ -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);