DrawAABB changes, set command bugfix, sel rendering change, selection setting name changes
This commit is contained in:
parent
8dc4ff26d6
commit
382ad0079c
@ -528,21 +528,6 @@ public final class Settings {
|
||||
*/
|
||||
public final Setting<Boolean> renderPathIgnoreDepth = new Setting<>(true);
|
||||
|
||||
/**
|
||||
* Ignore depth when rendering selections
|
||||
*/
|
||||
public final Setting<Boolean> renderSelectionIgnoreDepth = new Setting<>(true);
|
||||
|
||||
/**
|
||||
* Render selections
|
||||
*/
|
||||
public final Setting<Boolean> renderSelection = new Setting<>(true);
|
||||
|
||||
/**
|
||||
* Render selection corners
|
||||
*/
|
||||
public final Setting<Boolean> renderSelectionCorners = new Setting<>(true);
|
||||
|
||||
/**
|
||||
* Line width of the path when rendered, in pixels
|
||||
*/
|
||||
@ -553,11 +538,6 @@ public final class Settings {
|
||||
*/
|
||||
public final Setting<Float> goalRenderLineWidthPixels = new Setting<>(3F);
|
||||
|
||||
/**
|
||||
* Line width of the goal when rendered, in pixels
|
||||
*/
|
||||
public final Setting<Float> selectionRenderLineWidthPixels = new Setting<>(3F);
|
||||
|
||||
/**
|
||||
* Start fading out the path at 20 movements ahead, and stop rendering it entirely 30 movements ahead.
|
||||
* Improves FPS.
|
||||
@ -958,22 +938,42 @@ public final class Settings {
|
||||
/**
|
||||
* The color of all selections
|
||||
*/
|
||||
public final Setting<Color> colorSelection = new Setting<>(Color.GREEN);
|
||||
public final Setting<Color> colorSelection = new Setting<>(Color.CYAN);
|
||||
|
||||
/**
|
||||
* The color of the selection pos 1
|
||||
*/
|
||||
public final Setting<Color> colorSelectionPos1 = new Setting<>(Color.PINK);
|
||||
public final Setting<Color> colorSelectionPos1 = new Setting<>(Color.BLACK);
|
||||
|
||||
/**
|
||||
* The color of the selection pos 2
|
||||
*/
|
||||
public final Setting<Color> colorSelectionPos2 = new Setting<>(Color.PINK);
|
||||
public final Setting<Color> colorSelectionPos2 = new Setting<>(Color.ORANGE);
|
||||
|
||||
/**
|
||||
* The opacity of the selection. The default (0.4) is what's used for goals and such
|
||||
* The opacity of the selection. 0 is completely transparent, 1 is completely opaque
|
||||
*/
|
||||
public final Setting<Float> selectionOpacity = new Setting<>(.4f);
|
||||
public final Setting<Float> selectionOpacity = new Setting<>(.5f);
|
||||
|
||||
/**
|
||||
* Line width of the goal when rendered, in pixels
|
||||
*/
|
||||
public final Setting<Float> selectionLineWidth = new Setting<>(1F);
|
||||
|
||||
/**
|
||||
* Render selections
|
||||
*/
|
||||
public final Setting<Boolean> renderSelection = new Setting<>(true);
|
||||
|
||||
/**
|
||||
* Ignore depth when rendering selections
|
||||
*/
|
||||
public final Setting<Boolean> renderSelectionIgnoreDepth = new Setting<>(true);
|
||||
|
||||
/**
|
||||
* Render selection corners
|
||||
*/
|
||||
public final Setting<Boolean> renderSelectionCorners = new Setting<>(true);
|
||||
|
||||
|
||||
/**
|
||||
|
@ -25,12 +25,16 @@ public interface IRenderer {
|
||||
IBaritone baritone = BaritoneAPI.getProvider().getPrimaryBaritone();
|
||||
Settings settings = BaritoneAPI.getSettings();
|
||||
|
||||
static void glColor(Color color, float alpha) {
|
||||
float[] colorComponents = color.getColorComponents(null);
|
||||
GlStateManager.color(colorComponents[0], colorComponents[1], colorComponents[2], alpha);
|
||||
}
|
||||
|
||||
static void startLines(Color color, float alpha, float lineWidth, boolean ignoreDepth) {
|
||||
GlStateManager.enableBlend();
|
||||
GlStateManager.disableLighting();
|
||||
GlStateManager.tryBlendFuncSeparate(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA, GL_ONE, GL_ZERO);
|
||||
float[] colorComponents = color.getColorComponents(null);
|
||||
GlStateManager.color(colorComponents[0], colorComponents[1], colorComponents[2], alpha);
|
||||
glColor(color, alpha);
|
||||
GlStateManager.glLineWidth(lineWidth);
|
||||
GlStateManager.disableTexture2D();
|
||||
GlStateManager.depthMask(false);
|
||||
@ -55,10 +59,8 @@ public interface IRenderer {
|
||||
GlStateManager.disableBlend();
|
||||
}
|
||||
|
||||
static void drawAABB(AxisAlignedBB aabb, float expand) {
|
||||
AxisAlignedBB toDraw = aabb
|
||||
.offset(-renderManager.viewerPosX, -renderManager.viewerPosY, -renderManager.viewerPosZ)
|
||||
.grow(expand, expand, expand);
|
||||
static void drawAABB(AxisAlignedBB aabb) {
|
||||
AxisAlignedBB toDraw = aabb.offset(-renderManager.viewerPosX, -renderManager.viewerPosY, -renderManager.viewerPosZ);
|
||||
|
||||
buffer.begin(GL_LINES, DefaultVertexFormats.POSITION);
|
||||
// bottom
|
||||
@ -91,7 +93,7 @@ public interface IRenderer {
|
||||
tessellator.draw();
|
||||
}
|
||||
|
||||
static void drawAABB(AxisAlignedBB aabb) {
|
||||
drawAABB(aabb, 0.002f);
|
||||
static void drawAABB(AxisAlignedBB aabb, float expand) {
|
||||
drawAABB(aabb.grow(expand, expand, expand));
|
||||
}
|
||||
}
|
||||
|
@ -365,11 +365,11 @@ public class SelCommand extends Command {
|
||||
|
||||
Color color = settings.colorSelectionPos1.value;
|
||||
float opacity = settings.selectionOpacity.value;
|
||||
float lineWidth = settings.selectionRenderLineWidthPixels.value;
|
||||
float lineWidth = settings.selectionLineWidth.value;
|
||||
boolean ignoreDepth = settings.renderSelectionIgnoreDepth.value;
|
||||
|
||||
IRenderer.startLines(color, opacity, lineWidth, ignoreDepth);
|
||||
IRenderer.drawAABB(new AxisAlignedBB(pos1, pos1.add(1, 1, 1)), -.01f);
|
||||
IRenderer.drawAABB(new AxisAlignedBB(pos1, pos1.add(1, 1, 1)));
|
||||
IRenderer.endLines(ignoreDepth);
|
||||
}
|
||||
}
|
||||
|
@ -61,30 +61,24 @@ public class SetCommand extends Command {
|
||||
|
||||
boolean viewModified = asList("m", "mod", "modified").contains(arg);
|
||||
boolean viewAll = asList("all", "l", "list").contains(arg);
|
||||
boolean paginate = viewModified | viewAll;
|
||||
boolean paginate = viewModified || viewAll;
|
||||
if (paginate) {
|
||||
String search = args.has() && args.peekAsOrNull(Integer.class) == null ? args.getString() : "";
|
||||
args.requireMax(1);
|
||||
|
||||
List<? extends Settings.Setting> toPaginate =
|
||||
viewModified
|
||||
? SettingsUtil.modifiedSettings(settings)
|
||||
: settings.allSettings.stream()
|
||||
(viewModified ? SettingsUtil.modifiedSettings(settings) : settings.allSettings).stream()
|
||||
.filter(s -> !s.getName().equals("logger"))
|
||||
.filter(s -> s.getName().toLowerCase(Locale.US).contains(search.toLowerCase(Locale.US)))
|
||||
.sorted((s1, s2) -> String.CASE_INSENSITIVE_ORDER.compare(s1.getName(), s2.getName()))
|
||||
.collect(Collectors.toCollection(ArrayList<Settings.Setting>::new));
|
||||
|
||||
toPaginate.sort((setting1, setting2) -> String.CASE_INSENSITIVE_ORDER.compare(
|
||||
setting1.getName(),
|
||||
setting2.getName()
|
||||
));
|
||||
|
||||
Paginator.paginate(
|
||||
args,
|
||||
new Paginator<>(toPaginate),
|
||||
() -> logDirect(
|
||||
!search.isEmpty()
|
||||
? String.format("All settings containing the string '%s':", search)
|
||||
? String.format("All %ssettings containing the string '%s':", viewModified ? "modified " : "", search)
|
||||
: String.format("All %ssettings:", viewModified ? "modified " : "")
|
||||
),
|
||||
setting -> new TextComponentString(setting.getName()) {{
|
||||
|
@ -17,7 +17,7 @@ public class SelectionRenderer implements IRenderer, AbstractGameEventListener {
|
||||
public static void renderSelections(ISelection[] selections) {
|
||||
float opacity = settings.selectionOpacity.value;
|
||||
boolean ignoreDepth = settings.renderSelectionIgnoreDepth.value;
|
||||
float lineWidth = settings.selectionRenderLineWidthPixels.value;
|
||||
float lineWidth = settings.selectionLineWidth.value;
|
||||
|
||||
if (!settings.renderSelection.value) {
|
||||
return;
|
||||
@ -26,26 +26,21 @@ public class SelectionRenderer implements IRenderer, AbstractGameEventListener {
|
||||
IRenderer.startLines(settings.colorSelection.value, opacity, lineWidth, ignoreDepth);
|
||||
|
||||
for (ISelection selection : selections) {
|
||||
IRenderer.drawAABB(selection.aabb());
|
||||
IRenderer.drawAABB(selection.aabb(), .005f);
|
||||
}
|
||||
|
||||
IRenderer.endLines(ignoreDepth);
|
||||
|
||||
if (!settings.renderSelectionCorners.value) {
|
||||
return;
|
||||
}
|
||||
|
||||
IRenderer.startLines(settings.colorSelectionPos1.value, opacity, lineWidth, ignoreDepth);
|
||||
if (settings.renderSelectionCorners.value) {
|
||||
IRenderer.glColor(settings.colorSelectionPos1.value, opacity);
|
||||
|
||||
for (ISelection selection : selections) {
|
||||
IRenderer.drawAABB(new AxisAlignedBB(selection.pos1(), selection.pos1().add(1, 1, 1)), -.01f);
|
||||
IRenderer.drawAABB(new AxisAlignedBB(selection.pos1(), selection.pos1().add(1, 1, 1)));
|
||||
}
|
||||
|
||||
IRenderer.endLines(ignoreDepth);
|
||||
IRenderer.startLines(settings.colorSelectionPos2.value, opacity, lineWidth, ignoreDepth);
|
||||
IRenderer.glColor(settings.colorSelectionPos2.value, opacity);
|
||||
|
||||
for (ISelection selection : selections) {
|
||||
IRenderer.drawAABB(new AxisAlignedBB(selection.pos2(), selection.pos2().add(1, 1, 1)), -.01f);
|
||||
IRenderer.drawAABB(new AxisAlignedBB(selection.pos2(), selection.pos2().add(1, 1, 1)));
|
||||
}
|
||||
}
|
||||
|
||||
IRenderer.endLines(ignoreDepth);
|
||||
|
@ -35,7 +35,6 @@ import baritone.behavior.PathingBehavior;
|
||||
import baritone.pathing.path.PathExecutor;
|
||||
import net.minecraft.block.state.IBlockState;
|
||||
import net.minecraft.client.renderer.GlStateManager;
|
||||
import net.minecraft.client.renderer.entity.RenderManager;
|
||||
import net.minecraft.client.renderer.tileentity.TileEntityBeaconRenderer;
|
||||
import net.minecraft.client.renderer.vertex.DefaultVertexFormats;
|
||||
import net.minecraft.entity.Entity;
|
||||
@ -162,8 +161,7 @@ public final class PathRenderer implements IRenderer {
|
||||
alpha = 0.4F * (1.0F - (float) (i - fadeStart) / (float) (fadeEnd - fadeStart));
|
||||
}
|
||||
|
||||
float[] components = color.getComponents(null);
|
||||
GlStateManager.color(components[0], components[1], components[2], alpha);
|
||||
IRenderer.glColor(color, alpha);
|
||||
}
|
||||
|
||||
drawLine(start.x, start.y, start.z, end.x, end.y, end.z);
|
||||
@ -207,7 +205,7 @@ public final class PathRenderer implements IRenderer {
|
||||
toDraw = state.getSelectedBoundingBox(player.world, pos);
|
||||
}
|
||||
|
||||
IRenderer.drawAABB(toDraw);
|
||||
IRenderer.drawAABB(toDraw, .002f);
|
||||
});
|
||||
|
||||
IRenderer.endLines(settings.renderSelectionBoxesIgnoreDepth.value);
|
||||
|
Loading…
Reference in New Issue
Block a user