2018-08-09 21:48:10 +00:00
/ *
* This file is part of Baritone .
*
* Baritone is free software : you can redistribute it and / or modify
2018-09-17 22:11:40 +00:00
* it under the terms of the GNU Lesser General Public License as published by
2018-08-09 21:48:10 +00:00
* 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
2018-09-17 22:11:40 +00:00
* GNU Lesser General Public License for more details .
2018-08-09 21:48:10 +00:00
*
2018-09-17 22:11:40 +00:00
* You should have received a copy of the GNU Lesser General Public License
2018-08-09 21:48:10 +00:00
* along with Baritone . If not , see < https : //www.gnu.org/licenses/>.
* /
2018-08-22 20:15:56 +00:00
package baritone.utils ;
2018-08-09 21:48:10 +00:00
2018-08-22 20:15:56 +00:00
import baritone.Baritone ;
2018-11-14 05:26:27 +00:00
import baritone.api.BaritoneAPI ;
2018-10-08 22:11:07 +00:00
import baritone.api.event.events.RenderEvent ;
2018-10-10 02:34:53 +00:00
import baritone.api.pathing.calc.IPath ;
2018-12-07 23:40:32 +00:00
import baritone.api.pathing.goals.* ;
2018-10-09 01:37:52 +00:00
import baritone.api.utils.BetterBlockPos ;
2019-04-18 01:10:47 +00:00
import baritone.api.utils.Helper ;
2018-09-25 01:32:39 +00:00
import baritone.api.utils.interfaces.IGoalRenderPos ;
2018-10-08 22:11:07 +00:00
import baritone.behavior.PathingBehavior ;
import baritone.pathing.path.PathExecutor ;
2018-08-09 21:48:10 +00:00
import net.minecraft.block.state.IBlockState ;
import net.minecraft.client.renderer.BufferBuilder ;
import net.minecraft.client.renderer.GlStateManager ;
import net.minecraft.client.renderer.Tessellator ;
2018-12-03 22:42:05 +00:00
import net.minecraft.client.renderer.tileentity.TileEntityBeaconRenderer ;
2018-08-09 21:48:10 +00:00
import net.minecraft.client.renderer.vertex.DefaultVertexFormats ;
2018-11-14 05:26:27 +00:00
import net.minecraft.entity.Entity ;
2018-08-09 21:48:10 +00:00
import net.minecraft.init.Blocks ;
import net.minecraft.util.math.AxisAlignedBB ;
import net.minecraft.util.math.BlockPos ;
2018-08-29 23:45:16 +00:00
import net.minecraft.util.math.MathHelper ;
2018-08-09 21:48:10 +00:00
import java.awt.* ;
2018-08-09 23:44:41 +00:00
import java.util.Collection ;
2018-10-08 22:11:07 +00:00
import java.util.Collections ;
2018-08-09 21:48:10 +00:00
import java.util.List ;
2018-08-10 01:25:43 +00:00
import static org.lwjgl.opengl.GL11.* ;
2018-08-09 21:48:10 +00:00
/ * *
* @author Brady
2018-11-14 03:53:27 +00:00
* @since 8 / 9 / 2018
2018-08-09 21:48:10 +00:00
* /
public final class PathRenderer implements Helper {
2018-10-03 15:12:42 +00:00
2018-08-10 01:25:43 +00:00
private static final Tessellator TESSELLATOR = Tessellator . getInstance ( ) ;
private static final BufferBuilder BUFFER = TESSELLATOR . getBuffer ( ) ;
2018-08-09 23:44:41 +00:00
2018-09-17 03:16:05 +00:00
private PathRenderer ( ) { }
2018-10-08 22:11:07 +00:00
public static void render ( RenderEvent event , PathingBehavior behavior ) {
float partialTicks = event . getPartialTicks ( ) ;
Goal goal = behavior . getGoal ( ) ;
2019-03-13 02:17:50 +00:00
if ( mc . currentScreen instanceof GuiClick ) {
2019-03-13 05:08:17 +00:00
( ( GuiClick ) mc . currentScreen ) . onRender ( ) ;
2019-02-27 02:34:11 +00:00
}
2018-11-14 05:26:27 +00:00
int thisPlayerDimension = behavior . baritone . getPlayerContext ( ) . world ( ) . provider . getDimensionType ( ) . getId ( ) ;
int currentRenderViewDimension = BaritoneAPI . getProvider ( ) . getPrimaryBaritone ( ) . getPlayerContext ( ) . world ( ) . provider . getDimensionType ( ) . getId ( ) ;
if ( thisPlayerDimension ! = currentRenderViewDimension ) {
// this is a path for a bot in a different dimension, don't render it
return ;
}
Entity renderView = mc . getRenderViewEntity ( ) ;
if ( renderView . world ! = BaritoneAPI . getProvider ( ) . getPrimaryBaritone ( ) . getPlayerContext ( ) . world ( ) ) {
System . out . println ( " I have no idea what's going on " ) ;
System . out . println ( " The primary baritone is in a different world than the render view entity " ) ;
System . out . println ( " Not rendering the path " ) ;
return ;
}
2018-10-08 22:11:07 +00:00
if ( goal ! = null & & Baritone . settings ( ) . renderGoal . value ) {
2019-03-05 05:30:04 +00:00
drawDankLitGoalBox ( renderView , goal , partialTicks , Baritone . settings ( ) . colorGoalBox . value ) ;
2018-10-08 22:11:07 +00:00
}
2019-04-09 15:45:30 +00:00
if ( ! Baritone . settings ( ) . renderPath . value ) {
return ;
}
2019-04-09 04:32:47 +00:00
PathExecutor current = behavior . getCurrent ( ) ; // this should prevent most race conditions?
PathExecutor next = behavior . getNext ( ) ; // like, now it's not possible for current!=null to be true, then suddenly false because of another thread
if ( current ! = null & & Baritone . settings ( ) . renderSelectionBoxes . value ) {
drawManySelectionBoxes ( renderView , current . toBreak ( ) , Baritone . settings ( ) . colorBlocksToBreak . value ) ;
drawManySelectionBoxes ( renderView , current . toPlace ( ) , Baritone . settings ( ) . colorBlocksToPlace . value ) ;
drawManySelectionBoxes ( renderView , current . toWalkInto ( ) , Baritone . settings ( ) . colorBlocksToWalkInto . value ) ;
}
2018-10-08 22:11:07 +00:00
2018-10-11 00:05:51 +00:00
//drawManySelectionBoxes(player, Collections.singletonList(behavior.pathStart()), partialTicks, Color.WHITE);
2018-10-08 22:11:07 +00:00
//long start = System.nanoTime();
// Render the current path, if there is one
if ( current ! = null & & current . getPath ( ) ! = null ) {
int renderBegin = Math . max ( current . getPosition ( ) - 3 , 0 ) ;
2019-03-05 05:30:04 +00:00
drawPath ( current . getPath ( ) , renderBegin , renderView , partialTicks , Baritone . settings ( ) . colorCurrentPath . value , Baritone . settings ( ) . fadePath . value , 10 , 20 ) ;
2018-10-08 22:11:07 +00:00
}
if ( next ! = null & & next . getPath ( ) ! = null ) {
2019-03-05 05:30:04 +00:00
drawPath ( next . getPath ( ) , 0 , renderView , partialTicks , Baritone . settings ( ) . colorNextPath . value , Baritone . settings ( ) . fadePath . value , 10 , 20 ) ;
2018-10-08 22:11:07 +00:00
}
//long split = System.nanoTime();
// If there is a path calculation currently running, render the path calculation process
2018-11-14 22:19:24 +00:00
behavior . getInProgress ( ) . ifPresent ( currentlyRunning - > {
2018-10-08 22:11:07 +00:00
currentlyRunning . bestPathSoFar ( ) . ifPresent ( p - > {
2019-03-05 05:30:04 +00:00
drawPath ( p , 0 , renderView , partialTicks , Baritone . settings ( ) . colorBestPathSoFar . value , Baritone . settings ( ) . fadePath . value , 10 , 20 ) ;
2018-10-08 22:11:07 +00:00
} ) ;
currentlyRunning . pathToMostRecentNodeConsidered ( ) . ifPresent ( mr - > {
2019-03-05 05:30:04 +00:00
drawPath ( mr , 0 , renderView , partialTicks , Baritone . settings ( ) . colorMostRecentConsidered . value , Baritone . settings ( ) . fadePath . value , 10 , 20 ) ;
drawManySelectionBoxes ( renderView , Collections . singletonList ( mr . getDest ( ) ) , Baritone . settings ( ) . colorMostRecentConsidered . value ) ;
2018-10-08 22:11:07 +00:00
} ) ;
} ) ;
//long end = System.nanoTime();
//System.out.println((end - split) + " " + (split - start));
// if (end - start > 0) {
// System.out.println("Frame took " + (split - start) + " " + (end - split));
//}
}
2018-11-14 05:26:27 +00:00
public static void drawPath ( IPath path , int startIndex , Entity player , float partialTicks , Color color , boolean fadeOut , int fadeStart0 , int fadeEnd0 ) {
2018-08-09 21:48:10 +00:00
GlStateManager . enableBlend ( ) ;
2018-08-10 01:25:43 +00:00
GlStateManager . tryBlendFuncSeparate ( GL_SRC_ALPHA , GL_ONE_MINUS_SRC_ALPHA , GL_ONE , GL_ZERO ) ;
2018-08-09 21:48:10 +00:00
GlStateManager . color ( color . getColorComponents ( null ) [ 0 ] , color . getColorComponents ( null ) [ 1 ] , color . getColorComponents ( null ) [ 2 ] , 0 . 4F ) ;
2019-03-05 05:30:04 +00:00
GlStateManager . glLineWidth ( Baritone . settings ( ) . pathRenderLineWidthPixels . value ) ;
2018-08-09 21:48:10 +00:00
GlStateManager . disableTexture2D ( ) ;
GlStateManager . depthMask ( false ) ;
2019-03-05 05:30:04 +00:00
if ( Baritone . settings ( ) . renderPathIgnoreDepth . value ) {
2018-10-11 03:38:24 +00:00
GlStateManager . disableDepth ( ) ;
}
2018-08-16 22:14:00 +00:00
List < BetterBlockPos > positions = path . positions ( ) ;
2018-08-09 21:48:10 +00:00
int next ;
2018-08-09 23:44:41 +00:00
Tessellator tessellator = Tessellator . getInstance ( ) ;
2018-09-17 00:51:39 +00:00
int fadeStart = fadeStart0 + startIndex ;
int fadeEnd = fadeEnd0 + startIndex ;
2018-08-09 21:48:10 +00:00
for ( int i = startIndex ; i < positions . size ( ) - 1 ; i = next ) {
2018-10-03 15:12:42 +00:00
BetterBlockPos start = positions . get ( i ) ;
2018-08-09 21:48:10 +00:00
next = i + 1 ;
2018-10-03 15:12:42 +00:00
BetterBlockPos end = positions . get ( next ) ;
2018-08-14 04:05:35 +00:00
2018-10-03 15:12:42 +00:00
int dirX = end . x - start . x ;
int dirY = end . y - start . y ;
int dirZ = end . z - start . z ;
while ( next + 1 < positions . size ( ) & & ( ! fadeOut | | next + 1 < fadeStart ) & & ( dirX = = positions . get ( next + 1 ) . x - end . x & & dirY = = positions . get ( next + 1 ) . y - end . y & & dirZ = = positions . get ( next + 1 ) . z - end . z ) ) {
2018-08-09 21:48:10 +00:00
next + + ;
end = positions . get ( next ) ;
}
2018-10-03 15:14:15 +00:00
double x1 = start . x ;
double y1 = start . y ;
double z1 = start . z ;
double x2 = end . x ;
double y2 = end . y ;
double z2 = end . z ;
2018-08-14 04:05:35 +00:00
if ( fadeOut ) {
float alpha ;
if ( i < = fadeStart ) {
alpha = 0 . 4F ;
} else {
if ( i > fadeEnd ) {
break ;
}
2018-08-16 00:53:42 +00:00
alpha = 0 . 4F * ( 1 . 0F - ( float ) ( i - fadeStart ) / ( float ) ( fadeEnd - fadeStart ) ) ;
2018-08-14 04:05:35 +00:00
}
GlStateManager . color ( color . getColorComponents ( null ) [ 0 ] , color . getColorComponents ( null ) [ 1 ] , color . getColorComponents ( null ) [ 2 ] , alpha ) ;
}
2019-03-21 06:06:14 +00:00
drawLine ( x1 , y1 , z1 , x2 , y2 , z2 ) ;
2018-08-09 23:44:41 +00:00
tessellator . draw ( ) ;
2018-08-09 21:48:10 +00:00
}
2019-03-05 05:30:04 +00:00
if ( Baritone . settings ( ) . renderPathIgnoreDepth . value ) {
2018-10-11 03:38:24 +00:00
GlStateManager . enableDepth ( ) ;
}
2018-08-09 23:44:41 +00:00
//GlStateManager.color(0.0f, 0.0f, 0.0f, 0.4f);
2018-08-09 21:48:10 +00:00
GlStateManager . depthMask ( true ) ;
GlStateManager . enableTexture2D ( ) ;
GlStateManager . disableBlend ( ) ;
}
2019-03-21 06:06:14 +00:00
public static void drawLine ( double bp1x , double bp1y , double bp1z , double bp2x , double bp2y , double bp2z ) {
2019-02-27 20:00:39 +00:00
double d0 = mc . getRenderManager ( ) . viewerPosX ;
double d1 = mc . getRenderManager ( ) . viewerPosY ;
double d2 = mc . getRenderManager ( ) . viewerPosZ ;
2018-08-10 01:25:43 +00:00
BUFFER . begin ( GL_LINE_STRIP , DefaultVertexFormats . POSITION ) ;
BUFFER . pos ( bp1x + 0 . 5D - d0 , bp1y + 0 . 5D - d1 , bp1z + 0 . 5D - d2 ) . endVertex ( ) ;
BUFFER . pos ( bp2x + 0 . 5D - d0 , bp2y + 0 . 5D - d1 , bp2z + 0 . 5D - d2 ) . endVertex ( ) ;
BUFFER . pos ( bp2x + 0 . 5D - d0 , bp2y + 0 . 53D - d1 , bp2z + 0 . 5D - d2 ) . endVertex ( ) ;
BUFFER . pos ( bp1x + 0 . 5D - d0 , bp1y + 0 . 53D - d1 , bp1z + 0 . 5D - d2 ) . endVertex ( ) ;
BUFFER . pos ( bp1x + 0 . 5D - d0 , bp1y + 0 . 5D - d1 , bp1z + 0 . 5D - d2 ) . endVertex ( ) ;
2018-08-09 21:48:10 +00:00
}
2019-02-27 20:00:39 +00:00
public static void drawManySelectionBoxes ( Entity player , Collection < BlockPos > positions , Color color ) {
2018-08-09 21:48:10 +00:00
GlStateManager . enableBlend ( ) ;
2018-08-09 23:44:41 +00:00
GlStateManager . tryBlendFuncSeparate ( 770 , 771 , 1 , 0 ) ;
2018-08-09 21:48:10 +00:00
GlStateManager . color ( color . getColorComponents ( null ) [ 0 ] , color . getColorComponents ( null ) [ 1 ] , color . getColorComponents ( null ) [ 2 ] , 0 . 4F ) ;
2019-03-05 05:30:04 +00:00
GlStateManager . glLineWidth ( Baritone . settings ( ) . pathRenderLineWidthPixels . value ) ;
2018-08-09 21:48:10 +00:00
GlStateManager . disableTexture2D ( ) ;
GlStateManager . depthMask ( false ) ;
2018-10-10 02:34:53 +00:00
2019-03-05 05:30:04 +00:00
if ( Baritone . settings ( ) . renderSelectionBoxesIgnoreDepth . value ) {
2018-10-10 02:34:53 +00:00
GlStateManager . disableDepth ( ) ;
}
2019-02-28 23:26:09 +00:00
2018-08-09 23:44:41 +00:00
//BlockPos blockpos = movingObjectPositionIn.getBlockPos();
2019-01-24 05:25:38 +00:00
BlockStateInterface bsi = new BlockStateInterface ( BaritoneAPI . getProvider ( ) . getPrimaryBaritone ( ) . getPlayerContext ( ) ) ; // TODO this assumes same dimension between primary baritone and render view? is this safe?
2018-08-10 01:25:43 +00:00
positions . forEach ( pos - > {
2019-01-24 05:25:38 +00:00
IBlockState state = bsi . get0 ( pos ) ;
2018-08-09 23:44:41 +00:00
AxisAlignedBB toDraw ;
2018-08-10 01:25:43 +00:00
if ( state . getBlock ( ) . equals ( Blocks . AIR ) ) {
2018-11-14 21:46:16 +00:00
toDraw = Blocks . DIRT . getDefaultState ( ) . getSelectedBoundingBox ( player . world , pos ) ;
2018-08-09 23:44:41 +00:00
} else {
2018-11-14 21:46:16 +00:00
toDraw = state . getSelectedBoundingBox ( player . world , pos ) ;
2018-08-09 23:44:41 +00:00
}
2019-02-28 23:26:09 +00:00
drawAABB ( toDraw ) ;
2018-08-10 01:25:43 +00:00
} ) ;
2018-08-09 23:44:41 +00:00
2019-03-05 05:30:04 +00:00
if ( Baritone . settings ( ) . renderSelectionBoxesIgnoreDepth . value ) {
2018-10-10 02:34:53 +00:00
GlStateManager . enableDepth ( ) ;
}
2018-08-16 00:53:42 +00:00
GlStateManager . depthMask ( true ) ;
GlStateManager . enableTexture2D ( ) ;
GlStateManager . disableBlend ( ) ;
}
2019-02-28 23:26:09 +00:00
public static void drawAABB ( AxisAlignedBB aabb ) {
float expand = 0 . 002F ;
AxisAlignedBB toDraw = aabb . expand ( expand , expand , expand ) . offset ( - mc . getRenderManager ( ) . viewerPosX , - mc . getRenderManager ( ) . viewerPosY , - mc . getRenderManager ( ) . viewerPosZ ) ;
BUFFER . begin ( GL_LINE_STRIP , DefaultVertexFormats . POSITION ) ;
BUFFER . pos ( toDraw . minX , toDraw . minY , toDraw . minZ ) . endVertex ( ) ;
BUFFER . pos ( toDraw . maxX , toDraw . minY , toDraw . minZ ) . endVertex ( ) ;
BUFFER . pos ( toDraw . maxX , toDraw . minY , toDraw . maxZ ) . endVertex ( ) ;
BUFFER . pos ( toDraw . minX , toDraw . minY , toDraw . maxZ ) . endVertex ( ) ;
BUFFER . pos ( toDraw . minX , toDraw . minY , toDraw . minZ ) . endVertex ( ) ;
TESSELLATOR . draw ( ) ;
BUFFER . begin ( GL_LINE_STRIP , DefaultVertexFormats . POSITION ) ;
BUFFER . pos ( toDraw . minX , toDraw . maxY , toDraw . minZ ) . endVertex ( ) ;
BUFFER . pos ( toDraw . maxX , toDraw . maxY , toDraw . minZ ) . endVertex ( ) ;
BUFFER . pos ( toDraw . maxX , toDraw . maxY , toDraw . maxZ ) . endVertex ( ) ;
BUFFER . pos ( toDraw . minX , toDraw . maxY , toDraw . maxZ ) . endVertex ( ) ;
BUFFER . pos ( toDraw . minX , toDraw . maxY , toDraw . minZ ) . endVertex ( ) ;
TESSELLATOR . draw ( ) ;
BUFFER . begin ( GL_LINES , DefaultVertexFormats . POSITION ) ;
BUFFER . pos ( toDraw . minX , toDraw . minY , toDraw . minZ ) . endVertex ( ) ;
BUFFER . pos ( toDraw . minX , toDraw . maxY , toDraw . minZ ) . endVertex ( ) ;
BUFFER . pos ( toDraw . maxX , toDraw . minY , toDraw . minZ ) . endVertex ( ) ;
BUFFER . pos ( toDraw . maxX , toDraw . maxY , toDraw . minZ ) . endVertex ( ) ;
BUFFER . pos ( toDraw . maxX , toDraw . minY , toDraw . maxZ ) . endVertex ( ) ;
BUFFER . pos ( toDraw . maxX , toDraw . maxY , toDraw . maxZ ) . endVertex ( ) ;
BUFFER . pos ( toDraw . minX , toDraw . minY , toDraw . maxZ ) . endVertex ( ) ;
BUFFER . pos ( toDraw . minX , toDraw . maxY , toDraw . maxZ ) . endVertex ( ) ;
TESSELLATOR . draw ( ) ;
}
2019-02-18 05:41:54 +00:00
public static void drawDankLitGoalBox ( Entity player , Goal goal , float partialTicks , Color color ) {
2019-02-27 20:00:39 +00:00
double renderPosX = mc . getRenderManager ( ) . viewerPosX ;
double renderPosY = mc . getRenderManager ( ) . viewerPosY ;
double renderPosZ = mc . getRenderManager ( ) . viewerPosZ ;
2018-08-16 22:34:23 +00:00
double minX ;
double maxX ;
double minZ ;
double maxZ ;
double minY ;
double maxY ;
double y1 ;
double y2 ;
2018-09-08 01:23:32 +00:00
if ( goal instanceof IGoalRenderPos ) {
BlockPos goalPos = ( ( IGoalRenderPos ) goal ) . getGoalPos ( ) ;
2018-08-16 22:34:23 +00:00
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 ;
2018-09-08 01:23:32 +00:00
double y = MathHelper . cos ( ( float ) ( ( ( float ) ( ( System . nanoTime ( ) / 100000L ) % 20000L ) ) / 20000F * Math . PI * 2 ) ) ;
2018-12-07 23:40:32 +00:00
if ( goal instanceof GoalGetToBlock | | goal instanceof GoalTwoBlocks ) {
2018-09-08 03:43:12 +00:00
y / = 2 ;
}
2018-08-16 22:34:23 +00:00
y1 = 1 + y + goalPos . getY ( ) - renderPosY ;
y2 = 1 - y + goalPos . getY ( ) - renderPosY ;
minY = goalPos . getY ( ) - renderPosY ;
maxY = minY + 2 ;
2018-12-07 23:40:32 +00:00
if ( goal instanceof GoalGetToBlock | | goal instanceof GoalTwoBlocks ) {
2018-09-08 03:43:12 +00:00
y1 - = 0 . 5 ;
y2 - = 0 . 5 ;
maxY - - ;
}
2018-08-16 22:34:23 +00:00
} else if ( goal instanceof GoalXZ ) {
GoalXZ goalPos = ( GoalXZ ) goal ;
2018-08-16 00:53:42 +00:00
2019-03-05 05:30:04 +00:00
if ( Baritone . settings ( ) . renderGoalXZBeacon . value ) {
2019-02-20 03:00:14 +00:00
glPushAttrib ( GL_LIGHTING_BIT ) ;
2018-12-03 22:42:05 +00:00
mc . getTextureManager ( ) . bindTexture ( TileEntityBeaconRenderer . TEXTURE_BEACON_BEAM ) ;
2019-03-05 05:30:04 +00:00
if ( Baritone . settings ( ) . renderGoalIgnoreDepth . value ) {
2018-12-03 22:42:05 +00:00
GlStateManager . disableDepth ( ) ;
}
TileEntityBeaconRenderer . renderBeamSegment (
goalPos . getX ( ) - renderPosX ,
- renderPosY ,
goalPos . getZ ( ) - renderPosZ ,
partialTicks ,
1 . 0 ,
player . world . getTotalWorldTime ( ) ,
0 ,
256 ,
color . getColorComponents ( null )
) ;
2019-03-05 05:30:04 +00:00
if ( Baritone . settings ( ) . renderGoalIgnoreDepth . value ) {
2018-12-03 22:42:05 +00:00
GlStateManager . enableDepth ( ) ;
}
2019-02-20 03:00:14 +00:00
glPopAttrib ( ) ;
2018-12-03 22:42:05 +00:00
return ;
}
2018-08-16 22:34:23 +00:00
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 ;
2018-08-16 00:53:42 +00:00
2018-08-16 22:34:23 +00:00
y1 = 0 ;
y2 = 0 ;
minY = 0 - renderPosY ;
maxY = 256 - renderPosY ;
2018-09-08 21:16:54 +00:00
} else if ( goal instanceof GoalComposite ) {
2018-09-08 01:23:32 +00:00
for ( Goal g : ( ( GoalComposite ) goal ) . goals ( ) ) {
2019-02-18 05:41:54 +00:00
drawDankLitGoalBox ( player , g , partialTicks , color ) ;
2018-09-08 01:23:32 +00:00
}
2018-08-16 22:34:23 +00:00
return ;
2018-09-08 21:16:54 +00:00
} else {
return ;
2018-08-16 22:34:23 +00:00
}
2018-08-16 00:53:42 +00:00
2018-08-18 02:30:41 +00:00
GlStateManager . enableBlend ( ) ;
GlStateManager . tryBlendFuncSeparate ( 770 , 771 , 1 , 0 ) ;
GlStateManager . color ( color . getColorComponents ( null ) [ 0 ] , color . getColorComponents ( null ) [ 1 ] , color . getColorComponents ( null ) [ 2 ] , 0 . 6F ) ;
2019-03-05 05:30:04 +00:00
GlStateManager . glLineWidth ( Baritone . settings ( ) . goalRenderLineWidthPixels . value ) ;
2018-08-18 02:30:41 +00:00
GlStateManager . disableTexture2D ( ) ;
GlStateManager . depthMask ( false ) ;
2019-03-05 05:30:04 +00:00
if ( Baritone . settings ( ) . renderGoalIgnoreDepth . value ) {
2018-10-08 22:06:41 +00:00
GlStateManager . disableDepth ( ) ;
2018-08-16 22:34:23 +00:00
}
2018-10-08 22:06:41 +00:00
renderHorizontalQuad ( minX , maxX , minZ , maxZ , y1 ) ;
renderHorizontalQuad ( minX , maxX , minZ , maxZ , y2 ) ;
2018-08-16 00:53:42 +00:00
BUFFER . begin ( GL_LINES , DefaultVertexFormats . POSITION ) ;
BUFFER . pos ( minX , minY , minZ ) . endVertex ( ) ;
BUFFER . pos ( minX , maxY , minZ ) . endVertex ( ) ;
BUFFER . pos ( maxX , minY , minZ ) . endVertex ( ) ;
BUFFER . pos ( maxX , maxY , minZ ) . endVertex ( ) ;
BUFFER . pos ( maxX , minY , maxZ ) . endVertex ( ) ;
BUFFER . pos ( maxX , maxY , maxZ ) . endVertex ( ) ;
BUFFER . pos ( minX , minY , maxZ ) . endVertex ( ) ;
BUFFER . pos ( minX , maxY , maxZ ) . endVertex ( ) ;
TESSELLATOR . draw ( ) ;
2019-03-05 05:30:04 +00:00
if ( Baritone . settings ( ) . renderGoalIgnoreDepth . value ) {
2018-10-08 22:06:41 +00:00
GlStateManager . enableDepth ( ) ;
}
2018-08-09 21:48:10 +00:00
GlStateManager . depthMask ( true ) ;
GlStateManager . enableTexture2D ( ) ;
GlStateManager . disableBlend ( ) ;
}
2018-10-08 22:06:41 +00:00
private static void renderHorizontalQuad ( double minX , double maxX , double minZ , double maxZ , double y ) {
if ( y ! = 0 ) {
BUFFER . begin ( GL_LINE_LOOP , DefaultVertexFormats . POSITION ) ;
BUFFER . pos ( minX , y , minZ ) . endVertex ( ) ;
BUFFER . pos ( maxX , y , minZ ) . endVertex ( ) ;
BUFFER . pos ( maxX , y , maxZ ) . endVertex ( ) ;
BUFFER . pos ( minX , y , maxZ ) . endVertex ( ) ;
TESSELLATOR . draw ( ) ;
}
}
2018-08-09 21:48:10 +00:00
}