Skip to content

Commit

Permalink
tooltip done
Browse files Browse the repository at this point in the history
  • Loading branch information
HappyRespawnanchor committed Nov 22, 2024
1 parent 16cf9c9 commit b914902
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 7 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -29,13 +29,16 @@
import org.ayamemc.ayame.client.gui.screen.ModelSelectMenuScreen;

public class ClientEventHandler {
private final static Minecraft minecraft = Minecraft.getInstance();

public static final int TOOLTIP_BACKGROUND_COLOR = 0xCC_5f5f5f;
public static final int TOOLTIP_BORDER_TOP_COLOR = 0xCC_fdc7f5;
public static final int TOOLTIP_BORDER_BOTTOM_COLOR = 0xCC_fde8f5;

private final static Minecraft minecraft = Minecraft.getInstance();
public static boolean useAyameTooltipColor = minecraft.screen instanceof ModelSelectMenuScreen;

public static boolean shouldUseAyameTooltipColor() {
return minecraft.screen instanceof AyameScreen;
}
public static void renderCustomHandEventHandler(
InteractionHand hand,
PoseStack poseStack,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -43,15 +43,15 @@ private static int renderHorizontalLineAyameBackgroundColor(int backgroundColor)
index = 6
)
private static int renderRectangleAyameBackgroundColor(int backgroundColor) {
return ClientEventHandler.useAyameTooltipColor ? ClientEventHandler.TOOLTIP_BACKGROUND_COLOR : backgroundColor;
return ClientEventHandler.shouldUseAyameTooltipColor() ? ClientEventHandler.TOOLTIP_BACKGROUND_COLOR : backgroundColor;
}
@ModifyArg(
method = "renderTooltipBackground",
at = @At(value = "INVOKE", target = "Lnet/minecraft/client/gui/screens/inventory/tooltip/TooltipRenderUtil;renderVerticalLine(Lnet/minecraft/client/gui/GuiGraphics;IIIII)V"),
index = 5
)
private static int renderVerticalLineAyameBackgroundColor(int backgroundColor) {
return ClientEventHandler.useAyameTooltipColor ? ClientEventHandler.TOOLTIP_BACKGROUND_COLOR : backgroundColor;
return ClientEventHandler.shouldUseAyameTooltipColor() ? ClientEventHandler.TOOLTIP_BACKGROUND_COLOR : backgroundColor;
}

@ModifyArg(
Expand All @@ -60,15 +60,15 @@ private static int renderVerticalLineAyameBackgroundColor(int backgroundColor) {
index = 6
)
private static int renderFrameGradientAyameTopColor(int topColor) {
return ClientEventHandler.useAyameTooltipColor ? ClientEventHandler.TOOLTIP_BORDER_TOP_COLOR : topColor;
return ClientEventHandler.shouldUseAyameTooltipColor() ? ClientEventHandler.TOOLTIP_BORDER_TOP_COLOR : topColor;
}
@ModifyArg(
method = "renderTooltipBackground",
at = @At(value = "INVOKE", target = "Lnet/minecraft/client/gui/screens/inventory/tooltip/TooltipRenderUtil;renderFrameGradient(Lnet/minecraft/client/gui/GuiGraphics;IIIIIII)V"),
index = 7
)
private static int renderFrameGradientAyameBottomColor(int bottomColor) {
return ClientEventHandler.useAyameTooltipColor ? ClientEventHandler.TOOLTIP_BORDER_BOTTOM_COLOR : bottomColor;
return ClientEventHandler.shouldUseAyameTooltipColor() ? ClientEventHandler.TOOLTIP_BORDER_BOTTOM_COLOR : bottomColor;
}


Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@ public static void renderCustomModelHand(RenderHandEvent event) {
}
@SubscribeEvent
public static void renderAyameTooltipColor(RenderTooltipEvent.Color event) {
if (ClientEventHandler.useAyameTooltipColor) {
if (ClientEventHandler.shouldUseAyameTooltipColor()) {
event.setBorderStart(ClientEventHandler.TOOLTIP_BORDER_TOP_COLOR);
event.setBorderEnd(ClientEventHandler.TOOLTIP_BORDER_BOTTOM_COLOR);
event.setBackground(ClientEventHandler.TOOLTIP_BACKGROUND_COLOR);
Expand Down

0 comments on commit b914902

Please sign in to comment.