Skip to content

Commit

Permalink
Updated to 1.21
Browse files Browse the repository at this point in the history
  • Loading branch information
LordEnder-Kitty committed Jun 28, 2024
1 parent 99658c5 commit 10b1697
Show file tree
Hide file tree
Showing 9 changed files with 52 additions and 50 deletions.
8 changes: 4 additions & 4 deletions build.gradle
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
plugins {
id 'fabric-loom' version '1.6-SNAPSHOT'
id 'fabric-loom' version '1.7-SNAPSHOT'
id 'maven-publish'
}

Expand Down Expand Up @@ -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 {
Expand Down
12 changes: 6 additions & 6 deletions gradle.properties
Original file line number Diff line number Diff line change
Expand Up @@ -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
2 changes: 1 addition & 1 deletion gradle/wrapper/gradle-wrapper.properties
Original file line number Diff line number Diff line change
@@ -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
Expand Down
Empty file modified gradlew
100644 → 100755
Empty file.
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand Down
51 changes: 25 additions & 26 deletions src/main/java/net/enderkitty/mixin/InGameHudMixin.java
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand All @@ -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();

Expand All @@ -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();
}
Expand All @@ -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;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand Down Expand Up @@ -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();
Expand All @@ -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();
}
Expand Down
2 changes: 1 addition & 1 deletion src/main/java/net/enderkitty/mixin/OptionsScreenMixin.java
Original file line number Diff line number Diff line change
Expand Up @@ -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); }

Expand Down
8 changes: 6 additions & 2 deletions src/main/resources/fabric.mod.json
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand All @@ -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": "*"
Expand Down

0 comments on commit 10b1697

Please sign in to comment.