From 10b1697963a548b94b80fe0eaa3adc660b29f1e8 Mon Sep 17 00:00:00 2001 From: LordEnder_Kitty Date: Thu, 27 Jun 2024 21:24:03 -0500 Subject: [PATCH] Updated to 1.21 --- build.gradle | 8 +-- gradle.properties | 12 ++--- gradle/wrapper/gradle-wrapper.properties | 2 +- gradlew | 0 .../mixin/EntityRendererDispatcherMixin.java | 4 +- .../net/enderkitty/mixin/InGameHudMixin.java | 51 +++++++++---------- .../mixin/InGameOverlayRendererMixin.java | 15 +++--- .../enderkitty/mixin/OptionsScreenMixin.java | 2 +- src/main/resources/fabric.mod.json | 8 ++- 9 files changed, 52 insertions(+), 50 deletions(-) mode change 100644 => 100755 gradlew diff --git a/build.gradle b/build.gradle index d0c08a7..f0bd8ff 100644 --- a/build.gradle +++ b/build.gradle @@ -1,5 +1,5 @@ plugins { - id 'fabric-loom' version '1.6-SNAPSHOT' + id 'fabric-loom' version '1.7-SNAPSHOT' id 'maven-publish' } @@ -40,14 +40,14 @@ processResources { } tasks.withType(JavaCompile).configureEach { - it.options.release = 17 + it.options.release = 21 } java { withSourcesJar() - sourceCompatibility = JavaVersion.VERSION_17 - targetCompatibility = JavaVersion.VERSION_17 + sourceCompatibility = JavaVersion.VERSION_21 + targetCompatibility = JavaVersion.VERSION_21 } jar { diff --git a/gradle.properties b/gradle.properties index 080f8dd..eec5213 100644 --- a/gradle.properties +++ b/gradle.properties @@ -4,16 +4,16 @@ org.gradle.parallel=true # Fabric Properties # check these on https://fabricmc.net/develop -minecraft_version=1.20.6 -yarn_mappings=1.20.6+build.1 +minecraft_version=1.21 +yarn_mappings=1.21+build.4 loader_version=0.15.11 # Mod Properties -mod_version=1.1.0-1.20.5-6 +mod_version=1.1.1-1.21 maven_group=net.enderkitty archives_base_name=firehud # Dependencies -fabric_version=0.98.0+1.20.6 -cloth_config_version=14.0.126 -modmenu_version=10.0.0-beta.1 +fabric_version=0.100.4+1.21 +cloth_config_version=15.0.127 +modmenu_version=11.0.1 diff --git a/gradle/wrapper/gradle-wrapper.properties b/gradle/wrapper/gradle-wrapper.properties index b82aa23..a441313 100644 --- a/gradle/wrapper/gradle-wrapper.properties +++ b/gradle/wrapper/gradle-wrapper.properties @@ -1,6 +1,6 @@ distributionBase=GRADLE_USER_HOME distributionPath=wrapper/dists -distributionUrl=https\://services.gradle.org/distributions/gradle-8.7-bin.zip +distributionUrl=https\://services.gradle.org/distributions/gradle-8.8-bin.zip networkTimeout=10000 validateDistributionUrl=true zipStoreBase=GRADLE_USER_HOME diff --git a/gradlew b/gradlew old mode 100644 new mode 100755 diff --git a/src/main/java/net/enderkitty/mixin/EntityRendererDispatcherMixin.java b/src/main/java/net/enderkitty/mixin/EntityRendererDispatcherMixin.java index 9af866c..f099c73 100644 --- a/src/main/java/net/enderkitty/mixin/EntityRendererDispatcherMixin.java +++ b/src/main/java/net/enderkitty/mixin/EntityRendererDispatcherMixin.java @@ -28,8 +28,8 @@ @Mixin(EntityRenderDispatcher.class) public class EntityRendererDispatcherMixin { @Unique private static final FireHudConfig config = FireHud.getConfig(); - @Unique private static final SpriteIdentifier SOUL_FIRE_0 = new SpriteIdentifier(PlayerScreenHandler.BLOCK_ATLAS_TEXTURE, new Identifier("block/soul_fire_0")); - @Unique private static final SpriteIdentifier SOUL_FIRE_1 = new SpriteIdentifier(PlayerScreenHandler.BLOCK_ATLAS_TEXTURE, new Identifier("block/soul_fire_1")); + @Unique private static final SpriteIdentifier SOUL_FIRE_0 = new SpriteIdentifier(PlayerScreenHandler.BLOCK_ATLAS_TEXTURE, Identifier.of("block/soul_fire_0")); + @Unique private static final SpriteIdentifier SOUL_FIRE_1 = new SpriteIdentifier(PlayerScreenHandler.BLOCK_ATLAS_TEXTURE, Identifier.of("block/soul_fire_1")); @Inject(method = "renderFire", at = @At(value = "HEAD"), cancellable = true) private void renderThirdPersonFire(MatrixStack matrices, VertexConsumerProvider vertexConsumers, Entity entity, Quaternionf rotation, CallbackInfo ci) { diff --git a/src/main/java/net/enderkitty/mixin/InGameHudMixin.java b/src/main/java/net/enderkitty/mixin/InGameHudMixin.java index 65afa79..ef8832c 100644 --- a/src/main/java/net/enderkitty/mixin/InGameHudMixin.java +++ b/src/main/java/net/enderkitty/mixin/InGameHudMixin.java @@ -10,7 +10,9 @@ import net.minecraft.client.MinecraftClient; import net.minecraft.client.gui.DrawContext; import net.minecraft.client.gui.hud.InGameHud; -import net.minecraft.enchantment.EnchantmentHelper; +import net.minecraft.client.render.RenderTickCounter; +import net.minecraft.enchantment.Enchantments; +import net.minecraft.entity.EquipmentSlot; import net.minecraft.entity.effect.StatusEffects; import net.minecraft.entity.player.PlayerEntity; import net.minecraft.util.Identifier; @@ -23,26 +25,26 @@ @Environment(EnvType.CLIENT) @Mixin(InGameHud.class) public abstract class InGameHudMixin { - @Unique private static final Identifier FIRE_VIGNETTE = new Identifier(FireHud.MOD_ID, "textures/fire/fire_vignette.png"); - @Unique private static final Identifier SOUL_FIRE_VIGNETTE = new Identifier(FireHud.MOD_ID, "textures/fire/soul_fire_vignette.png"); + @Unique private static final Identifier FIRE_VIGNETTE = Identifier.of(FireHud.MOD_ID, "textures/fire/fire_vignette.png"); + @Unique private static final Identifier SOUL_FIRE_VIGNETTE = Identifier.of(FireHud.MOD_ID, "textures/fire/soul_fire_vignette.png"); - @Unique private static final Identifier FIRE_HEART_FULL_TEXTURE = new Identifier(FireHud.MOD_ID, "hud/heart/fire_full"); - @Unique private static final Identifier FIRE_HEART_FULL_BLINKING_TEXTURE = new Identifier(FireHud.MOD_ID, "hud/heart/fire_full_blinking"); - @Unique private static final Identifier FIRE_HEART_HALF_TEXTURE = new Identifier(FireHud.MOD_ID, "hud/heart/fire_half"); - @Unique private static final Identifier FIRE_HEART_HALF_BLINKING_TEXTURE = new Identifier(FireHud.MOD_ID, "hud/heart/fire_half_blinking"); - @Unique private static final Identifier FIRE_HEART_HARDCORE_FULL_TEXTURE = new Identifier(FireHud.MOD_ID, "hud/heart/fire_hardcore_full"); - @Unique private static final Identifier FIRE_HEART_HARDCORE_FULL_BLINKING_TEXTURE = new Identifier(FireHud.MOD_ID, "hud/heart/fire_hardcore_full_blinking"); - @Unique private static final Identifier FIRE_HEART_HARDCORE_HALF_TEXTURE = new Identifier(FireHud.MOD_ID, "hud/heart/fire_hardcore_half"); - @Unique private static final Identifier FIRE_HEART_HARDCORE_HALF_BLINKING_TEXTURE = new Identifier(FireHud.MOD_ID, "hud/heart/fire_hardcore_half_blinking"); + @Unique private static final Identifier FIRE_HEART_FULL_TEXTURE = Identifier.of(FireHud.MOD_ID, "hud/heart/fire_full"); + @Unique private static final Identifier FIRE_HEART_FULL_BLINKING_TEXTURE = Identifier.of(FireHud.MOD_ID, "hud/heart/fire_full_blinking"); + @Unique private static final Identifier FIRE_HEART_HALF_TEXTURE = Identifier.of(FireHud.MOD_ID, "hud/heart/fire_half"); + @Unique private static final Identifier FIRE_HEART_HALF_BLINKING_TEXTURE = Identifier.of(FireHud.MOD_ID, "hud/heart/fire_half_blinking"); + @Unique private static final Identifier FIRE_HEART_HARDCORE_FULL_TEXTURE = Identifier.of(FireHud.MOD_ID, "hud/heart/fire_hardcore_full"); + @Unique private static final Identifier FIRE_HEART_HARDCORE_FULL_BLINKING_TEXTURE = Identifier.of(FireHud.MOD_ID, "hud/heart/fire_hardcore_full_blinking"); + @Unique private static final Identifier FIRE_HEART_HARDCORE_HALF_TEXTURE = Identifier.of(FireHud.MOD_ID, "hud/heart/fire_hardcore_half"); + @Unique private static final Identifier FIRE_HEART_HARDCORE_HALF_BLINKING_TEXTURE = Identifier.of(FireHud.MOD_ID, "hud/heart/fire_hardcore_half_blinking"); - @Unique private static final Identifier SOUL_FIRE_HEART_FULL_TEXTURE = new Identifier(FireHud.MOD_ID, "hud/heart/soul_fire_full"); - @Unique private static final Identifier SOUL_FIRE_HEART_FULL_BLINKING_TEXTURE = new Identifier(FireHud.MOD_ID, "hud/heart/soul_fire_full_blinking"); - @Unique private static final Identifier SOUL_FIRE_HEART_HALF_TEXTURE = new Identifier(FireHud.MOD_ID, "hud/heart/soul_fire_half"); - @Unique private static final Identifier SOUL_FIRE_HEART_HALF_BLINKING_TEXTURE = new Identifier(FireHud.MOD_ID, "hud/heart/soul_fire_half_blinking"); - @Unique private static final Identifier SOUL_FIRE_HEART_HARDCORE_FULL_TEXTURE = new Identifier(FireHud.MOD_ID, "hud/heart/soul_fire_hardcore_full"); - @Unique private static final Identifier SOUL_FIRE_HEART_HARDCORE_FULL_BLINKING_TEXTURE = new Identifier(FireHud.MOD_ID, "hud/heart/soul_fire_hardcore_full_blinking"); - @Unique private static final Identifier SOUL_FIRE_HEART_HARDCORE_HALF_TEXTURE = new Identifier(FireHud.MOD_ID, "hud/heart/soul_fire_hardcore_half"); - @Unique private static final Identifier SOUL_FIRE_HEART_HARDCORE_HALF_BLINKING_TEXTURE = new Identifier(FireHud.MOD_ID, "hud/heart/soul_fire_hardcore_half_blinking"); + @Unique private static final Identifier SOUL_FIRE_HEART_FULL_TEXTURE = Identifier.of(FireHud.MOD_ID, "hud/heart/soul_fire_full"); + @Unique private static final Identifier SOUL_FIRE_HEART_FULL_BLINKING_TEXTURE = Identifier.of(FireHud.MOD_ID, "hud/heart/soul_fire_full_blinking"); + @Unique private static final Identifier SOUL_FIRE_HEART_HALF_TEXTURE = Identifier.of(FireHud.MOD_ID, "hud/heart/soul_fire_half"); + @Unique private static final Identifier SOUL_FIRE_HEART_HALF_BLINKING_TEXTURE = Identifier.of(FireHud.MOD_ID, "hud/heart/soul_fire_half_blinking"); + @Unique private static final Identifier SOUL_FIRE_HEART_HARDCORE_FULL_TEXTURE = Identifier.of(FireHud.MOD_ID, "hud/heart/soul_fire_hardcore_full"); + @Unique private static final Identifier SOUL_FIRE_HEART_HARDCORE_FULL_BLINKING_TEXTURE = Identifier.of(FireHud.MOD_ID, "hud/heart/soul_fire_hardcore_full_blinking"); + @Unique private static final Identifier SOUL_FIRE_HEART_HARDCORE_HALF_TEXTURE = Identifier.of(FireHud.MOD_ID, "hud/heart/soul_fire_hardcore_half"); + @Unique private static final Identifier SOUL_FIRE_HEART_HARDCORE_HALF_BLINKING_TEXTURE = Identifier.of(FireHud.MOD_ID, "hud/heart/soul_fire_hardcore_half_blinking"); @Unique FireHudConfig config = FireHud.getConfig(); @@ -51,17 +53,14 @@ public abstract class InGameHudMixin { private void drawHeart(DrawContext context, InGameHud.HeartType type, int x, int y, boolean hardcore, boolean blinking, boolean half, CallbackInfo ci) { if (MinecraftClient.getInstance().cameraEntity instanceof PlayerEntity playerEntity && !(!config.renderWithFireResistance && playerEntity.hasStatusEffect(StatusEffects.FIRE_RESISTANCE))) { if (config.renderFireHearts && type == InGameHud.HeartType.NORMAL) { - if (playerEntity.isOnFire() || (!EnchantmentHelper.hasFrostWalker(playerEntity) && - ((playerEntity.getSteppingBlockState().getBlock() == Blocks.MAGMA_BLOCK && !playerEntity.bypassesSteppingEffects()) || - playerEntity.getSteppingBlockState().getBlock() == Blocks.CAMPFIRE))) { + if (playerEntity.isOnFire() || ((playerEntity.getSteppingBlockState().getBlock() == Blocks.MAGMA_BLOCK && !playerEntity.bypassesSteppingEffects()) || + playerEntity.getSteppingBlockState().getBlock() == Blocks.CAMPFIRE)) { context.drawGuiTexture(getFireHeartTexture(hardcore, half, blinking), x, y, 9, 9); ci.cancel(); } if (config.renderSoulFire) { - if ((playerEntity.isOnFire() && ((SoulFireAccessor) playerEntity).isRenderSoulFire()) || - (!EnchantmentHelper.hasFrostWalker(playerEntity) && playerEntity.getSteppingBlockState().getBlock() == Blocks.SOUL_CAMPFIRE)) { - + if ((playerEntity.isOnFire() && ((SoulFireAccessor) playerEntity).isRenderSoulFire()) || playerEntity.getSteppingBlockState().getBlock() == Blocks.SOUL_CAMPFIRE) { context.drawGuiTexture(getSoulFireHeartTexture(hardcore, half, blinking), x, y, 9, 9); ci.cancel(); } @@ -72,7 +71,7 @@ private void drawHeart(DrawContext context, InGameHud.HeartType type, int x, int @Inject(method = "renderMiscOverlays", at = @At(value = "INVOKE", target = "Lnet/minecraft/client/network/ClientPlayerEntity;getFrozenTicks()I", shift = At.Shift.BEFORE)) - private void render(DrawContext context, float tickDelta, CallbackInfo ci) { + private void render(DrawContext context, RenderTickCounter tickCounter, CallbackInfo ci) { MinecraftClient client = MinecraftClient.getInstance(); PlayerEntity player = client.player; diff --git a/src/main/java/net/enderkitty/mixin/InGameOverlayRendererMixin.java b/src/main/java/net/enderkitty/mixin/InGameOverlayRendererMixin.java index ff4a767..6e5d773 100644 --- a/src/main/java/net/enderkitty/mixin/InGameOverlayRendererMixin.java +++ b/src/main/java/net/enderkitty/mixin/InGameOverlayRendererMixin.java @@ -31,7 +31,7 @@ @Mixin(InGameOverlayRenderer.class) public class InGameOverlayRendererMixin { @Unique private static final FireHudConfig config = FireHud.getConfig(); - @Unique private static final SpriteIdentifier SOUL_FIRE_1 = new SpriteIdentifier(PlayerScreenHandler.BLOCK_ATLAS_TEXTURE, new Identifier("block/soul_fire_1")); + @Unique private static final SpriteIdentifier SOUL_FIRE_1 = new SpriteIdentifier(PlayerScreenHandler.BLOCK_ATLAS_TEXTURE, Identifier.of("block/soul_fire_1")); @Inject(method = "renderOverlays", at = @At("TAIL")) private static void renderOverlays(MinecraftClient client, MatrixStack matrices, CallbackInfo ci) { @@ -70,8 +70,7 @@ private static Sprite getSprite(SpriteIdentifier obj, MinecraftClient client) { @Unique private static void renderSideFireOverlay(MinecraftClient client, MatrixStack matrices) { - BufferBuilder bufferBuilder = Tessellator.getInstance().getBuffer(); - RenderSystem.setShader(GameRenderer::getPositionColorTexProgram); + RenderSystem.setShader(GameRenderer::getPositionTexColorProgram); RenderSystem.depthFunc(519); RenderSystem.depthMask(false); RenderSystem.enableBlend(); @@ -95,11 +94,11 @@ private static void renderSideFireOverlay(MinecraftClient client, MatrixStack ma matrices.multiply(RotationAxis.POSITIVE_Y.rotationDegrees((float)(r * 2 - 1) * 70.0f)); matrices.multiply(RotationAxis.POSITIVE_Z.rotationDegrees((r == 1 ? -10.0f : 10.0f))); Matrix4f matrix4f = matrices.peek().getPositionMatrix(); - bufferBuilder.begin(VertexFormat.DrawMode.QUADS, VertexFormats.POSITION_COLOR_TEXTURE); - bufferBuilder.vertex(matrix4f, -0.5f, -0.5f, -0.5f).color(1.0f, 1.0f, 1.0f, config.fireOpacity).texture(n, p).next(); - bufferBuilder.vertex(matrix4f, 0.5f, -0.5f, -0.5f).color(1.0f, 1.0f, 1.0f, config.fireOpacity).texture(m, p).next(); - bufferBuilder.vertex(matrix4f, 0.5f, 0.5f, -0.5f).color(1.0f, 1.0f, 1.0f, config.fireOpacity).texture(m, o).next(); - bufferBuilder.vertex(matrix4f, -0.5f, 0.5f, -0.5f).color(1.0f, 1.0f, 1.0f, config.fireOpacity).texture(n, o).next(); + BufferBuilder bufferBuilder = Tessellator.getInstance().begin(VertexFormat.DrawMode.QUADS, VertexFormats.POSITION_TEXTURE_COLOR); + bufferBuilder.vertex(matrix4f, -0.5f, -0.5f, -0.5f).texture(n, p).color(1.0f, 1.0f, 1.0f, config.fireOpacity); + bufferBuilder.vertex(matrix4f, 0.5f, -0.5f, -0.5f).texture(m, p).color(1.0f, 1.0f, 1.0f, config.fireOpacity); + bufferBuilder.vertex(matrix4f, 0.5f, 0.5f, -0.5f).texture(m, o).color(1.0f, 1.0f, 1.0f, config.fireOpacity); + bufferBuilder.vertex(matrix4f, -0.5f, 0.5f, -0.5f).texture(n, o).color(1.0f, 1.0f, 1.0f, config.fireOpacity); BufferRenderer.drawWithGlobalProgram(bufferBuilder.end()); matrices.pop(); } diff --git a/src/main/java/net/enderkitty/mixin/OptionsScreenMixin.java b/src/main/java/net/enderkitty/mixin/OptionsScreenMixin.java index 805ca83..b41752d 100644 --- a/src/main/java/net/enderkitty/mixin/OptionsScreenMixin.java +++ b/src/main/java/net/enderkitty/mixin/OptionsScreenMixin.java @@ -26,7 +26,7 @@ public class OptionsScreenMixin extends Screen { @Shadow @Final private ThreePartsLayoutWidget layout; @Unique private static final ButtonTextures TEXTURES = new ButtonTextures( - new Identifier(FireHud.MOD_ID, "widget/config_button"), new Identifier(FireHud.MOD_ID, "widget/config_button_highlighted")); + Identifier.of(FireHud.MOD_ID, "widget/config_button"), Identifier.of(FireHud.MOD_ID, "widget/config_button_highlighted")); public OptionsScreenMixin(Text title) { super(title); } diff --git a/src/main/resources/fabric.mod.json b/src/main/resources/fabric.mod.json index 361ea4b..5ea4692 100644 --- a/src/main/resources/fabric.mod.json +++ b/src/main/resources/fabric.mod.json @@ -5,7 +5,11 @@ "name": "Fire Hud", "description": "Redesigns the visuals of being set on fire to be less intrusive", "authors": [ "LordEnder_Kitty" ], - "contact": {}, + "contact": { + "curseforge": "https://www.curseforge.com/minecraft/mc-mods/firehud", + "modrinth": "https://modrinth.com/mod/firehud", + "github": "https://github.com/LordEnder-Kitty/FireHud" + }, "license": "MIT", "icon": "assets/firehud/icon.png", "environment": "client", @@ -17,7 +21,7 @@ "accessWidener" : "firehud.accesswidener", "depends": { "fabricloader": ">=0.15.9", - "minecraft": "~1.20.5", + "minecraft": "~1.21", "java": ">=17", "fabric-api": "*", "cloth-config2": "*"