From 5a47daf797f211fc863338fdad5a406488c179bd Mon Sep 17 00:00:00 2001 From: Aria Date: Wed, 22 Feb 2023 02:42:55 -0700 Subject: [PATCH] Upgrade to 1.18.2 --- gradle.properties | 8 ++++---- gradle/wrapper/gradle-wrapper.properties | 2 +- .../dev/zontreck/mcmods/CheckInventory.java | 19 ++++++++++++++++--- .../zontreck/mcmods/WatchMyDurability.java | 11 ++++++----- .../mcmods/configs/WMDClientConfig.java | 4 ++-- ...sRenderer.java => HeartsRenderer.disabled} | 0 src/main/resources/META-INF/mods.toml | 10 +++++----- 7 files changed, 34 insertions(+), 20 deletions(-) rename src/main/java/dev/zontreck/mcmods/gui/{HeartsRenderer.java => HeartsRenderer.disabled} (100%) diff --git a/gradle.properties b/gradle.properties index c2bb92f..9d338dd 100644 --- a/gradle.properties +++ b/gradle.properties @@ -3,7 +3,7 @@ org.gradle.jvmargs=-Xmx3G org.gradle.daemon=false -mc_version=1.19.2 -forge_version=43.2.3 -myversion=1.1.2.6 -libz_version=1.0.3.7 \ No newline at end of file +mc_version=1.18.2 +forge_version=40.2.1 +myversion=1.1.2.7 +libz_version=1.0.4.9 \ No newline at end of file diff --git a/gradle/wrapper/gradle-wrapper.properties b/gradle/wrapper/gradle-wrapper.properties index 8049c68..ae04661 100644 --- a/gradle/wrapper/gradle-wrapper.properties +++ b/gradle/wrapper/gradle-wrapper.properties @@ -1,5 +1,5 @@ distributionBase=GRADLE_USER_HOME distributionPath=wrapper/dists -distributionUrl=https\://services.gradle.org/distributions/gradle-7.5-bin.zip +distributionUrl=https\://services.gradle.org/distributions/gradle-7.5.1-bin.zip zipStoreBase=GRADLE_USER_HOME zipStorePath=wrapper/dists diff --git a/src/main/java/dev/zontreck/mcmods/CheckInventory.java b/src/main/java/dev/zontreck/mcmods/CheckInventory.java index 30481b6..8153c94 100644 --- a/src/main/java/dev/zontreck/mcmods/CheckInventory.java +++ b/src/main/java/dev/zontreck/mcmods/CheckInventory.java @@ -7,11 +7,16 @@ import java.util.TimerTask; import dev.zontreck.libzontreck.chat.ChatColor; import dev.zontreck.libzontreck.chat.ChatColorFactory; +import dev.zontreck.libzontreck.chat.HoverTip; import dev.zontreck.libzontreck.chat.ChatColor.ColorOptions; import dev.zontreck.mcmods.configs.WMDClientConfig; import net.minecraft.client.Minecraft; import net.minecraft.core.NonNullList; import net.minecraft.network.chat.Component; +import net.minecraft.network.chat.HoverEvent; +import net.minecraft.network.chat.MutableComponent; +import net.minecraft.network.chat.Style; +import net.minecraft.network.chat.TextComponent; import net.minecraft.sounds.SoundEvent; import net.minecraft.sounds.SoundEvents; import net.minecraft.world.entity.player.Inventory; @@ -56,9 +61,10 @@ public class CheckInventory extends TimerTask if(current.shouldGiveAlert()) { String Msg = ChatColor.doColors("!Dark_Red!!bold!You need to eat!"); - Minecraft.getInstance().player.displayClientMessage(Component.literal(Msg), false); + Component chat = new TextComponent(Msg); + Minecraft.getInstance().player.displayClientMessage(chat, false); - SoundEvent sv = SoundEvents.WARDEN_ROAR; // It sounds like a growling stomach + SoundEvent sv = SoundEvents.WOLF_GROWL; // It sounds like a growling stomach Soundify(sv); } @@ -115,7 +121,14 @@ public class CheckInventory extends TimerTask Soundify(theSound); - Component X = Component.literal(replaced); + + MutableComponent X = new TextComponent(replaced); + + HoverEvent he = HoverTip.getItem(is1); + Style s = Style.EMPTY.withFont(Style.DEFAULT_FONT).withHoverEvent(he); + X=X.withStyle(s); + + Minecraft.getInstance().player.displayClientMessage(X, false); break; // Rule applies, break out of this loop, move to next item. } diff --git a/src/main/java/dev/zontreck/mcmods/WatchMyDurability.java b/src/main/java/dev/zontreck/mcmods/WatchMyDurability.java index 5b09c46..bf85d94 100644 --- a/src/main/java/dev/zontreck/mcmods/WatchMyDurability.java +++ b/src/main/java/dev/zontreck/mcmods/WatchMyDurability.java @@ -4,7 +4,6 @@ import com.mojang.logging.LogUtils; import dev.zontreck.libzontreck.chat.ChatColor; import dev.zontreck.mcmods.configs.WMDClientConfig; -import dev.zontreck.mcmods.gui.HeartsRenderer; import net.minecraft.client.Minecraft; import net.minecraft.client.User; import net.minecraftforge.common.MinecraftForge; @@ -18,6 +17,8 @@ import net.minecraftforge.fml.event.lifecycle.FMLCommonSetupEvent; import net.minecraftforge.event.server.ServerStartingEvent; import net.minecraftforge.fml.javafmlmod.FMLJavaModLoadingContext; import net.minecraftforge.client.event.ClientPlayerNetworkEvent; +import net.minecraftforge.client.event.ClientPlayerNetworkEvent.LoggedInEvent; +import net.minecraftforge.client.event.ClientPlayerNetworkEvent.LoggedOutEvent; import java.util.Timer; @@ -51,7 +52,7 @@ public class WatchMyDurability modEventBus.addListener(this::commonSetup); ModLoadingContext.get().registerConfig(Type.CLIENT, WMDClientConfig.SPEC, "watchmydurability-client.toml"); - MinecraftForge.EVENT_BUS.register(new HeartsRenderer()); + //MinecraftForge.EVENT_BUS.register(new HeartsRenderer()); // Register ourselves for server and other game events we are interested in MinecraftForge.EVENT_BUS.register(this); } @@ -97,7 +98,7 @@ public class WatchMyDurability { @SubscribeEvent - public static void onJoin(ClientPlayerNetworkEvent.LoggingIn event){ + public static void onJoin(LoggedInEvent event){ // Joined //LOGGER.info("PLAYER LOGGED IN"); LOGGER.info(WMDPrefix+": : : PLAYER LOGGED IN : : :"); @@ -105,14 +106,14 @@ public class WatchMyDurability } @SubscribeEvent - public static void onLeave(ClientPlayerNetworkEvent.LoggingOut event){ + public static void onLeave(LoggedOutEvent event){ //LOGGER.info("PLAYER LOGGED OUT"); LOGGER.info(WMDPrefix+": : : PLAYER LOGGED OUT : : :"); WatchMyDurability.isInGame=false; } @SubscribeEvent - public static void onClone(ClientPlayerNetworkEvent.Clone event) + public static void onClone(ClientPlayerNetworkEvent.RespawnEvent event) { LOGGER.info(WMDPrefix+": : : : PLAYER RESPAWNED OR MOVED TO A NEW WORLD : : : :"); diff --git a/src/main/java/dev/zontreck/mcmods/configs/WMDClientConfig.java b/src/main/java/dev/zontreck/mcmods/configs/WMDClientConfig.java index 28b3369..0235027 100644 --- a/src/main/java/dev/zontreck/mcmods/configs/WMDClientConfig.java +++ b/src/main/java/dev/zontreck/mcmods/configs/WMDClientConfig.java @@ -12,7 +12,7 @@ public class WMDClientConfig { public static ForgeConfigSpec.ConfigValue> alertPercents; public static ForgeConfigSpec.ConfigValue> alertMessages; public static ForgeConfigSpec.ConfigValue TimerVal; - public static ForgeConfigSpec.ConfigValue EnableExtraHearts; + //public static ForgeConfigSpec.ConfigValue EnableExtraHearts; public static ForgeConfigSpec.ConfigValue EnableHealthAlert; static{ @@ -33,7 +33,7 @@ public class WMDClientConfig { BUILDER.pop(); BUILDER.push("General"); - EnableExtraHearts = BUILDER.comment("Whether to enable the extra hearts rendering").define("compress_hearts", false); + //EnableExtraHearts = BUILDER.comment("Whether to enable the extra hearts rendering").define("compress_hearts", false); EnableHealthAlert = BUILDER.comment("The following was added for a friend. If you need reminders to eat in order to heal, turn the below option on").define("watchMyHunger", false); diff --git a/src/main/java/dev/zontreck/mcmods/gui/HeartsRenderer.java b/src/main/java/dev/zontreck/mcmods/gui/HeartsRenderer.disabled similarity index 100% rename from src/main/java/dev/zontreck/mcmods/gui/HeartsRenderer.java rename to src/main/java/dev/zontreck/mcmods/gui/HeartsRenderer.disabled diff --git a/src/main/resources/META-INF/mods.toml b/src/main/resources/META-INF/mods.toml index 64e919c..04b3026 100644 --- a/src/main/resources/META-INF/mods.toml +++ b/src/main/resources/META-INF/mods.toml @@ -6,7 +6,7 @@ # The name of the mod loader type to load - for regular FML @Mod mods it should be javafml modLoader="javafml" #mandatory # A version range to match for said mod loader - for regular FML @Mod it will be the forge version -loaderVersion="[43,)" #mandatory This is typically bumped every Minecraft version by Forge. See our download page for lists of versions. +loaderVersion="[40,)" #mandatory This is typically bumped every Minecraft version by Forge. See our download page for lists of versions. # The license for you mod. This is mandatory metadata and allows for easier comprehension of your redistributive properties. # Review your options at https://choosealicense.com/. All rights reserved is the default copyright stance, and is thus the default here. license="GPL-v2" @@ -19,7 +19,7 @@ modId="watchmydurability" #mandatory # The version number of the mod - there's a few well known ${} variables useable here or just hardcode it # ${file.jarVersion} will substitute the value of the Implementation-Version as read from the mod's JAR file metadata # see the associated build.gradle script for how to populate this completely automatically during a build -version="1.1.2.6" #mandatory +version="1.1.2.7" #mandatory # A display name for the mod displayName="Watch My Durability" #mandatory # A URL to query for updates for this mod. See the JSON update specification https://mcforge.readthedocs.io/en/latest/gettingstarted/autoupdate/ @@ -55,7 +55,7 @@ Edit the config file to customize the alerts # Does this dependency have to exist - if not, ordering below must be specified mandatory=true #mandatory # The version range of the dependency - versionRange="[43,)" #mandatory + versionRange="[40,)" #mandatory # An ordering relationship for the dependency - BEFORE or AFTER required if the relationship is not mandatory ordering="NONE" # Side this dependency is applied on - BOTH, CLIENT or SERVER @@ -65,12 +65,12 @@ Edit the config file to customize the alerts modId="minecraft" mandatory=true # This version range declares a minimum of the current minecraft version up to but not including the next major version - versionRange="[1.19.2,1.20)" + versionRange="[1.18.2,1.19)" ordering="NONE" side="CLIENT" [[dependencies.watchmydurability]] modId="libzontreck" mandatory=true - versionRange="[1.0.3.5,)" + versionRange="[1.0.4.9,1.0.5.0)" ordering="NONE" side="CLIENT" \ No newline at end of file