@@ -64,6 +64,7 @@ public class WidgetProspectingMap extends Widget {
6464 private long lastClicked ;
6565
6666 private final List <String > hoveredNames = new ArrayList <>();
67+ private int hoveredOreHeight = 0 ;
6768 private int color ;
6869
6970 public WidgetProspectingMap (int xPosition , int yPosition , int chunkRadius , WidgetOreList widgetOreList ,
@@ -242,6 +243,7 @@ public void drawInForeground(int mouseX, int mouseY) {
242243 // draw tooltips
243244 if (this .isMouseOverElement (mouseX , mouseY ) && texture != null ) {
244245 this .hoveredNames .clear ();
246+ this .hoveredOreHeight = 0 ;
245247 List <String > tooltips = new ArrayList <>();
246248 int cX = (mouseX - this .getPosition ().x ) / 16 ;
247249 int cZ = (mouseY - this .getPosition ().y ) / 16 ;
@@ -260,14 +262,16 @@ public void drawInForeground(int mouseX, int mouseY) {
260262 if (this .mode == ProspectorMode .ORE ) { // draw ore
261263 tooltips .add (I18n .format ("terminal.prospector.ore" ));
262264 HashMap <String , Integer > oreInfo = new HashMap <>();
265+ HashMap <String , Integer > oreHeight = new HashMap <>();
263266 for (int i = 0 ; i < 16 ; i ++) {
264267 for (int j = 0 ; j < 16 ; j ++) {
265268 if (texture .map [cX * 16 + i ][cZ * 16 + j ] != null ) {
266- texture .map [cX * 16 + i ][cZ * 16 + j ].values (). forEach (dict -> {
269+ texture .map [cX * 16 + i ][cZ * 16 + j ].forEach (( height , dict ) -> {
267270 String name = OreDictUnifier .get (dict ).getDisplayName ();
268271 if (ProspectingTexture .SELECTED_ALL .equals (texture .getSelected ()) ||
269272 texture .getSelected ().equals (dict )) {
270273 oreInfo .put (name , oreInfo .getOrDefault (name , 0 ) + 1 );
274+ oreHeight .put (name , oreHeight .getOrDefault (name , 0 ) + height .intValue ());
271275 if (oreInfo .get (name ) > maxAmount [0 ]) {
272276 maxAmount [0 ] = oreInfo .get (name );
273277 MaterialStack m = OreDictUnifier .getMaterial (OreDictUnifier .get (dict ));
@@ -280,8 +284,19 @@ public void drawInForeground(int mouseX, int mouseY) {
280284 }
281285 }
282286 }
287+ oreHeight .forEach ((name , height ) -> {
288+ hoveredOreHeight += height ;
289+ int count = oreInfo .getOrDefault (name , 0 );
290+ int avgHeight = count != 0 ? height / count : 0 ;
291+ oreHeight .put (name , avgHeight );
292+ });
293+ int totalCount = oreInfo .values ().stream ().reduce (0 , Integer ::sum );
294+ if (totalCount != 0 ) {
295+ hoveredOreHeight /= totalCount ;
296+ }
283297 oreInfo .forEach ((name , count ) -> {
284- tooltips .add (name + " --- " + count );
298+ int height = oreHeight .getOrDefault (name , 0 );
299+ tooltips .add (name + " --- §e" + count + "§r, §cy" + height + "§r" );
285300 hoveredNames .add (name );
286301 });
287302 } else if (this .mode == ProspectorMode .FLUID ) {
@@ -327,8 +342,10 @@ public boolean mouseClicked(int mouseX, int mouseY, int button) {
327342
328343 int xPos = ((Minecraft .getMinecraft ().player .chunkCoordX + xDiff ) << 4 ) + 8 ;
329344 int zPos = ((Minecraft .getMinecraft ().player .chunkCoordZ + zDiff ) << 4 ) + 8 ;
345+ int yPos = hoveredOreHeight != 0 ? hoveredOreHeight :
346+ Minecraft .getMinecraft ().world .getHeight (xPos , zPos );
330347
331- BlockPos b = new BlockPos (xPos , Minecraft . getMinecraft (). world . getHeight ( xPos , zPos ) , zPos );
348+ BlockPos b = new BlockPos (xPos , yPos , zPos );
332349 if (System .currentTimeMillis () - lastClicked < 400 && !hoveredNames .isEmpty ()) {
333350 boolean added = false ;
334351 trimHoveredNames ();
@@ -405,7 +422,7 @@ private boolean addVoxelMapWaypoint(@NotNull BlockPos b) {
405422 createVeinName (),
406423 b .getX (),
407424 b .getZ (),
408- Minecraft . getMinecraft (). world . getHeight ( b . getX (), b . getZ () ),
425+ b . getY ( ),
409426 true ,
410427 c .getRed () / 255F ,
411428 c .getGreen () / 255F ,
@@ -451,7 +468,7 @@ private boolean addXaeroMapWaypoint(@NotNull BlockPos b) {
451468 xaero .common .minimap .waypoints .WaypointWorld ww = minimapSession .getWaypointsManager ().getCurrentWorld ();
452469 xaero .common .minimap .waypoints .Waypoint xaeroWaypoint = new xaero .common .minimap .waypoints .Waypoint (
453470 b .getX (),
454- Minecraft . getMinecraft (). world . getHeight ( b . getX (), b . getZ () ),
471+ b . getY ( ),
455472 b .getZ (),
456473 createVeinName (), hoveredNames .get (0 ).substring (0 , 1 ), bestColorIndex );
457474
0 commit comments