From 7a0da53f8d82fa488bcf3d02a3475efe2867c9b5 Mon Sep 17 00:00:00 2001 From: DarkKronicle Date: Fri, 20 Jan 2023 20:03:21 -0700 Subject: [PATCH] Update to 1.19.3 --- build.gradle | 8 ++++++++ gradle.properties | 10 +++++----- .../io/github/darkkronicle/kronhud/KronHUD.java | 3 +++ .../darkkronicle/kronhud/gui/hud/PlayerHud.java | 13 +++++++------ .../darkkronicle/kronhud/gui/hud/PotionsHud.java | 2 +- .../kronhud/gui/hud/simple/ReachHud.java | 9 ++++++++- .../kronhud/gui/hud/vanilla/CrosshairHud.java | 12 ++++++++---- .../kronhud/gui/screen/HudEditScreen.java | 11 +++++------ .../github/darkkronicle/kronhud/util/ItemUtil.java | 4 ++-- 9 files changed, 47 insertions(+), 25 deletions(-) diff --git a/build.gradle b/build.gradle index c4b7a81..fb07665 100644 --- a/build.gradle +++ b/build.gradle @@ -22,6 +22,14 @@ if (file("extra.properties").exists()) { repositories { maven { url "https://jitpack.io" } maven { url "https://maven.terraformersmc.com/releases" } + maven { + name = 'Ladysnake Mods' + url = 'https://ladysnake.jfrog.io/artifactory/mods' + content { + includeGroup 'io.github.ladysnake' + includeGroupByRegex 'io\\.github\\.onyxstudios.*' + } + } } dependencies { diff --git a/gradle.properties b/gradle.properties index 70bb74d..1f6b770 100644 --- a/gradle.properties +++ b/gradle.properties @@ -2,18 +2,18 @@ org.gradle.jvmargs=-Xmx1G # Fabric Properties # check these on https://fabricmc.net/versions.html -minecraft_version=1.19.2 -yarn_mappings=1.19.2+build.1 +minecraft_version=1.19.3 +yarn_mappings=1.19.3+build.1 loader_version=0.14.9 # Mod Properties -mod_version=2.2.3 +mod_version=2.2.4 maven_group=io.github.darkkronicle archives_base_name=KronHUD # Dependencies # currently not on the main fabric site, check on the maven: https://maven.fabricmc.net/net/fabricmc/fabric-api/fabric-api fabric_version=0.59.0+1.19.2 -darkkore_version=v0.3.1 -modmenu_version=4.0.6 +darkkore_version=v0.3.4 +modmenu_version=5.0.2 # Uploading data curseforge_slug=kronhud diff --git a/src/main/java/io/github/darkkronicle/kronhud/KronHUD.java b/src/main/java/io/github/darkkronicle/kronhud/KronHUD.java index a9b92b8..17d611e 100644 --- a/src/main/java/io/github/darkkronicle/kronhud/KronHUD.java +++ b/src/main/java/io/github/darkkronicle/kronhud/KronHUD.java @@ -19,11 +19,14 @@ import net.fabricmc.api.EnvType; import net.fabricmc.api.Environment; import net.fabricmc.fabric.api.client.rendering.v1.HudRenderCallback; +import org.apache.logging.log4j.LogManager; +import org.apache.logging.log4j.Logger; @Environment(EnvType.CLIENT) public class KronHUD implements ClientModInitializer { public static final String MOD_ID = "kronhud"; + public static Logger LOGGER = LogManager.getLogger("kronhud"); @Override public void onInitializeClient() { diff --git a/src/main/java/io/github/darkkronicle/kronhud/gui/hud/PlayerHud.java b/src/main/java/io/github/darkkronicle/kronhud/gui/hud/PlayerHud.java index 9365bf1..b4924d2 100644 --- a/src/main/java/io/github/darkkronicle/kronhud/gui/hud/PlayerHud.java +++ b/src/main/java/io/github/darkkronicle/kronhud/gui/hud/PlayerHud.java @@ -7,15 +7,17 @@ import io.github.darkkronicle.kronhud.gui.entry.BoxHudEntry; import io.github.darkkronicle.kronhud.hooks.KronHudHooks; import net.minecraft.client.MinecraftClient; +import net.minecraft.client.gui.screen.ingame.InventoryScreen; import net.minecraft.client.render.DiffuseLighting; import net.minecraft.client.render.VertexConsumerProvider; import net.minecraft.client.render.entity.EntityRenderDispatcher; import net.minecraft.client.util.math.MatrixStack; +import net.minecraft.entity.player.PlayerInventory; import net.minecraft.util.Identifier; import net.minecraft.util.math.MathHelper; -import net.minecraft.util.math.Quaternion; -import net.minecraft.util.math.Vec3d; -import net.minecraft.util.math.Vec3f; +import net.minecraft.util.math.RotationAxis; +import org.joml.Quaternionf; +import org.joml.Vector3f; import java.util.List; @@ -64,8 +66,7 @@ public void renderPlayer(double x, double y, float delta) { nextStack.translate(0, 0, 1000); float scale = getScale() * 40; nextStack.scale(scale, scale, scale); - - Quaternion quaternion = Vec3f.POSITIVE_Z.getDegreesQuaternion(180.0F); + Quaternionf quaternion = RotationAxis.POSITIVE_Z.rotationDegrees(180); nextStack.multiply(quaternion); // Rotate to whatever is wanted. Also make sure to offset the yaw @@ -73,7 +74,7 @@ public void renderPlayer(double x, double y, float delta) { if (dynamicRotation.getValue()) { deltaYaw -= (lastYawOffset + ((yawOffset - lastYawOffset) * delta)); } - nextStack.multiply(new Quaternion(new Vec3f(0, 1, 0), deltaYaw - 180 + rotation.getValue().floatValue(), true)); + nextStack.multiply(RotationAxis.POSITIVE_Y.rotationDegrees(deltaYaw - 180 + rotation.getValue().floatValue())); // Save these to set them back later float pastYaw = client.player.getYaw(); diff --git a/src/main/java/io/github/darkkronicle/kronhud/gui/hud/PotionsHud.java b/src/main/java/io/github/darkkronicle/kronhud/gui/hud/PotionsHud.java index 390c2be..a41453e 100644 --- a/src/main/java/io/github/darkkronicle/kronhud/gui/hud/PotionsHud.java +++ b/src/main/java/io/github/darkkronicle/kronhud/gui/hud/PotionsHud.java @@ -108,7 +108,7 @@ private void renderPotion(MatrixStack matrices, StatusEffectInstance effect, int StatusEffect type = effect.getEffectType(); Sprite sprite = client.getStatusEffectSpriteManager().getSprite(type); - RenderSystem.setShaderTexture(0, sprite.getAtlas().getId()); + RenderSystem.setShaderTexture(0, sprite.getAtlasId()); RenderSystem.setShaderColor(1, 1, 1, 1); DrawableHelper.drawSprite(matrices, x, y, 0, 18, 18, sprite); if (!iconsOnly.getValue()) { diff --git a/src/main/java/io/github/darkkronicle/kronhud/gui/hud/simple/ReachHud.java b/src/main/java/io/github/darkkronicle/kronhud/gui/hud/simple/ReachHud.java index 1ff786a..1f3649f 100644 --- a/src/main/java/io/github/darkkronicle/kronhud/gui/hud/simple/ReachHud.java +++ b/src/main/java/io/github/darkkronicle/kronhud/gui/hud/simple/ReachHud.java @@ -1,6 +1,7 @@ package io.github.darkkronicle.kronhud.gui.hud.simple; import com.google.common.util.concurrent.AtomicDouble; +import io.github.darkkronicle.kronhud.KronHUD; import io.github.darkkronicle.kronhud.config.KronConfig; import io.github.darkkronicle.kronhud.config.KronInteger; import io.github.darkkronicle.kronhud.gui.entry.SimpleTextHudEntry; @@ -85,7 +86,13 @@ public static double getAttackDistance(Entity attacking, Entity receiving) { } public void updateDistance(Entity attacking, Entity receiving) { - double distance = getAttackDistance(attacking, receiving); + double distance; + try { + distance = getAttackDistance(attacking, receiving); + } catch (Exception e) { + KronHUD.LOGGER.warn("Couldn't compute attack distance: ", e); + return; + } if (distance < 0) { // This should not happen... currentDist = "NaN"; diff --git a/src/main/java/io/github/darkkronicle/kronhud/gui/hud/vanilla/CrosshairHud.java b/src/main/java/io/github/darkkronicle/kronhud/gui/hud/vanilla/CrosshairHud.java index 42a9b0c..a28d168 100644 --- a/src/main/java/io/github/darkkronicle/kronhud/gui/hud/vanilla/CrosshairHud.java +++ b/src/main/java/io/github/darkkronicle/kronhud/gui/hud/vanilla/CrosshairHud.java @@ -14,18 +14,22 @@ import io.github.darkkronicle.kronhud.util.Rectangle; import lombok.AllArgsConstructor; import net.minecraft.block.AbstractChestBlock; +import net.minecraft.client.Keyboard; import net.minecraft.client.gui.DrawableHelper; +import net.minecraft.client.gui.hud.InGameHud; import net.minecraft.client.option.AttackIndicator; import net.minecraft.client.render.Camera; import net.minecraft.client.render.GameRenderer; +import net.minecraft.client.render.debug.DebugRenderer; import net.minecraft.client.util.math.MatrixStack; import net.minecraft.entity.LivingEntity; import net.minecraft.util.Identifier; import net.minecraft.util.hit.BlockHitResult; import net.minecraft.util.hit.HitResult; import net.minecraft.util.math.BlockPos; -import net.minecraft.util.math.Vec3f; +import net.minecraft.util.math.RotationAxis; import net.minecraft.world.World; +import org.joml.Vector3f; import java.util.List; @@ -78,8 +82,8 @@ public void render(MatrixStack matrices, float delta) { MatrixStack matrixStack = RenderSystem.getModelViewStack(); matrixStack.push(); matrixStack.translate(getRawX() + ((float) getWidth() / 2), getRawY() + ((float) getHeight() / 2), 0); - matrixStack.multiply(Vec3f.NEGATIVE_X.getDegreesQuaternion(camera.getPitch())); - matrixStack.multiply(Vec3f.POSITIVE_Y.getDegreesQuaternion(camera.getYaw())); + matrixStack.multiply(RotationAxis.NEGATIVE_X.rotationDegrees(camera.getPitch())); + matrixStack.multiply(RotationAxis.POSITIVE_Y.rotationDegrees(camera.getYaw())); matrixStack.scale(-getScale(), -getScale(), getScale()); RenderSystem.applyModelViewMatrix(); RenderSystem.renderCrosshair(10); @@ -87,7 +91,7 @@ public void render(MatrixStack matrices, float delta) { RenderSystem.applyModelViewMatrix(); } else if (type.getValue() == Crosshair.TEXTURE) { RenderSystem.setShaderColor(1.0F, 1.0F, 1.0F, 1.0F); - RenderSystem.setShader(GameRenderer::getPositionTexShader); + RenderSystem.setShader(GameRenderer::getPositionTexProgram); RenderSystem.setShaderTexture(0, DrawableHelper.GUI_ICONS_TEXTURE); // Draw crosshair diff --git a/src/main/java/io/github/darkkronicle/kronhud/gui/screen/HudEditScreen.java b/src/main/java/io/github/darkkronicle/kronhud/gui/screen/HudEditScreen.java index ba79bf1..658a639 100644 --- a/src/main/java/io/github/darkkronicle/kronhud/gui/screen/HudEditScreen.java +++ b/src/main/java/io/github/darkkronicle/kronhud/gui/screen/HudEditScreen.java @@ -42,20 +42,19 @@ public HudEditScreen(Screen parent) { @Override public void init() { super.init(); - addDrawableChild(new ButtonWidget(width / 2 - 50, height - 50 - 22, 100, 20, - getSnappingButtonText(), (button) -> { + addDrawableChild(new ButtonWidget.Builder(getSnappingButtonText(), + (button) -> { snapEnabled = !snapEnabled; updateSnapState(); button.setMessage(getSnappingButtonText()); - })); + }).dimensions(width / 2 - 50, height - 50 - 22, 100, 20).build()); addDrawableChild( - new ButtonWidget(width / 2 - 50, height - 50 , 100, 20, - Text.translatable("button.kronhud.configuration"), + new ButtonWidget.Builder(Text.translatable("button.kronhud.configuration"), (button) -> { HudConfigScreen screen = new HudConfigScreen(); screen.setParent(this); client.setScreen(screen); - })); + }).dimensions(width / 2 - 50, height - 50 , 100, 20).build()); } private Text getSnappingButtonText() { diff --git a/src/main/java/io/github/darkkronicle/kronhud/util/ItemUtil.java b/src/main/java/io/github/darkkronicle/kronhud/util/ItemUtil.java index 25a4c3d..93997d6 100644 --- a/src/main/java/io/github/darkkronicle/kronhud/util/ItemUtil.java +++ b/src/main/java/io/github/darkkronicle/kronhud/util/ItemUtil.java @@ -75,7 +75,7 @@ public Optional getItemFromItem(ItemStack item, List getTimedItemFromItem(ItemStack item, ItemStack compare = item.copy(); compare.setCount(1); for (ItemUtil.TimedItemStorage storage : list) { - if (storage.stack.isItemEqualIgnoreDamage(compare)) { + if (storage.stack.isItemEqual(compare)) { return Optional.of(storage); } }