Skip to content

Commit

Permalink
Update to Minecraft 1.20.2
Browse files Browse the repository at this point in the history
- Fix F3 debug HUD detection.
- Handle new split textures correctly.
- Update Gradle, Loom, FLoader/FAPI, Yarn.
  • Loading branch information
retrixe committed Dec 5, 2024
1 parent 9abb6a0 commit 4dd329f
Show file tree
Hide file tree
Showing 5 changed files with 25 additions and 19 deletions.
22 changes: 14 additions & 8 deletions build.gradle
Original file line number Diff line number Diff line change
@@ -1,15 +1,15 @@
plugins {
id 'fabric-loom' version '1.2-SNAPSHOT'
id 'fabric-loom' version '1.4-SNAPSHOT'
id 'maven-publish'
}

sourceCompatibility = JavaVersion.VERSION_17
targetCompatibility = JavaVersion.VERSION_17

archivesBaseName = project.archives_base_name
version = project.mod_version
group = project.maven_group

base {
archivesName = project.archives_base_name
}

repositories {
// Add repositories to retrieve artifacts from in here.
// You should only use this when depending on other mods because
Expand All @@ -19,14 +19,18 @@ repositories {
}

dependencies {
//to change the versions see the gradle.properties file
// To change the versions see the gradle.properties file
minecraft "com.mojang:minecraft:${project.minecraft_version}"
mappings "net.fabricmc:yarn:${project.yarn_mappings}:v2"
modImplementation "net.fabricmc:fabric-loader:${project.loader_version}"

// Fabric API. This is technically optional, but you probably want it anyway.
modImplementation "net.fabricmc.fabric-api:fabric-api:${project.fabric_version}"

// Uncomment the following line to enable the deprecated Fabric API modules.
// These are included in the Fabric API production distribution and allow you to update your mod to the latest modules at a later more convenient time.

// modImplementation "net.fabricmc.fabric-api:fabric-api-deprecated:${project.fabric_version}"
}

processResources {
Expand All @@ -38,7 +42,6 @@ processResources {
}

tasks.withType(JavaCompile).configureEach {
// Minecraft 1.18 (1.18-pre2) upwards uses Java 17.
it.options.release = 17
}

Expand All @@ -47,11 +50,14 @@ java {
// if it is present.
// If you remove this line, sources will not be generated.
withSourcesJar()

sourceCompatibility = JavaVersion.VERSION_17
targetCompatibility = JavaVersion.VERSION_17
}

jar {
from("LICENSE") {
rename { "${it}_${project.archivesBaseName}"}
rename { "${it}_${project.base.archivesName.get()}"}
}
}

Expand Down
10 changes: 5 additions & 5 deletions gradle.properties
Original file line number Diff line number Diff line change
Expand Up @@ -8,14 +8,14 @@ org.gradle.jvmargs=-Xmx1G
# To remap the mixin locations:
# gradlew migrateMappings --mappings "1.16.1+build.9"

minecraft_version=1.20.1
yarn_mappings=1.20.1+build.8
loader_version=0.14.21
minecraft_version=1.20.2
yarn_mappings=1.20.2+build.4
loader_version=0.14.24

#Fabric api
fabric_version=0.84.0+1.20.1
fabric_version=0.90.4+1.20.2

# Mod Properties
mod_version = 1.20.1-fabric-2
mod_version = 1.20.2-fabric-1
maven_group = net.torocraft
archives_base_name = torohealth
2 changes: 1 addition & 1 deletion gradle/wrapper/gradle-wrapper.properties
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
distributionUrl=https://services.gradle.org/distributions/gradle-8.1.1-bin.zip
distributionUrl=https://services.gradle.org/distributions/gradle-8.4-bin.zip
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,8 @@

public class BarDisplay {

private static final Identifier ICON_TEXTURES = new Identifier("textures/gui/icons.png");
private static final Identifier ARMOR_TEXTURE = new Identifier("hud/armor_full");
private static final Identifier HEART_TEXTURE = new Identifier("hud/heart/full");
private final MinecraftClient mc;

public BarDisplay(MinecraftClient mc) {
Expand All @@ -27,7 +28,6 @@ public void draw(DrawContext drawContext, LivingEntity entity) {

RenderSystem.setShaderColor(1.0F, 1.0F, 1.0F, 1.0F);
RenderSystem.setShader(GameRenderer::getPositionTexProgram);
RenderSystem.setShaderTexture(0, ICON_TEXTURES);
RenderSystem.enableBlend();

HealthBarRenderer.render(drawContext.getMatrices(), drawContext.getVertexConsumers(), entity, 63, 14, 130, false);
Expand Down Expand Up @@ -58,10 +58,10 @@ public void draw(DrawContext drawContext, LivingEntity entity) {
}

private void renderArmorIcon(DrawContext drawContext, int x, int y) {
drawContext.drawTexture(ICON_TEXTURES, x, y, 34, 9, 9, 9);
drawContext.drawGuiTexture(ARMOR_TEXTURE, x, y, 9, 9);
}

private void renderHeartIcon(DrawContext drawContext, int x, int y) {
drawContext.drawTexture(ICON_TEXTURES, x, y, 16 + 36, 0, 9, 9);
drawContext.drawGuiTexture(HEART_TEXTURE, x, y, 9, 9);
}
}
2 changes: 1 addition & 1 deletion src/main/java/net/torocraft/torohealth/display/Hud.java
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ public Hud() {
}

public void draw(DrawContext drawContext, Config config) {
if (this.client.options.debugEnabled) {
if (this.client.getDebugHud().shouldShowDebugHud()) {
return;
}
this.config = config;
Expand Down

0 comments on commit 4dd329f

Please sign in to comment.