@@ -1572,7 +1572,7 @@ private boolean handleMapFeatureLeftClicked(MouseButtonEvent mouseButtonEvent, b
15721572 return true ;
15731573 }
15741574
1575- private void drawPlayerDirectionArrow (GuiGraphics guiGraphics , int playerMinX , int playerMinY , float partialTick ) {
1575+ protected void drawPlayerDirectionArrow (GuiGraphics guiGraphics , int playerMinX , int playerMinY , float partialTick ) {
15761576 LocalPlayer player = this .minecraft .player ;
15771577 if (player == null ) {
15781578 return ;
@@ -1613,6 +1613,37 @@ private void drawPlayerDirectionArrow(GuiGraphics guiGraphics, int playerMinX, i
16131613 poseStack .popMatrix ();
16141614 }
16151615
1616+ protected void drawCenteredPlayerDirectionArrow (GuiGraphics guiGraphics , double centerX , double centerY , double iconHalf , float partialTick ) {
1617+ LocalPlayer player = this .minecraft .player ;
1618+ if (player == null ) {
1619+ return ;
1620+ }
1621+ Vec3 look = player .getViewVector (partialTick );
1622+ double dirX = look .x ;
1623+ double dirZ = look .z ;
1624+ double length = Math .hypot (dirX , dirZ );
1625+ if (length < 1.0E-4D ) {
1626+ return ;
1627+ }
1628+ double normX = dirX / length ;
1629+ double normZ = dirZ / length ;
1630+
1631+ double arrowScale = (PLAYER_DIRECTION_ARROW_DRAW_HEIGHT / PLAYER_DIRECTION_ARROW_TEXTURE_HEIGHT ) * (iconHalf / 10.0D );
1632+ float angle = (float ) Math .atan2 (normX , -normZ );
1633+
1634+ Matrix3x2fStack poseStack = guiGraphics .pose ();
1635+ poseStack .pushMatrix ();
1636+ poseStack .translate ((float ) centerX , (float ) centerY );
1637+ poseStack .rotate (angle );
1638+ poseStack .scale ((float ) arrowScale , (float ) arrowScale );
1639+ poseStack .translate (-PLAYER_DIRECTION_ARROW_TEXTURE_WIDTH / 2.0F , -PLAYER_DIRECTION_ARROW_TEXTURE_HEIGHT / 2.0F );
1640+
1641+ GpuTextureView gpuTextureView = Minecraft .getInstance ().getTextureManager ().getTexture (PLAYER_DIRECTION_ARROW_TEXTURE ).getTextureView ();
1642+ BlitRenderState renderState = new BlitRenderState (RenderPipelines .GUI_TEXTURED , TextureSetup .singleTexture (gpuTextureView ), new Matrix3x2f (poseStack ), 0 , 0 , PLAYER_DIRECTION_ARROW_TEXTURE_WIDTH , PLAYER_DIRECTION_ARROW_TEXTURE_HEIGHT , 0 , 1 , 0 , 1 , -1 , guiGraphics .scissorStack .peek ());
1643+ guiGraphics .guiRenderState .submitBlitToCurrentLayer (renderState );
1644+ poseStack .popMatrix ();
1645+ }
1646+
16161647 private boolean hasEndCityShip (BlockPos pos ) {
16171648 int biome = Cubiomes .getBiomeAt (this .biomeGenerator , BIOME_SCALE , QuartPos .fromBlock (pos .getX ()), QuartPos .fromBlock (320 ), QuartPos .fromBlock (pos .getZ ()));
16181649 try (Arena tempArena = Arena .ofConfined ()) {
0 commit comments