Skip to content

Commit c94b4ee

Browse files
committed
1.21.5 support
1 parent 2b9e8e3 commit c94b4ee

File tree

4 files changed

+13
-17
lines changed

4 files changed

+13
-17
lines changed

gradle.properties

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,15 @@
11
# Done to increase the memory available to gradle.
22
org.gradle.jvmargs=-Xmx1G
33
# Fabric Properties
4-
minecraft_version=1.21.4
5-
yarn_mappings=1.21.4+build.8
6-
loader_version=0.16.10
4+
minecraft_version=1.21.5
5+
yarn_mappings=1.21.5+build.1
6+
loader_version=0.16.13
77

88
# Fabric API
9-
fabric_version=0.119.2+1.21.4
9+
fabric_version=0.119.9+1.21.5
1010

1111
# Mod Properties
12-
mod_version=1.5.2
12+
mod_version=1.5.3
1313
maven_group=org.samo_lego
1414
archives_base_name=healthcare
1515
# Dependencies

src/main/java/org/samo_lego/healthcare/healthbar/PlayerHealthbar.java

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -38,15 +38,15 @@ public void toTag(CompoundTag tag) {
3838
}
3939

4040
public void fromTag(CompoundTag tag) {
41-
this.healthbarStyle = HealthbarStyle.valueOf(tag.getString("Style"));
42-
this.enabled = tag.getBoolean("Enabled");
43-
this.showType = tag.getBoolean("ShowType");
44-
this.alwaysVisible = tag.getBoolean("AlwaysVisible");
41+
this.healthbarStyle = HealthbarStyle.valueOf(tag.getString("Style").orElse(this.healthbarStyle.name()));
42+
this.enabled = tag.getBoolean("Enabled").orElse(this.enabled);
43+
this.showType = tag.getBoolean("ShowType").orElse(this.showType);
44+
this.alwaysVisible = tag.getBoolean("AlwaysVisible").orElse(this.alwaysVisible);
4545

4646
if (this.healthbarStyle == HealthbarStyle.CUSTOM) {
47-
this.customFullChar = (char) tag.getInt("FullChar");
48-
this.customEmptyChar = (char) tag.getInt("EmptyChar");
49-
this.customLength = tag.getInt("Length");
47+
this.customFullChar = tag.getInt("FullChar").map(integer -> (char) integer.intValue()).orElse(this.customFullChar);
48+
this.customEmptyChar = tag.getInt("EmptyChar").map(integer -> (char) integer.intValue()).orElse(this.customEmptyChar);
49+
this.customLength = tag.getInt("Length").orElse(this.customLength);
5050
}
5151
}
5252
}

src/main/java/org/samo_lego/healthcare/mixin/PlayerEntityMixinCast_Preferences.java

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -48,10 +48,7 @@ private void writeCustomDataToTag(CompoundTag tag, CallbackInfo ci) {
4848

4949
@Inject(method = "readAdditionalSaveData", at = @At("TAIL"))
5050
private void readCustomDataFromTag(CompoundTag tag, CallbackInfo ci) {
51-
if (tag.contains("Healthbar")) {
52-
CompoundTag healthbar = tag.getCompound("Healthbar");
53-
this.hc_healthbar.fromTag(healthbar);
54-
}
51+
tag.getCompound("Healthbar").ifPresent(this.hc_healthbar::fromTag);
5552
}
5653

5754
@Override

src/main/java/org/samo_lego/healthcare/mixin/ServerCommonPacketListenerMixin_HealthTag.java

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
package org.samo_lego.healthcare.mixin;
22

3-
import net.fabricmc.loader.api.FabricLoader;
43
import net.minecraft.ChatFormatting;
54
import net.minecraft.network.PacketSendListener;
65
import net.minecraft.network.chat.Component;

0 commit comments

Comments
 (0)