Skip to content

Commit

Permalink
fix
Browse files Browse the repository at this point in the history
  • Loading branch information
goumo committed Dec 25, 2024
1 parent 6a176a3 commit 9a201a4
Show file tree
Hide file tree
Showing 4 changed files with 21 additions and 19 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
import com.google.gson.GsonBuilder;
import com.google.gson.annotations.Expose;
import com.mojang.logging.LogUtils;
import com.teammoeg.frostedheart.content.tips.client.gui.widget.TipWidget;
import com.teammoeg.frostedheart.util.lang.Lang;
import lombok.Getter;
import lombok.Setter;
Expand Down Expand Up @@ -152,7 +153,7 @@ public void general(Tip tip) {

if (tip.isPin() && !TipRenderer.TIP_QUEUE.isEmpty()) {
Tip last = TipRenderer.TIP_QUEUE.get(0);
TipRenderer.removeCurrent();
TipWidget.INSTANCE.close();
TipRenderer.TIP_QUEUE.add(0, last);
TipRenderer.TIP_QUEUE.add(0, tip);
} else {
Expand Down Expand Up @@ -182,7 +183,8 @@ public void force(Tip tip) {

if (tip.isPin()) {
Tip last = TipRenderer.TIP_QUEUE.get(0);
TipRenderer.removeCurrent();
TipWidget.INSTANCE.close();
TipRenderer.TIP_QUEUE.add(0, last);
TipRenderer.TIP_QUEUE.add(0, last);
TipRenderer.TIP_QUEUE.add(0, tip);
} else {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,6 @@ public static boolean isTipRendering() {
* 移除当前显示的tip
*/
public static void removeCurrent() {
if (!TIP_QUEUE.isEmpty()) TIP_QUEUE.remove(0);
TipWidget.INSTANCE.close();
}

Expand Down Expand Up @@ -75,7 +74,7 @@ public static void onGuiInit(ScreenEvent.Init event) {

@SubscribeEvent
public static void onHudRender(RenderGuiEvent.Post event) {
if (!FHConfig.CLIENT.renderTips.get() || TIP_QUEUE.isEmpty())
if (!FHConfig.CLIENT.renderTips.get() || (TIP_QUEUE.isEmpty() && !isTipRendering()))
return;
Minecraft MC = ClientUtils.mc();
if (MC.screen != null && !SCREEN_BLACKLIST.contains(MC.screen.getClass()))
Expand All @@ -100,7 +99,7 @@ public static void onHudRender(RenderGuiEvent.Post event) {

@SubscribeEvent
public static void onGuiRender(ScreenEvent.Render.Post event) {
if (!FHConfig.CLIENT.renderTips.get() || TIP_QUEUE.isEmpty())
if (!FHConfig.CLIENT.renderTips.get() || (TIP_QUEUE.isEmpty() && !isTipRendering()))
return;
if (!event.getScreen().children().contains(TipWidget.INSTANCE))
return;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -132,7 +132,7 @@ private void render(GuiGraphics graphics, int mouseX, int mouseY, float partialT
FHGuiHelper.blitColored(
pose,
getX() + (super.getWidth() / 2) - (context.imageSize.width / 2),
getY() + border + (context.titleLines.size() + context.contentLines.size()) * RenderContext.LINE_SPACE,
getY() + border + (context.totalLineSize * RenderContext.LINE_SPACE),
context.imageSize.width, context.imageSize.height,
0, 0,
context.imageSize.width, context.imageSize.height,
Expand Down
27 changes: 14 additions & 13 deletions src/main/java/com/teammoeg/frostedheart/events/FHClientEvents.java
Original file line number Diff line number Diff line change
Expand Up @@ -19,30 +19,30 @@

package com.teammoeg.frostedheart.events;

import com.teammoeg.frostedheart.*;
import com.teammoeg.frostedheart.FHMain;
import com.teammoeg.frostedheart.FrostedHud;
import com.teammoeg.frostedheart.base.team.FHClientTeamDataManager;
import com.teammoeg.frostedheart.bootstrap.client.FHKeyMappings;
import com.teammoeg.frostedheart.bootstrap.common.FHMobEffects;
import com.teammoeg.frostedheart.content.climate.render.InfraredViewRenderer;
import com.teammoeg.frostedheart.content.tips.Tip;
import com.teammoeg.frostedheart.content.tips.TipManager;
import com.teammoeg.frostedheart.compat.jei.JEICompat;
import com.teammoeg.frostedheart.content.climate.player.PlayerTemperatureData;
import com.teammoeg.frostedheart.content.climate.render.InfraredViewRenderer;
import com.teammoeg.frostedheart.content.research.events.ClientResearchStatusEvent;
import com.teammoeg.frostedheart.content.research.gui.ResearchToast;
import com.teammoeg.frostedheart.content.research.research.effects.Effect;
import com.teammoeg.frostedheart.content.research.research.effects.EffectCrafting;
import com.teammoeg.frostedheart.content.research.research.effects.EffectShowCategory;
import com.teammoeg.frostedheart.content.scenario.client.ClientScene;
import com.teammoeg.frostedheart.content.scenario.client.dialog.HUDDialog;
import com.teammoeg.frostedheart.content.tips.Tip;
import com.teammoeg.frostedheart.content.tips.TipManager;
import com.teammoeg.frostedheart.content.waypoint.ClientWaypointManager;
import com.teammoeg.frostedheart.infrastructure.config.FHConfig;
import com.teammoeg.frostedheart.util.lang.Lang;
import com.teammoeg.frostedheart.util.FHVersion;
import com.teammoeg.frostedheart.util.client.ClientUtils;
import com.teammoeg.frostedheart.util.client.GuiClickedEvent;
import com.teammoeg.frostedheart.util.client.RenderHelper;

import com.teammoeg.frostedheart.util.lang.Lang;
import net.minecraft.ChatFormatting;
import net.minecraft.client.Minecraft;
import net.minecraft.client.gui.Font;
Expand All @@ -54,15 +54,20 @@
import net.minecraft.network.chat.ClickEvent;
import net.minecraft.network.chat.MutableComponent;
import net.minecraft.network.chat.Style;
import net.minecraft.resources.ResourceLocation;
import net.minecraft.util.FormattedCharSequence;
import net.minecraft.util.Mth;
import net.minecraft.world.entity.player.Player;
import net.minecraft.world.level.GameType;
import net.minecraftforge.api.distmarker.Dist;
import net.minecraftforge.client.event.*;
import net.minecraftforge.client.event.ClientPlayerNetworkEvent;
import net.minecraftforge.client.event.InputEvent;
import net.minecraftforge.client.event.RenderGuiOverlayEvent;
import net.minecraftforge.client.event.RenderLevelStageEvent;
import net.minecraftforge.client.event.RenderPlayerEvent;
import net.minecraftforge.client.event.ScreenEvent;
import net.minecraftforge.client.gui.overlay.VanillaGuiOverlay;
import net.minecraftforge.common.MinecraftForge;
import net.minecraftforge.event.AddReloadListenerEvent;
import net.minecraftforge.event.TickEvent.ClientTickEvent;
import net.minecraftforge.event.TickEvent.Phase;
import net.minecraftforge.event.level.LevelEvent;
Expand All @@ -74,10 +79,6 @@
import net.minecraftforge.server.ServerLifecycleHooks;
import org.lwjgl.glfw.GLFW;

import java.io.File;
import java.io.IOException;
import java.nio.file.Files;
import java.nio.file.Paths;
import java.util.List;

@Mod.EventBusSubscriber(modid = FHMain.MODID, bus = Mod.EventBusSubscriber.Bus.FORGE, value = Dist.CLIENT)
Expand Down Expand Up @@ -460,7 +461,7 @@ public static void onWorldRender(RenderLevelStageEvent event) {
public static void onPlayerLoggedIn(ClientPlayerNetworkEvent.LoggingIn event) {
// default tip
if (!TipManager.INSTANCE.hasTip("default")) {
Tip.builder("default").line(Lang.str("Default Tip")).build().saveAsFile();
Tip.builder("default").line(Lang.str("Default Tip")).image(new ResourceLocation(FHMain.MODID, "textures/item/debug_item.png")).build().saveAsFile();
TipManager.INSTANCE.loadFromFile();
}
TipManager.INSTANCE.display().clearRenderQueue();
Expand Down

0 comments on commit 9a201a4

Please sign in to comment.