render more goals, fixes #25

This commit is contained in:
Leijurv 2018-09-07 18:23:32 -07:00
parent 2d969b55ef
commit 85babda97e
No known key found for this signature in database
GPG Key ID: 44A3EA646EADAC6A
7 changed files with 39 additions and 11 deletions

View File

@ -17,6 +17,7 @@
package baritone.pathing.goals;
import baritone.utils.interfaces.IGoalRenderPos;
import net.minecraft.util.math.BlockPos;
/**
@ -24,7 +25,7 @@ import net.minecraft.util.math.BlockPos;
*
* @author leijurv
*/
public class GoalBlock implements Goal {
public class GoalBlock implements Goal, IGoalRenderPos {
/**
* The X block position of this goal

View File

@ -17,6 +17,7 @@
package baritone.pathing.goals;
import baritone.utils.interfaces.IGoalRenderPos;
import baritone.utils.pathing.BetterBlockPos;
import net.minecraft.util.math.BlockPos;
@ -26,7 +27,7 @@ import net.minecraft.util.math.BlockPos;
*
* @author avecowa
*/
public class GoalGetToBlock implements Goal {
public class GoalGetToBlock implements Goal, IGoalRenderPos {
private final int x;
private final int y;

View File

@ -17,9 +17,10 @@
package baritone.pathing.goals;
import baritone.utils.interfaces.IGoalRenderPos;
import net.minecraft.util.math.BlockPos;
public class GoalNear implements Goal {
public class GoalNear implements Goal, IGoalRenderPos {
final int x;
final int y;
final int z;

View File

@ -17,6 +17,7 @@
package baritone.pathing.goals;
import baritone.utils.interfaces.IGoalRenderPos;
import net.minecraft.util.math.BlockPos;
/**
@ -25,7 +26,7 @@ import net.minecraft.util.math.BlockPos;
*
* @author leijurv
*/
public class GoalTwoBlocks implements Goal {
public class GoalTwoBlocks implements Goal, IGoalRenderPos {
/**
* The X block position of this goal
@ -69,7 +70,7 @@ public class GoalTwoBlocks implements Goal {
}
public BlockPos getGoalPos() {
return new BlockPos(x, y, z);
return new BlockPos(x, y - 1, z);
}
@Override

View File

@ -124,6 +124,7 @@ public interface MovementHelper extends ActionCosts, Helper {
if (block == Blocks.AIR) {
return true;
}
// exceptions - blocks that are isPassasble true, but we can't actually jump through
if (block == Blocks.FIRE
|| block == Blocks.TRIPWIRE
|| block == Blocks.WEB

View File

@ -19,9 +19,10 @@ package baritone.utils;
import baritone.Baritone;
import baritone.pathing.goals.Goal;
import baritone.pathing.goals.GoalBlock;
import baritone.pathing.goals.GoalComposite;
import baritone.pathing.goals.GoalXZ;
import baritone.pathing.path.IPath;
import baritone.utils.interfaces.IGoalRenderPos;
import baritone.utils.pathing.BetterBlockPos;
import net.minecraft.block.state.IBlockState;
import net.minecraft.client.Minecraft;
@ -183,13 +184,13 @@ public final class PathRenderer implements Helper {
double maxY;
double y1;
double y2;
if (goal instanceof GoalBlock) {
BlockPos goalPos = ((GoalBlock) goal).getGoalPos();
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.sin((float) (((float) (System.nanoTime() / 1000000L) % 2000L) / 2000F * Math.PI * 2));
double y = MathHelper.cos((float) (((float) ((System.nanoTime() / 100000L) % 20000L)) / 20000F * Math.PI * 2));
y1 = 1 + y + goalPos.getY() - renderPosY;
y2 = 1 - y + goalPos.getY() - renderPosY;
minY = goalPos.getY() - renderPosY;
@ -207,7 +208,9 @@ public final class PathRenderer implements Helper {
minY = 0 - renderPosY;
maxY = 256 - renderPosY;
} else {
// TODO GoalComposite
for (Goal g : ((GoalComposite) goal).goals()) {
drawLitDankGoalBox(player, g, partialTicks, color);
}
return;
}

View File

@ -1,4 +1,24 @@
/*
* This file is part of Baritone.
*
* Baritone is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* Baritone is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with Baritone. If not, see <https://www.gnu.org/licenses/>.
*/
package baritone.utils.interfaces;
public class IGoalRenderPos {
import net.minecraft.util.math.BlockPos;
public interface IGoalRenderPos {
BlockPos getGoalPos();
}