@@ -343,6 +343,7 @@ public static void reopenIfOpen(int generatorFlags) {
343343 });
344344 private static final int CUSTOM_STRUCTURE_MAX_IN_FLIGHT = 2 ;
345345 private static final int CUSTOM_STRUCTURE_ENQUEUE_PER_TICK = 200 ;
346+ private static final int CUSTOM_STRUCTURE_MINIMAP_ENQUEUE_PER_TICK = 16 ;
346347 private final java .util .List <FeatureToggleWidget > featureToggleWidgets = new java .util .ArrayList <>();
347348 private final java .util .List <CustomStructureToggleWidget > customStructureToggleWidgets = new java .util .ArrayList <>();
348349
@@ -387,6 +388,8 @@ public static void reopenIfOpen(int generatorFlags) {
387388 private static final double DOUBLE_CLICK_DISTANCE_SQ = 16.0D ;
388389
389390 private static final Identifier DIRECTION_ARROW_TEXTURE = Identifier .fromNamespaceAndPath (SeedMapper .MOD_ID , "textures/gui/arrow.png" );
391+ private static final Identifier DATAPACK_POTION_TEXTURE = Identifier .fromNamespaceAndPath ("minecraft" , "textures/item/potion.png" );
392+ private static final Identifier DATAPACK_POTION_OVERLAY_TEXTURE = Identifier .fromNamespaceAndPath ("minecraft" , "textures/item/potion_overlay.png" );
390393 private static final MapFeature .Texture WURST_WAYPOINT_TEXTURE = new MapFeature .Texture (
391394 Identifier .fromNamespaceAndPath (SeedMapper .MOD_ID , "textures/feature_icons/waypoint_wurst.png" ), 20 , 20
392395 );
@@ -553,7 +556,22 @@ private void drawTile(GuiGraphics guiGraphics, Tile tile) {
553556 int drawMinY = (int ) Math .round (minY );
554557 int drawMaxX = (int ) Math .round (maxX );
555558 int drawMaxY = (int ) Math .round (maxY );
556- guiGraphics .submitBlit (RenderPipelines .GUI_TEXTURED , tile .texture ().getTextureView (), tile .texture ().getSampler (), drawMinX , drawMinY , drawMaxX , drawMaxY , u0 , u1 , v0 , v1 , tint );
559+ BlitRenderState renderState = new BlitRenderState (
560+ RenderPipelines .GUI_TEXTURED ,
561+ TextureSetup .singleTexture (tile .texture ().getTextureView (), tile .texture ().getSampler ()),
562+ new Matrix3x2f (guiGraphics .pose ()),
563+ drawMinX ,
564+ drawMinY ,
565+ drawMaxX ,
566+ drawMaxY ,
567+ u0 ,
568+ u1 ,
569+ v0 ,
570+ v1 ,
571+ tint ,
572+ guiGraphics .scissorStack .peek ()
573+ );
574+ guiGraphics .guiRenderState .submitBlitToCurrentLayer (renderState );
557575 }
558576
559577 private Tile createBiomeTile (TilePos tilePos , int [] biomeData ) {
@@ -646,6 +664,9 @@ private void drawCustomStructureIcons(GuiGraphics guiGraphics) {
646664 if ((this .customStructureWidgets == null ) || this .customStructureWidgets .isEmpty ()) {
647665 return ;
648666 }
667+ if (!this .shouldDrawFeatureIcons ()) {
668+ return ;
669+ }
649670 for (CustomStructureWidget widget : this .customStructureWidgets ) {
650671 if (!widget .withinBounds ()) {
651672 continue ;
@@ -657,10 +678,19 @@ private void drawCustomStructureIcons(GuiGraphics guiGraphics) {
657678 }
658679 }
659680
660- private void drawCustomStructureIcon (GuiGraphics guiGraphics , int x , int y , int size , int colour ) {
661- int border = 0xFF000000 ;
662- guiGraphics .fill (x - 1 , y - 1 , x + size + 1 , y + size + 1 , border );
663- guiGraphics .fill (x , y , x + size , y + size , colour );
681+ protected void drawCustomStructureIcon (GuiGraphics guiGraphics , int x , int y , int size , int colour ) {
682+ if (Configs .DatapackIconStyle == 2 ) {
683+ drawPotionIcon (guiGraphics , x , y , size , colour );
684+ } else {
685+ int border = 0xFF000000 ;
686+ guiGraphics .fill (x - 1 , y - 1 , x + size + 1 , y + size + 1 , border );
687+ guiGraphics .fill (x , y , x + size , y + size , colour );
688+ }
689+ }
690+
691+ private static void drawPotionIcon (GuiGraphics guiGraphics , int x , int y , int size , int colour ) {
692+ drawIconStatic (guiGraphics , DATAPACK_POTION_TEXTURE , x , y , size , size , 0xFF_FFFFFF );
693+ drawIconStatic (guiGraphics , DATAPACK_POTION_OVERLAY_TEXTURE , x , y , size , size , colour );
664694 }
665695
666696 private void createFeatureToggles () {
@@ -2317,7 +2347,7 @@ private boolean isStructureCompleted(MapFeature feature, BlockPos pos) {
23172347 return this .completedStructures .contains (buildStructureCompletionEntry (feature , pos ));
23182348 }
23192349
2320- private boolean isDatapackStructureCompleted (String id , BlockPos pos ) {
2350+ protected boolean isDatapackStructureCompleted (String id , BlockPos pos ) {
23212351 return this .completedStructures .contains (buildDatapackStructureCompletionEntry (id , pos ));
23222352 }
23232353
@@ -2345,6 +2375,10 @@ private void setDatapackStructureCompleted(String id, BlockPos pos, boolean comp
23452375 }
23462376 Configs .setSeedMapCompletedStructures (this .structureCompletionKey , this .completedStructures );
23472377 Configs .save ();
2378+ try {
2379+ SeedMapMinimapManager .refreshCompletedStructuresIfOpen ();
2380+ } catch (Throwable ignored ) {
2381+ }
23482382 }
23492383
23502384 void refreshCompletedStructuresFromConfig () {
@@ -2362,7 +2396,7 @@ protected void drawCompletionOverlay(GuiGraphics guiGraphics, FeatureWidget widg
23622396 this .drawCompletedTick (guiGraphics , x , y , width , height );
23632397 }
23642398
2365- private void drawCompletedTick (GuiGraphics guiGraphics , int x , int y , int width , int height ) {
2399+ protected void drawCompletedTick (GuiGraphics guiGraphics , int x , int y , int width , int height ) {
23662400 int size = Math .max (8 , Math .min (width , height ) - 4 );
23672401 int baseX = x + (width - size ) / 2 ;
23682402 int baseY = y + (height - size ) / 2 ;
@@ -3125,7 +3159,7 @@ private void drawIcon(GuiGraphics guiGraphics, Identifier identifier, int minX,
31253159 pose .popMatrix ();
31263160 }
31273161
3128- private static void drawIconStatic (GuiGraphics guiGraphics , Identifier identifier , int minX , int minY , int iconWidth , int iconHeight , int colour ) {
3162+ static void drawIconStatic (GuiGraphics guiGraphics , Identifier identifier , int minX , int minY , int iconWidth , int iconHeight , int colour ) {
31293163 // Skip intersection checks (GuiRenderState.hasIntersection) you would otherwise get when calling
31303164 // GuiGraphics.blit as these checks incur a significant performance hit
31313165 AbstractTexture texture = Minecraft .getInstance ().getTextureManager ().getTexture (identifier );
@@ -3389,6 +3423,9 @@ protected void renderSeedMap(GuiGraphics guiGraphics, int mouseX, int mouseY, fl
33893423 protected boolean showFeatureIconTooltips () { return true ; }
33903424
33913425 private void renderFeatureIconTooltip (GuiGraphics guiGraphics , int mouseX , int mouseY ) {
3426+ if (this .isMouseOverToggleWidget (mouseX , mouseY )) {
3427+ return ;
3428+ }
33923429 for (FeatureWidget widget : this .featureWidgets ) {
33933430 if (!widget .withinBounds ()) continue ;
33943431 if (!Configs .ToggledFeatures .contains (widget .feature )) continue ;
@@ -3403,6 +3440,9 @@ private void renderFeatureIconTooltip(GuiGraphics guiGraphics, int mouseX, int m
34033440 }
34043441
34053442 private void renderCustomStructureTooltip (GuiGraphics guiGraphics , int mouseX , int mouseY ) {
3443+ if (this .isMouseOverToggleWidget (mouseX , mouseY )) {
3444+ return ;
3445+ }
34063446 for (CustomStructureWidget widget : this .customStructureWidgets ) {
34073447 if (!widget .withinBounds ()) {
34083448 continue ;
@@ -3418,6 +3458,20 @@ private void renderCustomStructureTooltip(GuiGraphics guiGraphics, int mouseX, i
34183458 }
34193459 }
34203460
3461+ private boolean isMouseOverToggleWidget (int mouseX , int mouseY ) {
3462+ for (FeatureToggleWidget widget : this .featureToggleWidgets ) {
3463+ if (widget .isMouseOver (mouseX , mouseY )) {
3464+ return true ;
3465+ }
3466+ }
3467+ for (CustomStructureToggleWidget widget : this .customStructureToggleWidgets ) {
3468+ if (widget .isMouseOver (mouseX , mouseY )) {
3469+ return true ;
3470+ }
3471+ }
3472+ return false ;
3473+ }
3474+
34213475 private void renderCustomStructureWidgets (GuiGraphics guiGraphics , int horChunkRadius , int verChunkRadius ) {
34223476 DatapackStructureManager .DatapackWorldgen worldgen = DatapackStructureManager .getWorldgen (this .worldIdentifier );
34233477 if (worldgen == null ) {
@@ -3729,7 +3783,7 @@ private void enqueueTilesSpiralIncremental(Object2ObjectMap<TilePos, java.util.L
37293783 if (this .customStructureSpiralCursor == null ) {
37303784 return ;
37313785 }
3732- int budget = CUSTOM_STRUCTURE_ENQUEUE_PER_TICK ;
3786+ int budget = this . isMinimap () ? CUSTOM_STRUCTURE_MINIMAP_ENQUEUE_PER_TICK : CUSTOM_STRUCTURE_ENQUEUE_PER_TICK ;
37333787 while (budget > 0 ) {
37343788 TilePos tilePos = this .customStructureSpiralCursor .next ();
37353789 if (tilePos == null ) {
@@ -3983,9 +4037,11 @@ protected void drawCenteredPlayerDirectionArrow(GuiGraphics guiGraphics, double
39834037 protected int verticalPadding () { return VERTICAL_PADDING ; }
39844038
39854039 protected ObjectSet <FeatureWidget > getFeatureWidgets () { return this .featureWidgets ; }
4040+ protected ObjectSet <CustomStructureWidget > getCustomStructureWidgets () { return this .customStructureWidgets ; }
39864041 protected FeatureWidget getMarkerWidget () { return this .markerWidget ; }
39874042 protected QuartPos2f getCenterQuart () { return this .centerQuart ; }
39884043 protected WorldIdentifier getWorldIdentifier () { return this .worldIdentifier ; }
4044+ protected int getDatapackIconSize () { return DATAPACK_ICON_SIZE ; }
39894045
39904046 protected void drawFeatureIcon (GuiGraphics guiGraphics , MapFeature .Texture texture , int x , int y , int width , int height , int colour ) {
39914047 // Draw icon with requested width/height so minimap scaling works
0 commit comments