From 77303b4a629c467d79964ff5c6ac71df4dd14ff4 Mon Sep 17 00:00:00 2001 From: evilsourcerer Date: Fri, 3 May 2019 01:48:37 -0400 Subject: [PATCH] render boxes for goalYLevel --- .gitignore | 2 +- src/api/java/baritone/api/Settings.java | 4 +++- .../java/baritone/api/pathing/goals/GoalYLevel.java | 2 +- src/main/java/baritone/utils/PathRenderer.java | 12 +++++++++++- 4 files changed, 16 insertions(+), 4 deletions(-) diff --git a/.gitignore b/.gitignore index de408ec0..0834b1e8 100644 --- a/.gitignore +++ b/.gitignore @@ -18,4 +18,4 @@ classes/ # Copyright Files !/.idea/copyright/Baritone.xml -!/.idea/copyright/profiles_settings.xml \ No newline at end of file +!/.idea/copyright/profiles_settings.xml diff --git a/src/api/java/baritone/api/Settings.java b/src/api/java/baritone/api/Settings.java index a2de8b40..aa181a39 100644 --- a/src/api/java/baritone/api/Settings.java +++ b/src/api/java/baritone/api/Settings.java @@ -30,8 +30,8 @@ import java.awt.*; import java.lang.reflect.Field; import java.lang.reflect.ParameterizedType; import java.lang.reflect.Type; -import java.util.*; import java.util.List; +import java.util.*; import java.util.function.Consumer; /** @@ -81,6 +81,8 @@ public final class Settings { */ public final Setting jumpPenalty = new Setting<>(2D); + public final Setting yLevelBoxSize = new Setting<>(15D); + /** * Walking on water uses up hunger really quick, so penalize it */ diff --git a/src/api/java/baritone/api/pathing/goals/GoalYLevel.java b/src/api/java/baritone/api/pathing/goals/GoalYLevel.java index ce54eebb..9add7176 100644 --- a/src/api/java/baritone/api/pathing/goals/GoalYLevel.java +++ b/src/api/java/baritone/api/pathing/goals/GoalYLevel.java @@ -29,7 +29,7 @@ public class GoalYLevel implements Goal, ActionCosts { /** * The target Y level */ - private final int level; + public final int level; public GoalYLevel(int level) { this.level = level; diff --git a/src/main/java/baritone/utils/PathRenderer.java b/src/main/java/baritone/utils/PathRenderer.java index d1afe34d..88a18147 100644 --- a/src/main/java/baritone/utils/PathRenderer.java +++ b/src/main/java/baritone/utils/PathRenderer.java @@ -276,13 +276,13 @@ public final class PathRenderer implements Helper { double maxY; double y1; double y2; + double y = MathHelper.cos((float) (((float) ((System.nanoTime() / 100000L) % 20000L)) / 20000F * Math.PI * 2)); if (goal instanceof IGoalRenderPos) { BlockPos goalPos = ((IGoalRenderPos) goal).getGoalPos(); minX = goalPos.getX() + 0.002 - renderPosX; maxX = goalPos.getX() + 1 - 0.002 - renderPosX; minZ = goalPos.getZ() + 0.002 - renderPosZ; maxZ = goalPos.getZ() + 1 - 0.002 - renderPosZ; - double y = MathHelper.cos((float) (((float) ((System.nanoTime() / 100000L) % 20000L)) / 20000F * Math.PI * 2)); if (goal instanceof GoalGetToBlock || goal instanceof GoalTwoBlocks) { y /= 2; } @@ -341,6 +341,16 @@ public final class PathRenderer implements Helper { drawDankLitGoalBox(player, g, partialTicks, color); } return; + } else if (goal instanceof GoalYLevel) { + GoalYLevel goalpos = (GoalYLevel) goal; + minX = player.posX - Baritone.settings().yLevelBoxSize.value - renderPosX; + minZ = player.posZ - Baritone.settings().yLevelBoxSize.value - renderPosZ; + maxX = player.posX + Baritone.settings().yLevelBoxSize.value - renderPosX; + maxZ = player.posZ + Baritone.settings().yLevelBoxSize.value - renderPosZ; + minY = ((GoalYLevel) goal).level - renderPosY; + maxY = minY + 2; + y1 = 1 + y + goalpos.level - renderPosY; + y2 = 1 - y + goalpos.level - renderPosY; } else { return; }