diff --git a/gradle.properties b/gradle.properties index f249bd8..de5f4a7 100644 --- a/gradle.properties +++ b/gradle.properties @@ -3,22 +3,22 @@ org.gradle.jvmargs=-Xmx3G org.gradle.daemon=false -libzontreck=1.10.012124.1709 +libzontreck=1.10.013124.1729 ## Environment Properties # The Minecraft version must agree with the Forge version to get a valid artifact -minecraft_version=1.18.2 +minecraft_version=1.19.2 # The Minecraft version range can use any release version of Minecraft as bounds. # Snapshots, pre-releases, and release candidates are not guaranteed to sort properly # as they do not follow standard versioning conventions. -minecraft_version_range=[1.18.2,1.19) +minecraft_version_range=[1.19,1.20) # The Forge version must agree with the Minecraft version to get a valid artifact -forge_version=40.2.1 +forge_version=43.3.0 # The Forge version range can use any version of Forge as bounds or match the loader version range -forge_version_range=[40,) +forge_version_range=[43,) # The loader version range can only use the major version of Forge/FML as bounds -loader_version_range=[40,) +loader_version_range=[43,) # The mapping channel to use for mappings. # The default set of supported mapping channels are ["official", "snapshot", "snapshot_nodoc", "stable", "stable_nodoc"]. # Additional mapping channels can be registered through the "channelProviders" extension in a Gradle plugin. @@ -36,7 +36,7 @@ loader_version_range=[40,) mapping_channel=parchment # The mapping version to query from the mapping channel. # This must match the format required by the mapping channel. -mapping_version=2022.11.06-1.18.2 +mapping_version=2022.11.27-1.19.2 ## Mod Properties @@ -49,7 +49,7 @@ mod_name=Aria's Essentials # The license of the mod. Review your options at https://choosealicense.com/. All Rights Reserved is the default. mod_license=GPLv3 # The mod version. See https://semver.org/ -mod_version=1.2.012124.2356 +mod_version=1.2.013124.1836 # The group ID for the mod. It is only important when publishing as an artifact to a Maven repository. # This should match the base package used for the mod sources. # See https://maven.apache.org/guides/mini/guide-naming-conventions.html diff --git a/gradle/wrapper/gradle-wrapper.jar b/gradle/wrapper/gradle-wrapper.jar index 943f0cb..249e583 100644 Binary files a/gradle/wrapper/gradle-wrapper.jar and b/gradle/wrapper/gradle-wrapper.jar differ diff --git a/gradle/wrapper/gradle-wrapper.properties b/gradle/wrapper/gradle-wrapper.properties index 81b8f92..ae04661 100644 --- a/gradle/wrapper/gradle-wrapper.properties +++ b/gradle/wrapper/gradle-wrapper.properties @@ -1,6 +1,5 @@ distributionBase=GRADLE_USER_HOME distributionPath=wrapper/dists distributionUrl=https\://services.gradle.org/distributions/gradle-7.5.1-bin.zip -networkTimeout=10000 zipStoreBase=GRADLE_USER_HOME zipStorePath=wrapper/dists diff --git a/gradlew b/gradlew index 65dcd68..a69d9cb 100755 --- a/gradlew +++ b/gradlew @@ -55,7 +55,7 @@ # Darwin, MinGW, and NonStop. # # (3) This script is generated from the Groovy template -# https://github.com/gradle/gradle/blob/HEAD/subprojects/plugins/src/main/resources/org/gradle/api/internal/plugins/unixStartScript.txt +# https://github.com/gradle/gradle/blob/master/subprojects/plugins/src/main/resources/org/gradle/api/internal/plugins/unixStartScript.txt # within the Gradle project. # # You can find Gradle at https://github.com/gradle/gradle/. @@ -80,11 +80,11 @@ do esac done -# This is normally unused -# shellcheck disable=SC2034 -APP_BASE_NAME=${0##*/} APP_HOME=$( cd "${APP_HOME:-./}" && pwd -P ) || exit +APP_NAME="Gradle" +APP_BASE_NAME=${0##*/} + # Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script. DEFAULT_JVM_OPTS='"-Xmx64m" "-Xms64m"' @@ -143,16 +143,12 @@ fi if ! "$cygwin" && ! "$darwin" && ! "$nonstop" ; then case $MAX_FD in #( max*) - # In POSIX sh, ulimit -H is undefined. That's why the result is checked to see if it worked. - # shellcheck disable=SC3045 MAX_FD=$( ulimit -H -n ) || warn "Could not query maximum file descriptor limit" esac case $MAX_FD in #( '' | soft) :;; #( *) - # In POSIX sh, ulimit -n is undefined. That's why the result is checked to see if it worked. - # shellcheck disable=SC3045 ulimit -n "$MAX_FD" || warn "Could not set maximum file descriptor limit to $MAX_FD" esac diff --git a/gradlew.bat b/gradlew.bat index 6689b85..53a6b23 100644 --- a/gradlew.bat +++ b/gradlew.bat @@ -26,7 +26,6 @@ if "%OS%"=="Windows_NT" setlocal set DIRNAME=%~dp0 if "%DIRNAME%"=="" set DIRNAME=. -@rem This is normally unused set APP_BASE_NAME=%~n0 set APP_HOME=%DIRNAME% diff --git a/src/main/java/dev/zontreck/essentials/client/AutoWalk.java b/src/main/java/dev/zontreck/essentials/client/AutoWalk.java index 1774472..2008830 100644 --- a/src/main/java/dev/zontreck/essentials/client/AutoWalk.java +++ b/src/main/java/dev/zontreck/essentials/client/AutoWalk.java @@ -22,7 +22,7 @@ public class AutoWalk { static long lastPress; @SubscribeEvent - public static void onKeyPress(InputEvent.KeyInputEvent event) { + public static void onKeyPress(InputEvent.Key event) { if(Keybindings.AUTOWALK.matches(event.getKey(), event.getScanCode()) && Minecraft.getInstance().screen == null && Keybindings.AUTOWALK.isDown()) { lastPress = Instant.now().getEpochSecond(); @@ -36,10 +36,11 @@ public class AutoWalk { private static void startWalking() { isWalking=true; - autoJump = Minecraft.getInstance().options.autoJump; - Minecraft.getInstance().options.autoJump = true; + autoJump = Minecraft.getInstance().options.autoJump().get(); + Minecraft.getInstance().options.autoJump().set(true); - Minecraft.getInstance().player.sendMessage(ChatHelpers.macro(Messages.ESSENTIALS_PREFIX + "!Dark_Green!AutoWalking started"), new UUID(0,0)); + + Minecraft.getInstance().player.displayClientMessage(ChatHelpers.macro(Messages.ESSENTIALS_PREFIX + "!Dark_Green!AutoWalking started"), false); runner = new Thread(()->{ while(AutoWalk.isWalking) @@ -55,10 +56,10 @@ public class AutoWalk { isWalking=false; runner.interrupt(); runner=null; - Minecraft.getInstance().options.autoJump = autoJump; + Minecraft.getInstance().options.autoJump().set(autoJump); Minecraft.getInstance().options.keyUp.setDown(false); - Minecraft.getInstance().player.sendMessage(ChatHelpers.macro(Messages.ESSENTIALS_PREFIX + "!Dark_Green!AutoWalking stopped"), new UUID(0,0)); + Minecraft.getInstance().player.displayClientMessage(ChatHelpers.macro(Messages.ESSENTIALS_PREFIX + "!Dark_Green!AutoWalking stopped"), false); } } diff --git a/src/main/java/dev/zontreck/essentials/gui/HeartsRenderer.java b/src/main/java/dev/zontreck/essentials/gui/HeartsRenderer.java index 9854b7d..85bc727 100644 --- a/src/main/java/dev/zontreck/essentials/gui/HeartsRenderer.java +++ b/src/main/java/dev/zontreck/essentials/gui/HeartsRenderer.java @@ -28,8 +28,10 @@ import net.minecraft.world.entity.ai.attributes.Attributes; import net.minecraft.world.entity.player.Player; import net.minecraftforge.api.distmarker.Dist; import net.minecraftforge.api.distmarker.OnlyIn; -import net.minecraftforge.client.event.RenderGameOverlayEvent; -import net.minecraftforge.client.gui.ForgeIngameGui; +import net.minecraftforge.client.event.RenderGuiOverlayEvent; +import net.minecraftforge.client.gui.overlay.ForgeGui; +import net.minecraftforge.client.gui.overlay.GuiOverlayManager; +import net.minecraftforge.client.gui.overlay.NamedGuiOverlay; import net.minecraftforge.common.MinecraftForge; import net.minecraftforge.eventbus.api.EventPriority; import net.minecraftforge.eventbus.api.SubscribeEvent; @@ -77,12 +79,28 @@ public class HeartsRenderer { * @param event Event instance */ @SubscribeEvent(priority = EventPriority.LOW) - public void renderHealthbar(RenderGameOverlayEvent.PreLayer event) { - if (event.isCanceled() || !AEClientConfig.getInstance().EnableHearts || event.getOverlay() != ForgeIngameGui.PLAYER_HEALTH_ELEMENT) { + public void renderHealthbar(RenderGuiOverlayEvent.Pre event) { + NamedGuiOverlay ActualOverlay = GuiOverlayManager.findOverlay(new ResourceLocation("minecraft:player_health")); + + if (ActualOverlay == null) { + if (GuiOverlayManager.getOverlays() == null) { + AriasEssentials.LOGGER.info("Overlays non existent?!"); + } + for (NamedGuiOverlay overlay : GuiOverlayManager.getOverlays()) { + // Next print + // LibZontreck.LOGGER.info("GUI OVERLAY: "+overlay.id().getPath()); + + if (overlay.id().getPath().equals("player_health")) { + ActualOverlay = overlay; + break; + } + } + } + if (event.isCanceled() || !AEClientConfig.getInstance().EnableHearts || event.getOverlay() != ActualOverlay) { return; } // ensure its visible - if (!(mc.gui instanceof ForgeIngameGui gui) || mc.options.hideGui || !gui.shouldDrawSurvivalElements()) { + if (!(mc.gui instanceof ForgeGui gui) || mc.options.hideGui || !gui.shouldDrawSurvivalElements()) { return; } Entity renderViewEnity = this.mc.getCameraEntity(); @@ -94,7 +112,7 @@ public class HeartsRenderer { this.mc.getProfiler().push("health"); // extra setup stuff from us - int left_height = gui.left_height; + int left_height = gui.leftHeight; int width = this.mc.getWindow().getGuiScaledWidth(); int height = this.mc.getWindow().getGuiScaledHeight(); int updateCounter = this.mc.gui.getGuiTicks(); @@ -103,13 +121,13 @@ public class HeartsRenderer { // changes are indicated by comment int health = Mth.ceil(player.getHealth()); - boolean highlight = this.healthUpdateCounter > (long) updateCounter && (this.healthUpdateCounter - (long) updateCounter) / 3L % 2L == 1L; + boolean highlight = this.healthUpdateCounter > (long) updateCounter + && (this.healthUpdateCounter - (long) updateCounter) / 3L % 2L == 1L; if (health < this.playerHealth && player.invulnerableTime > 0) { this.lastSystemTime = Util.getMillis(); this.healthUpdateCounter = (updateCounter + 20); - } - else if (health > this.playerHealth && player.invulnerableTime > 0) { + } else if (health > this.playerHealth && player.invulnerableTime > 0) { this.lastSystemTime = Util.getMillis(); this.healthUpdateCounter = (updateCounter + 10); } @@ -127,7 +145,8 @@ public class HeartsRenderer { float healthMax = attrMaxHealth == null ? 0 : (float) attrMaxHealth.getValue(); float absorb = Mth.ceil(player.getAbsorptionAmount()); - // CHANGE: simulate 10 hearts max if there's more, so vanilla only renders one row max + // CHANGE: simulate 10 hearts max if there's more, so vanilla only renders one + // row max healthMax = Math.min(healthMax, 20f); health = Math.min(health, 20); absorb = Math.min(absorb, 20); @@ -139,9 +158,10 @@ public class HeartsRenderer { int left = width / 2 - 91; int top = height - left_height; - // change: these are unused below, unneeded? should these adjust the Forge variable? - //left_height += (healthRows * rowHeight); - //if (rowHeight != 10) left_height += 10 - rowHeight; + // change: these are unused below, unneeded? should these adjust the Forge + // variable? + // left_height += (healthRows * rowHeight); + // if (rowHeight != 10) left_height += 10 - rowHeight; this.regen = -1; if (player.hasEffect(MobEffects.REGENERATION)) { @@ -152,46 +172,46 @@ public class HeartsRenderer { final int TOP = 9 * (this.mc.level.getLevelData().isHardcore() ? 5 : 0); final int BACKGROUND = (highlight ? 25 : 16); int MARGIN = 16; - if (player.hasEffect(MobEffects.POISON)) MARGIN += 36; - else if (player.hasEffect(MobEffects.WITHER)) MARGIN += 72; + if (player.hasEffect(MobEffects.POISON)) + MARGIN += 36; + else if (player.hasEffect(MobEffects.WITHER)) + MARGIN += 72; float absorbRemaining = absorb; - PoseStack matrixStack = event.getMatrixStack(); + PoseStack matrixStack = event.getPoseStack(); for (int i = Mth.ceil((healthMax + absorb) / 2.0F) - 1; i >= 0; --i) { int row = Mth.ceil((float) (i + 1) / 10.0F) - 1; int x = left + i % 10 * 8; int y = top - row * rowHeight; - if (health <= 4) y += this.rand.nextInt(2); - if (i == this.regen) y -= 2; + if (health <= 4) + y += this.rand.nextInt(2); + if (i == this.regen) + y -= 2; this.blit(matrixStack, x, y, BACKGROUND, TOP, 9, 9); if (highlight) { if (i * 2 + 1 < healthLast) { - this.blit(matrixStack, x, y, MARGIN + 54, TOP, 9, 9); //6 - } - else if (i * 2 + 1 == healthLast) { - this.blit(matrixStack, x, y, MARGIN + 63, TOP, 9, 9); //7 + this.blit(matrixStack, x, y, MARGIN + 54, TOP, 9, 9); // 6 + } else if (i * 2 + 1 == healthLast) { + this.blit(matrixStack, x, y, MARGIN + 63, TOP, 9, 9); // 7 } } if (absorbRemaining > 0.0F) { if (absorbRemaining == absorb && absorb % 2.0F == 1.0F) { - this.blit(matrixStack, x, y, MARGIN + 153, TOP, 9, 9); //17 + this.blit(matrixStack, x, y, MARGIN + 153, TOP, 9, 9); // 17 absorbRemaining -= 1.0F; - } - else { - this.blit(matrixStack, x, y, MARGIN + 144, TOP, 9, 9); //16 + } else { + this.blit(matrixStack, x, y, MARGIN + 144, TOP, 9, 9); // 16 absorbRemaining -= 2.0F; } - } - else { + } else { if (i * 2 + 1 < health) { - this.blit(matrixStack, x, y, MARGIN + 36, TOP, 9, 9); //4 - } - else if (i * 2 + 1 == health) { - this.blit(matrixStack, x, y, MARGIN + 45, TOP, 9, 9); //5 + this.blit(matrixStack, x, y, MARGIN + 36, TOP, 9, 9); // 4 + } else if (i * 2 + 1 == health) { + this.blit(matrixStack, x, y, MARGIN + 45, TOP, 9, 9); // 5 } } } @@ -200,22 +220,24 @@ public class HeartsRenderer { this.renderExtraAbsorption(matrixStack, left, top - rowHeight, player); RenderSystem.setShaderTexture(0, ICON_VANILLA); - gui.left_height += 10; + gui.leftHeight += 10; if (absorb > 0) { - gui.left_height += 10; + gui.leftHeight += 10; } event.setCanceled(true); RenderSystem.disableBlend(); this.mc.getProfiler().pop(); - MinecraftForge.EVENT_BUS.post(new RenderGameOverlayEvent.PostLayer(matrixStack, event, ForgeIngameGui.PLAYER_HEALTH_ELEMENT)); + MinecraftForge.EVENT_BUS + .post(new RenderGuiOverlayEvent.Post(mc.getWindow(), event.getPoseStack(), event.getPartialTick(), ActualOverlay)); } /** * Gets the texture from potion effects - * @param player Player instance - * @return Texture offset for potion effects + * + * @param player Player instance + * @return Texture offset for potion effects */ private int getPotionOffset(Player player) { int potionOffset = 0; @@ -236,10 +258,11 @@ public class HeartsRenderer { /** * Renders the health above 10 hearts - * @param matrixStack Matrix stack instance - * @param xBasePos Health bar top corner - * @param yBasePos Health bar top corner - * @param player Player instance + * + * @param matrixStack Matrix stack instance + * @param xBasePos Health bar top corner + * @param yBasePos Health bar top corner + * @param player Player instance */ private void renderExtraHearts(PoseStack matrixStack, int xBasePos, int yBasePos, Player player) { int potionOffset = this.getPotionOffset(player); @@ -253,10 +276,11 @@ public class HeartsRenderer { /** * Renders the absorption health above 10 hearts - * @param matrixStack Matrix stack instance - * @param xBasePos Health bar top corner - * @param yBasePos Health bar top corner - * @param player Player instance + * + * @param matrixStack Matrix stack instance + * @param xBasePos Health bar top corner + * @param yBasePos Health bar top corner + * @param player Player instance */ private void renderExtraAbsorption(PoseStack matrixStack, int xBasePos, int yBasePos, Player player) { int potionOffset = this.getPotionOffset(player); @@ -269,8 +293,9 @@ public class HeartsRenderer { /** * Gets the texture offset from the regen effect - * @param i Heart index - * @param offset Current offset + * + * @param i Heart index + * @param offset Current offset */ private int getYRegenOffset(int i, int offset) { return i + offset == this.regen ? -2 : 0; diff --git a/src/main/resources/META-INF/mods.toml b/src/main/resources/META-INF/mods.toml index f71a626..142053f 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="[40,)" #mandatory This is typically bumped every Minecraft version by Forge. See our download page for lists of versions. +loaderVersion="[43,)" #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="GPLv3" @@ -51,7 +51,7 @@ modId="forge" #mandatory # Does this dependency have to exist - if not, ordering below must be specified mandatory=true #mandatory # The version range of the dependency -versionRange="[40,)" #mandatory +versionRange="[43,)" #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 @@ -61,10 +61,10 @@ side="BOTH" 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.18.2,1.19)" +versionRange="[1.19,1.20)" ordering="NONE" side="BOTH" -[[dependencies.libzontreck]] +[[dependencies.ariasessentials]] modId="libzontreck" mandatory=true versionRange="[1.10,1.11)" diff --git a/src/main/resources/pack.mcmeta b/src/main/resources/pack.mcmeta index d60a22f..e46d07d 100644 --- a/src/main/resources/pack.mcmeta +++ b/src/main/resources/pack.mcmeta @@ -2,7 +2,7 @@ "pack": { "description": "Aria's Essentials resources", "pack_format": 9, - "forge:resource_pack_format": 8, - "forge:data_pack_format": 9 + "forge:resource_pack_format": 9, + "forge:data_pack_format": 10 } } \ No newline at end of file