aboutsummaryrefslogtreecommitdiff
path: root/mod
diff options
context:
space:
mode:
authorsyeyoung <cyoung06@naver.com>2023-01-21 01:14:43 +0900
committersyeyoung <cyoung06@naver.com>2023-01-21 01:14:43 +0900
commitd9f3485d15d78f2acde7cf1882cee727d8395128 (patch)
tree1846b97a397aa9f36a6bab90f63102ab3ff3839a /mod
parenta980d55aff534ba0a1cbd1d8f538266bc39e9b5d (diff)
downloadSkyblock-Dungeons-Guide-d9f3485d15d78f2acde7cf1882cee727d8395128.tar.gz
Skyblock-Dungeons-Guide-d9f3485d15d78f2acde7cf1882cee727d8395128.tar.bz2
Skyblock-Dungeons-Guide-d9f3485d15d78f2acde7cf1882cee727d8395128.zip
- Use mcs title renderer instead of our obscure one.
Signed-off-by: syeyoung <cyoung06@naver.com>
Diffstat (limited to 'mod')
-rwxr-xr-xmod/src/main/java/kr/syeyoung/dungeonsguide/mod/DungeonsGuide.java5
-rw-r--r--mod/src/main/java/kr/syeyoung/dungeonsguide/mod/features/impl/etc/FeatureEpicCountdown.java7
-rw-r--r--mod/src/main/java/kr/syeyoung/dungeonsguide/mod/utils/TitleRender.java156
3 files changed, 3 insertions, 165 deletions
diff --git a/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/DungeonsGuide.java b/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/DungeonsGuide.java
index f09ba949..cc380f0a 100755
--- a/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/DungeonsGuide.java
+++ b/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/DungeonsGuide.java
@@ -43,7 +43,6 @@ import kr.syeyoung.dungeonsguide.mod.stomp.StompManager;
import kr.syeyoung.dungeonsguide.mod.utils.AhUtils;
import kr.syeyoung.dungeonsguide.mod.utils.BlockCache;
import kr.syeyoung.dungeonsguide.mod.utils.TimeScoreUtil;
-import kr.syeyoung.dungeonsguide.mod.utils.TitleRender;
import kr.syeyoung.dungeonsguide.mod.utils.cursor.GLCursors;
import kr.syeyoung.dungeonsguide.mod.wsresource.StaticResourceCache;
import lombok.Getter;
@@ -189,7 +188,6 @@ public class DungeonsGuide implements DGInterface {
registerEventsForge(skyblockStatus);
registerEventsForge(ChatTransmitter.INSTANCE);
registerEventsForge(new BlockCache());
- registerEventsForge(TitleRender.getInstance());
(new FeatureRegistry()).init();
@@ -211,9 +209,6 @@ public class DungeonsGuide implements DGInterface {
dungeonFacade.init();
-
- TitleRender.getInstance();
-
CommandDungeonsGuide commandDungeonsGuide = new CommandDungeonsGuide();
CommandDgDebug command = new CommandDgDebug();
diff --git a/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/features/impl/etc/FeatureEpicCountdown.java b/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/features/impl/etc/FeatureEpicCountdown.java
index 559fe2aa..e7b5fe54 100644
--- a/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/features/impl/etc/FeatureEpicCountdown.java
+++ b/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/features/impl/etc/FeatureEpicCountdown.java
@@ -27,7 +27,6 @@ import kr.syeyoung.dungeonsguide.mod.features.FeatureParameter;
import kr.syeyoung.dungeonsguide.mod.features.SimpleFeature;
import kr.syeyoung.dungeonsguide.mod.utils.ScoreBoardUtils;
import kr.syeyoung.dungeonsguide.mod.utils.TextUtils;
-import kr.syeyoung.dungeonsguide.mod.utils.TitleRender;
import net.minecraft.client.Minecraft;
import net.minecraftforge.client.event.RenderGameOverlayEvent;
@@ -147,7 +146,7 @@ public class FeatureEpicCountdown extends SimpleFeature {
if (actualSecondsLeft <= 0) {
if(!Objects.equals(lastSec, GO_TEXT)){
lastSec = GO_TEXT;
- TitleRender.displayTitle(lastSec, "", 2, 25, 15);
+ Minecraft.getMinecraft().ingameGUI.displayTitle(lastSec, "", 2, 25, 15);
}
return;
}
@@ -159,9 +158,9 @@ public class FeatureEpicCountdown extends SimpleFeature {
Minecraft.getMinecraft().thePlayer.playSound("skyblock_dungeons_guide:readysetgo", 1F, 1F);
}
if(actualSecondsLeft > 5){
- TitleRender.displayTitle(string, "", 1, 10, 8);
+ Minecraft.getMinecraft().ingameGUI.displayTitle(string, "", 1, 10, 8);
}else{
- TitleRender.displayTitle(string, "", 1, 6, 4);
+ Minecraft.getMinecraft().ingameGUI.displayTitle(string, "", 1, 6, 4);
}
lastSec = string;
}
diff --git a/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/utils/TitleRender.java b/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/utils/TitleRender.java
deleted file mode 100644
index 8946fc39..00000000
--- a/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/utils/TitleRender.java
+++ /dev/null
@@ -1,156 +0,0 @@
-/*
- * Dungeons Guide - The most intelligent Hypixel Skyblock Dungeons Mod
- * Copyright (C) 2022 cyoung06 (syeyoung)
- *
- * This program is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Affero General Public License as published
- * by the Free Software Foundation, either version 3 of the License, or
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU Affero General Public License for more details.
- *
- * You should have received a copy of the GNU Affero General Public License
- * along with this program. If not, see <https://www.gnu.org/licenses/>.
- */
-
-package kr.syeyoung.dungeonsguide.mod.utils;
-
-import net.minecraft.client.Minecraft;
-import net.minecraft.client.gui.FontRenderer;
-import net.minecraft.client.gui.ScaledResolution;
-import net.minecraft.client.renderer.GlStateManager;
-import net.minecraft.util.MathHelper;
-import net.minecraftforge.client.event.RenderGameOverlayEvent;
-import net.minecraftforge.common.MinecraftForge;
-import net.minecraftforge.fml.common.eventhandler.SubscribeEvent;
-import net.minecraftforge.fml.common.gameevent.TickEvent;
-import org.apache.logging.log4j.LogManager;
-import org.apache.logging.log4j.Logger;
-import org.jetbrains.annotations.NotNull;
-
-/**
- * STOLEN FROM VANILLA 1.8.9, DONT @ ME
- * CREDS TO MOJANG AND THE CREW
- */
-public class TitleRender {
-
- Logger logger = LogManager.getLogger("TitleRender");
-
- private static TitleRender instance;
- public static TitleRender getInstance() {
- return instance == null ? instance = new TitleRender() : instance;
- }
-
- private TitleRender() {
- }
-
- protected static int titlesTimer;
- /**
- * The current title displayed
- */
- protected static String displayedTitle = "";
- /**
- * The current sub-title displayed
- */
- protected static String displayedSubTitle = "";
- /**
- * The time that the title take to fade in
- */
- protected static int titleFadeIn;
- /**
- * The time that the title is display
- */
- protected static int titleDisplayTime;
-
- /**
- * The time that the title take to fade out
- */
- protected static int titleFadeOut;
- Minecraft mc = Minecraft.getMinecraft();
-
- FontRenderer fontRenderer = mc.fontRendererObj;
-
-
- @SubscribeEvent
- public void onClinetTick(TickEvent.ClientTickEvent e){
- if(e.phase == TickEvent.Phase.START){
- tick();
- }
- }
-
- @SubscribeEvent
- public void onGameOverLay(RenderGameOverlayEvent.Post e){
- if (!(e.type == RenderGameOverlayEvent.ElementType.EXPERIENCE || e.type == RenderGameOverlayEvent.ElementType.JUMPBAR)) return;
- GlStateManager.enableBlend();
- draw(e.partialTicks);
- }
-
-
- void tick(){
- if (titlesTimer > 0) {
- --titlesTimer;
- if (titlesTimer <= 0) {
- displayedTitle = "";
- displayedSubTitle = "";
- }
- }
- }
-
-
- public static void clearTitle(){
- displayedTitle = "";
- displayedSubTitle = "";
- titlesTimer = 0;
- }
-
-
- public static void displayTitle(@NotNull String title, String subTitle, int timeFadeIn, int displayTime, int timeFadeOut) {
- displayedTitle = title;
- displayedSubTitle = subTitle;
- titleFadeIn = timeFadeIn;
- titleDisplayTime = displayTime;
- titleFadeOut = timeFadeOut;
- titlesTimer = titleFadeIn + titleDisplayTime + titleFadeOut;
- }
-
- void draw(float partialTicks){
- float g;
- int l;
- ScaledResolution scaledResolution = new ScaledResolution(mc);
- int i = scaledResolution.getScaledWidth();
- int j = scaledResolution.getScaledHeight();
- if (titlesTimer > 0) {
- g = titlesTimer - partialTicks;
- l = 255;
- if (titlesTimer > titleFadeOut + titleDisplayTime) {
- float h = (float)(titleFadeIn + titleDisplayTime + titleFadeOut) - g;
- l = (int)(h * 255.0f / (float)titleFadeIn);
- }
- if (titlesTimer <= titleFadeOut) {
- float h = g;
- l = (int)(h * 255.0f / (float)titleFadeOut);
- }
- if ((l = MathHelper.clamp_int(l, 0, 255)) > 8) {
- GlStateManager.pushMatrix();
- GlStateManager.translate(i / 2, j / 2, 0.0f);
- GlStateManager.enableBlend();
- GlStateManager.tryBlendFuncSeparate(770, 771, 1, 0);
- GlStateManager.pushMatrix();
- GlStateManager.scale(6.0f, 6.0f, 6.0f);
- int m = l << 24 & 0xFF000000;
- fontRenderer.drawString(displayedTitle, -fontRenderer.getStringWidth(displayedTitle) / 2, -10.0f, 0xFFFFFF | m, true);
- GlStateManager.popMatrix();
- GlStateManager.pushMatrix();
- GlStateManager.scale(2.0f, 2.0f, 2.0f);
- fontRenderer.drawString(displayedSubTitle, -fontRenderer.getStringWidth(displayedSubTitle) / 2, 5.0f, 0xFFFFFF | m, true);
- GlStateManager.popMatrix();
- GlStateManager.disableBlend();
- GlStateManager.popMatrix();
- }
- }
- }
-
-}