From 954642b922a199fae336dab73b83a243f0b81f5f Mon Sep 17 00:00:00 2001 From: Aria Date: Wed, 22 Feb 2023 02:15:57 -0700 Subject: [PATCH] Finalize mod downgrade to 1.18.2 --- gradle.properties | 2 +- .../dev/zontreck/libzontreck/LibZontreck.java | 3 ++- .../zontreck/libzontreck/chat/HoverTip.java | 20 +++++++++++++++++-- .../libzontreck/vectors/WorldPosition.java | 4 ---- src/main/resources/META-INF/mods.toml | 2 +- 5 files changed, 22 insertions(+), 9 deletions(-) diff --git a/gradle.properties b/gradle.properties index 1f33623..f92b50b 100644 --- a/gradle.properties +++ b/gradle.properties @@ -5,5 +5,5 @@ org.gradle.daemon=false mc_version=1.18.2 forge_version=40.2.1 -myversion=1.0.4.8 +myversion=1.0.4.9 parchment_version=2022.11.06 \ No newline at end of file diff --git a/src/main/java/dev/zontreck/libzontreck/LibZontreck.java b/src/main/java/dev/zontreck/libzontreck/LibZontreck.java index 345ab03..5a04ebd 100644 --- a/src/main/java/dev/zontreck/libzontreck/LibZontreck.java +++ b/src/main/java/dev/zontreck/libzontreck/LibZontreck.java @@ -11,6 +11,7 @@ import net.minecraft.server.MinecraftServer; import net.minecraft.server.level.ServerPlayer; import net.minecraftforge.common.MinecraftForge; import net.minecraftforge.event.entity.living.LivingEvent; +import net.minecraftforge.event.entity.living.LivingEvent.LivingUpdateEvent; import net.minecraftforge.event.server.ServerStartedEvent; import net.minecraftforge.eventbus.api.IEventBus; import net.minecraftforge.eventbus.api.SubscribeEvent; @@ -51,7 +52,7 @@ public class LibZontreck { public static class ForgeEventBus { @SubscribeEvent - public void onPlayerTick(LivingEvent.LivingTickEvent ev) + public void onPlayerTick(LivingUpdateEvent ev) { if(ev.getEntity().level.isClientSide)return; diff --git a/src/main/java/dev/zontreck/libzontreck/chat/HoverTip.java b/src/main/java/dev/zontreck/libzontreck/chat/HoverTip.java index 993bc16..d73b714 100644 --- a/src/main/java/dev/zontreck/libzontreck/chat/HoverTip.java +++ b/src/main/java/dev/zontreck/libzontreck/chat/HoverTip.java @@ -1,17 +1,33 @@ package dev.zontreck.libzontreck.chat; -import net.minecraft.network.chat.Component; import net.minecraft.network.chat.HoverEvent; +import net.minecraft.network.chat.TextComponent; import net.minecraft.network.chat.HoverEvent.Action; +import net.minecraft.world.item.ItemStack; /* * Because of some weird behavior with java not liking that both HoverEvent and ClickEvent have an Action implementation, these must both be in a custom factory here where Action can be imported by itself in both files */ public class HoverTip { + /** + * This will return a hover event that shows a string of text when hovered over + * @param text + * @return + */ public static HoverEvent get(String text) { - return new HoverEvent(Action.SHOW_TEXT, Component.literal(text)); + return new HoverEvent(Action.SHOW_TEXT, new TextComponent(text)); + } + + /** + * Returns a hover event that shows an item when hovered over + * @param is + * @return + */ + public static HoverEvent getItem(ItemStack is) + { + return new HoverEvent(Action.SHOW_ITEM, new HoverEvent.ItemStackInfo(is)); } } diff --git a/src/main/java/dev/zontreck/libzontreck/vectors/WorldPosition.java b/src/main/java/dev/zontreck/libzontreck/vectors/WorldPosition.java index 92962b7..7918855 100644 --- a/src/main/java/dev/zontreck/libzontreck/vectors/WorldPosition.java +++ b/src/main/java/dev/zontreck/libzontreck/vectors/WorldPosition.java @@ -1,7 +1,5 @@ package dev.zontreck.libzontreck.vectors; -import com.mojang.authlib.yggdrasil.response.UserAttributesResponse.ProfanityFilterPreferences; - import dev.zontreck.libzontreck.LibZontreck; import dev.zontreck.libzontreck.exceptions.InvalidDeserialization; import dev.zontreck.libzontreck.exceptions.InvalidSideException; @@ -11,8 +9,6 @@ import net.minecraft.nbt.NbtUtils; import net.minecraft.resources.ResourceLocation; import net.minecraft.server.level.ServerLevel; import net.minecraft.server.level.ServerPlayer; -import net.minecraft.server.network.FilteredText; -import net.minecraft.util.datafix.fixes.FilteredSignsFix; import net.minecraft.world.entity.player.Player; import net.minecraft.world.level.Level; diff --git a/src/main/resources/META-INF/mods.toml b/src/main/resources/META-INF/mods.toml index 66f12ea..8d28856 100644 --- a/src/main/resources/META-INF/mods.toml +++ b/src/main/resources/META-INF/mods.toml @@ -19,7 +19,7 @@ modId="libzontreck" #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.0.4.8" #mandatory +version="1.0.4.9" #mandatory # A display name for the mod displayName="LibZontreck" #mandatory # A URL to query for updates for this mod. See the JSON update specification https://mcforge.readthedocs.io/en/latest/gettingstarted/autoupdate/