render GoalXZ
This commit is contained in:
parent
82f5c21f4a
commit
e1c6006084
@ -51,6 +51,8 @@ public class Settings {
|
|||||||
public Setting<Boolean> renderGoal = new Setting<>(true);
|
public Setting<Boolean> renderGoal = new Setting<>(true);
|
||||||
public Setting<Integer> pathingMaxChunkBorderFetch = new Setting<>(50);
|
public Setting<Integer> pathingMaxChunkBorderFetch = new Setting<>(50);
|
||||||
public Setting<Double> backtrackCostFavoringCoefficient = new Setting<>(0.9);
|
public Setting<Double> backtrackCostFavoringCoefficient = new Setting<>(0.9);
|
||||||
|
public Setting<Float> pathRenderLineWidth = new Setting<>(5F);
|
||||||
|
public Setting<Float> goalRenderLineWidth = new Setting<>(3F);
|
||||||
|
|
||||||
public final Map<String, Setting<?>> byName;
|
public final Map<String, Setting<?>> byName;
|
||||||
public final List<Setting<?>> allSettings;
|
public final List<Setting<?>> allSettings;
|
||||||
|
@ -25,7 +25,6 @@ import baritone.bot.pathing.calc.AStarPathFinder;
|
|||||||
import baritone.bot.pathing.calc.AbstractNodeCostSearch;
|
import baritone.bot.pathing.calc.AbstractNodeCostSearch;
|
||||||
import baritone.bot.pathing.calc.IPathFinder;
|
import baritone.bot.pathing.calc.IPathFinder;
|
||||||
import baritone.bot.pathing.goals.Goal;
|
import baritone.bot.pathing.goals.Goal;
|
||||||
import baritone.bot.pathing.goals.GoalBlock;
|
|
||||||
import baritone.bot.pathing.path.IPath;
|
import baritone.bot.pathing.path.IPath;
|
||||||
import baritone.bot.pathing.path.PathExecutor;
|
import baritone.bot.pathing.path.PathExecutor;
|
||||||
import baritone.bot.utils.PathRenderer;
|
import baritone.bot.utils.PathRenderer;
|
||||||
@ -244,8 +243,8 @@ public class PathingBehavior extends Behavior {
|
|||||||
// System.out.println("Render passing");
|
// System.out.println("Render passing");
|
||||||
// System.out.println(event.getPartialTicks());
|
// System.out.println(event.getPartialTicks());
|
||||||
float partialTicks = event.getPartialTicks();
|
float partialTicks = event.getPartialTicks();
|
||||||
if (goal instanceof GoalBlock && Baritone.settings().renderGoal.value) {
|
if (goal != null && Baritone.settings().renderGoal.value) {
|
||||||
PathRenderer.drawLitDankGoalBox(player(), ((GoalBlock) goal).getGoalPos(), partialTicks, Color.GREEN);
|
PathRenderer.drawLitDankGoalBox(player(), goal, partialTicks, Color.GREEN);
|
||||||
}
|
}
|
||||||
if (!Baritone.settings().renderPath.get()) {
|
if (!Baritone.settings().renderPath.get()) {
|
||||||
return;
|
return;
|
||||||
|
@ -108,4 +108,12 @@ public class GoalXZ implements Goal {
|
|||||||
double z = origin.z + Math.cos(theta) * distance;
|
double z = origin.z + Math.cos(theta) * distance;
|
||||||
return new GoalXZ((int) x, (int) z);
|
return new GoalXZ((int) x, (int) z);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public int getX() {
|
||||||
|
return x;
|
||||||
|
}
|
||||||
|
|
||||||
|
public int getZ() {
|
||||||
|
return z;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
@ -17,6 +17,10 @@
|
|||||||
|
|
||||||
package baritone.bot.utils;
|
package baritone.bot.utils;
|
||||||
|
|
||||||
|
import baritone.bot.Baritone;
|
||||||
|
import baritone.bot.pathing.goals.Goal;
|
||||||
|
import baritone.bot.pathing.goals.GoalBlock;
|
||||||
|
import baritone.bot.pathing.goals.GoalXZ;
|
||||||
import baritone.bot.pathing.path.IPath;
|
import baritone.bot.pathing.path.IPath;
|
||||||
import baritone.bot.utils.pathing.BetterBlockPos;
|
import baritone.bot.utils.pathing.BetterBlockPos;
|
||||||
import net.minecraft.block.state.IBlockState;
|
import net.minecraft.block.state.IBlockState;
|
||||||
@ -53,7 +57,7 @@ public final class PathRenderer implements Helper {
|
|||||||
GlStateManager.enableBlend();
|
GlStateManager.enableBlend();
|
||||||
GlStateManager.tryBlendFuncSeparate(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA, GL_ONE, GL_ZERO);
|
GlStateManager.tryBlendFuncSeparate(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA, GL_ONE, GL_ZERO);
|
||||||
GlStateManager.color(color.getColorComponents(null)[0], color.getColorComponents(null)[1], color.getColorComponents(null)[2], 0.4F);
|
GlStateManager.color(color.getColorComponents(null)[0], color.getColorComponents(null)[1], color.getColorComponents(null)[2], 0.4F);
|
||||||
GlStateManager.glLineWidth(3.0F);
|
GlStateManager.glLineWidth(Baritone.settings().pathRenderLineWidth.get());
|
||||||
GlStateManager.disableTexture2D();
|
GlStateManager.disableTexture2D();
|
||||||
GlStateManager.depthMask(false);
|
GlStateManager.depthMask(false);
|
||||||
List<BetterBlockPos> positions = path.positions();
|
List<BetterBlockPos> positions = path.positions();
|
||||||
@ -116,7 +120,7 @@ public final class PathRenderer implements Helper {
|
|||||||
GlStateManager.enableBlend();
|
GlStateManager.enableBlend();
|
||||||
GlStateManager.tryBlendFuncSeparate(770, 771, 1, 0);
|
GlStateManager.tryBlendFuncSeparate(770, 771, 1, 0);
|
||||||
GlStateManager.color(color.getColorComponents(null)[0], color.getColorComponents(null)[1], color.getColorComponents(null)[2], 0.4F);
|
GlStateManager.color(color.getColorComponents(null)[0], color.getColorComponents(null)[1], color.getColorComponents(null)[2], 0.4F);
|
||||||
GlStateManager.glLineWidth(5.0F);
|
GlStateManager.glLineWidth(Baritone.settings().pathRenderLineWidth.get());
|
||||||
GlStateManager.disableTexture2D();
|
GlStateManager.disableTexture2D();
|
||||||
GlStateManager.depthMask(false);
|
GlStateManager.depthMask(false);
|
||||||
float expand = 0.002F;
|
float expand = 0.002F;
|
||||||
@ -165,11 +169,11 @@ public final class PathRenderer implements Helper {
|
|||||||
GlStateManager.disableBlend();
|
GlStateManager.disableBlend();
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void drawLitDankGoalBox(EntityPlayer player, BlockPos goal, float partialTicks, Color color) {
|
public static void drawLitDankGoalBox(EntityPlayer player, Goal goal, float partialTicks, Color color) {
|
||||||
GlStateManager.enableBlend();
|
GlStateManager.enableBlend();
|
||||||
GlStateManager.tryBlendFuncSeparate(770, 771, 1, 0);
|
GlStateManager.tryBlendFuncSeparate(770, 771, 1, 0);
|
||||||
GlStateManager.color(color.getColorComponents(null)[0], color.getColorComponents(null)[1], color.getColorComponents(null)[2], 0.6F);
|
GlStateManager.color(color.getColorComponents(null)[0], color.getColorComponents(null)[1], color.getColorComponents(null)[2], 0.6F);
|
||||||
GlStateManager.glLineWidth(5.0F);
|
GlStateManager.glLineWidth(Baritone.settings().goalRenderLineWidth.get());
|
||||||
GlStateManager.disableTexture2D();
|
GlStateManager.disableTexture2D();
|
||||||
GlStateManager.depthMask(false);
|
GlStateManager.depthMask(false);
|
||||||
float expand = 0.002F;
|
float expand = 0.002F;
|
||||||
@ -177,32 +181,61 @@ public final class PathRenderer implements Helper {
|
|||||||
double renderPosY = player.lastTickPosY + (player.posY - player.lastTickPosY) * (double) partialTicks;
|
double renderPosY = player.lastTickPosY + (player.posY - player.lastTickPosY) * (double) partialTicks;
|
||||||
double renderPosZ = player.lastTickPosZ + (player.posZ - player.lastTickPosZ) * (double) partialTicks;
|
double renderPosZ = player.lastTickPosZ + (player.posZ - player.lastTickPosZ) * (double) partialTicks;
|
||||||
|
|
||||||
double minX = goal.getX() + 0.002 - renderPosX;
|
double minX;
|
||||||
double maxX = goal.getX() + 1 - 0.002 - renderPosX;
|
double maxX;
|
||||||
double minZ = goal.getZ() + 0.002 - renderPosZ;
|
double minZ;
|
||||||
double maxZ = goal.getZ() + 1 - 0.002 - renderPosZ;
|
double maxZ;
|
||||||
double y = Math.sin((System.currentTimeMillis() % 2000L) / 2000F * Math.PI * 2);
|
double minY;
|
||||||
double y1 = 1 + y + goal.getY() - renderPosY;
|
double maxY;
|
||||||
double y2 = 1 - y + goal.getY() - renderPosY;
|
double y1;
|
||||||
double minY = goal.getY() - renderPosY;
|
double y2;
|
||||||
double maxY = minY + 2;
|
if (goal instanceof GoalBlock) {
|
||||||
|
BlockPos goalPos = ((GoalBlock) 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 = Math.sin((System.currentTimeMillis() % 2000L) / 2000F * Math.PI * 2);
|
||||||
|
y1 = 1 + y + goalPos.getY() - renderPosY;
|
||||||
|
y2 = 1 - y + goalPos.getY() - renderPosY;
|
||||||
|
minY = goalPos.getY() - renderPosY;
|
||||||
|
maxY = minY + 2;
|
||||||
|
} else if (goal instanceof GoalXZ) {
|
||||||
|
GoalXZ goalPos = (GoalXZ) goal;
|
||||||
|
|
||||||
|
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;
|
||||||
|
|
||||||
BUFFER.begin(GL_LINE_STRIP, DefaultVertexFormats.POSITION);
|
y1 = 0;
|
||||||
BUFFER.pos(minX, y1, minZ).endVertex();
|
y2 = 0;
|
||||||
BUFFER.pos(maxX, y1, minZ).endVertex();
|
minY = 0 - renderPosY;
|
||||||
BUFFER.pos(maxX, y1, maxZ).endVertex();
|
maxY = 256 - renderPosY;
|
||||||
BUFFER.pos(minX, y1, maxZ).endVertex();
|
} else {
|
||||||
BUFFER.pos(minX, y1, minZ).endVertex();
|
// TODO GoalComposite
|
||||||
TESSELLATOR.draw();
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
BUFFER.begin(GL_LINE_STRIP, DefaultVertexFormats.POSITION);
|
if (y1 != 0) {
|
||||||
BUFFER.pos(minX, y2, minZ).endVertex();
|
BUFFER.begin(GL_LINE_STRIP, DefaultVertexFormats.POSITION);
|
||||||
BUFFER.pos(maxX, y2, minZ).endVertex();
|
BUFFER.pos(minX, y1, minZ).endVertex();
|
||||||
BUFFER.pos(maxX, y2, maxZ).endVertex();
|
BUFFER.pos(maxX, y1, minZ).endVertex();
|
||||||
BUFFER.pos(minX, y2, maxZ).endVertex();
|
BUFFER.pos(maxX, y1, maxZ).endVertex();
|
||||||
BUFFER.pos(minX, y2, minZ).endVertex();
|
BUFFER.pos(minX, y1, maxZ).endVertex();
|
||||||
TESSELLATOR.draw();
|
BUFFER.pos(minX, y1, minZ).endVertex();
|
||||||
|
TESSELLATOR.draw();
|
||||||
|
}
|
||||||
|
|
||||||
|
if (y2 != 0) {
|
||||||
|
BUFFER.begin(GL_LINE_STRIP, DefaultVertexFormats.POSITION);
|
||||||
|
BUFFER.pos(minX, y2, minZ).endVertex();
|
||||||
|
BUFFER.pos(maxX, y2, minZ).endVertex();
|
||||||
|
BUFFER.pos(maxX, y2, maxZ).endVertex();
|
||||||
|
BUFFER.pos(minX, y2, maxZ).endVertex();
|
||||||
|
BUFFER.pos(minX, y2, minZ).endVertex();
|
||||||
|
TESSELLATOR.draw();
|
||||||
|
}
|
||||||
|
|
||||||
BUFFER.begin(GL_LINES, DefaultVertexFormats.POSITION);
|
BUFFER.begin(GL_LINES, DefaultVertexFormats.POSITION);
|
||||||
BUFFER.pos(minX, minY, minZ).endVertex();
|
BUFFER.pos(minX, minY, minZ).endVertex();
|
||||||
|
Loading…
x
Reference in New Issue
Block a user