Skip to content
This repository has been archived by the owner on Sep 19, 2024. It is now read-only.

Commit

Permalink
Update to 1.19.3
Browse files Browse the repository at this point in the history
  • Loading branch information
DarkKronicle committed Jan 21, 2023
1 parent 703b87a commit 7a0da53
Show file tree
Hide file tree
Showing 9 changed files with 47 additions and 25 deletions.
8 changes: 8 additions & 0 deletions build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down
10 changes: 5 additions & 5 deletions gradle.properties
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
3 changes: 3 additions & 0 deletions src/main/java/io/github/darkkronicle/kronhud/KronHUD.java
Original file line number Diff line number Diff line change
Expand Up @@ -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() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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;

Expand Down Expand Up @@ -64,16 +66,15 @@ 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
float deltaYaw = client.player.getYaw(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();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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()) {
Expand Down
Original file line number Diff line number Diff line change
@@ -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;
Expand Down Expand Up @@ -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";
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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;

Expand Down Expand Up @@ -78,16 +82,16 @@ 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);
matrixStack.pop();
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
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,7 @@ public Optional<ItemUtil.ItemStorage> getItemFromItem(ItemStack item, List<ItemU
ItemStack compare = item.copy();
compare.setCount(1);
for (ItemUtil.ItemStorage storage : list) {
if (storage.stack.isItemEqualIgnoreDamage(compare)) {
if (storage.stack.isItemEqual(compare)) {
return Optional.of(storage);
}
}
Expand All @@ -86,7 +86,7 @@ public Optional<ItemUtil.TimedItemStorage> 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);
}
}
Expand Down

1 comment on commit 7a0da53

@hexadecimal233
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

So when to update BetterBlockOutline 🤔

Please sign in to comment.