render boxes for goalYLevel

This commit is contained in:
evilsourcerer 2019-05-03 01:48:37 -04:00
parent 0ffbb0c151
commit 77303b4a62
4 changed files with 16 additions and 4 deletions

2
.gitignore vendored
View File

@ -18,4 +18,4 @@ classes/
# Copyright Files # Copyright Files
!/.idea/copyright/Baritone.xml !/.idea/copyright/Baritone.xml
!/.idea/copyright/profiles_settings.xml !/.idea/copyright/profiles_settings.xml

View File

@ -30,8 +30,8 @@ import java.awt.*;
import java.lang.reflect.Field; import java.lang.reflect.Field;
import java.lang.reflect.ParameterizedType; import java.lang.reflect.ParameterizedType;
import java.lang.reflect.Type; import java.lang.reflect.Type;
import java.util.*;
import java.util.List; import java.util.List;
import java.util.*;
import java.util.function.Consumer; import java.util.function.Consumer;
/** /**
@ -81,6 +81,8 @@ public final class Settings {
*/ */
public final Setting<Double> jumpPenalty = new Setting<>(2D); public final Setting<Double> jumpPenalty = new Setting<>(2D);
public final Setting<Double> yLevelBoxSize = new Setting<>(15D);
/** /**
* Walking on water uses up hunger really quick, so penalize it * Walking on water uses up hunger really quick, so penalize it
*/ */

View File

@ -29,7 +29,7 @@ public class GoalYLevel implements Goal, ActionCosts {
/** /**
* The target Y level * The target Y level
*/ */
private final int level; public final int level;
public GoalYLevel(int level) { public GoalYLevel(int level) {
this.level = level; this.level = level;

View File

@ -276,13 +276,13 @@ public final class PathRenderer implements Helper {
double maxY; double maxY;
double y1; double y1;
double y2; double y2;
double y = MathHelper.cos((float) (((float) ((System.nanoTime() / 100000L) % 20000L)) / 20000F * Math.PI * 2));
if (goal instanceof IGoalRenderPos) { if (goal instanceof IGoalRenderPos) {
BlockPos goalPos = ((IGoalRenderPos) goal).getGoalPos(); BlockPos goalPos = ((IGoalRenderPos) goal).getGoalPos();
minX = goalPos.getX() + 0.002 - renderPosX; minX = goalPos.getX() + 0.002 - renderPosX;
maxX = goalPos.getX() + 1 - 0.002 - renderPosX; maxX = goalPos.getX() + 1 - 0.002 - renderPosX;
minZ = goalPos.getZ() + 0.002 - renderPosZ; minZ = goalPos.getZ() + 0.002 - renderPosZ;
maxZ = goalPos.getZ() + 1 - 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) { if (goal instanceof GoalGetToBlock || goal instanceof GoalTwoBlocks) {
y /= 2; y /= 2;
} }
@ -341,6 +341,16 @@ public final class PathRenderer implements Helper {
drawDankLitGoalBox(player, g, partialTicks, color); drawDankLitGoalBox(player, g, partialTicks, color);
} }
return; 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 { } else {
return; return;
} }