Skip to content

Commit

Permalink
fix crash
Browse files Browse the repository at this point in the history
  • Loading branch information
isXander committed Apr 22, 2023
1 parent 8a5a834 commit affeab2
Show file tree
Hide file tree
Showing 4 changed files with 8 additions and 4 deletions.
2 changes: 1 addition & 1 deletion build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ plugins {
}

group = "dev.isxander"
version = "1.2.0"
version = "1.2.1"

repositories {
mavenCentral()
Expand Down
2 changes: 2 additions & 0 deletions changelogs/1.2.1.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
- Fix some rendering crashes
- Prioritize YACL tooltip positioning above rather than below
Original file line number Diff line number Diff line change
Expand Up @@ -23,8 +23,8 @@ public Vector2ic getPosition(Screen screen, int x, int y, int width, int height)
int maxBelow = screen.height - (belowY + height);
int minAbove = aboveY - height;

int yResult = belowY;
if (maxBelow < -8)
int yResult = aboveY;
if (minAbove < 8)
yResult = maxBelow > minAbove ? belowY : aboveY;

int xResult = MathHelper.clamp(centerX - width / 2, -4, screen.width - width - 4);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -86,6 +86,9 @@ private Stream<? extends OrderedText> wrapPositionedOrderedText(List<? extends O
private Vector2ic moveTooltip(TooltipPositioner clientTooltipPositioner, Screen screen, int x, int y, int width, int height, Operation<Vector2ic> operation, MatrixStack matrices, List<TooltipComponent> components, int mouseX, int mouseY) {
Vector2ic currentPosition = operation.call(clientTooltipPositioner, screen, x, y, width, height);

// push before returning so we don't need to repeat the check on pop
matrices.push(); // injection is before matrices.push()

if (!(clientTooltipPositioner instanceof HoveredTooltipPositioner) && AdaptiveTooltipConfig.INSTANCE.getConfig().onlyRepositionHoverTooltips)
return currentPosition;

Expand All @@ -99,7 +102,6 @@ private Vector2ic moveTooltip(TooltipPositioner clientTooltipPositioner, Screen
currentPosition = position.get();
}

matrices.push(); // injection is before matrices.push()
ScrollTracker.scroll(matrices, components, currentPosition.x(), currentPosition.y(), width, height, this.width, this.height);

return currentPosition;
Expand Down

0 comments on commit affeab2

Please sign in to comment.