Skip to content

Commit a8ca267

Browse files
committed
1.20
1 parent 2eded7c commit a8ca267

File tree

6 files changed

+47
-55
lines changed

6 files changed

+47
-55
lines changed

build.gradle

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -67,7 +67,7 @@ tasks.withType(JavaCompile).configureEach {
6767
it.options.encoding = "UTF-8"
6868

6969
// Minecraft 1.17 (21w19a) upwards uses Java 16.
70-
it.options.release = 16
70+
it.options.release = 17
7171
}
7272

7373

gradle.properties

Lines changed: 6 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,15 @@
11
# Done to increase the memory available to gradle.
22
org.gradle.jvmargs=-Xmx1G
33
# Fabric Properties
4-
minecraft_version=1.19.3
5-
yarn_mappings=1.19.3+build.3
6-
loader_version=0.14.11
4+
minecraft_version=1.20
5+
yarn_mappings=1.20+build.1
6+
loader_version=0.14.21
77
#Fabric api
8-
fabric_version=0.69.1+1.19.3
9-
quilt_mappings=1
8+
fabric_version=0.83.0+1.20
109
# Mod Properties
11-
mod_version=1.3.0
10+
mod_version=1.3.1
1211
maven_group=org.samo_lego
1312
archives_base_name=healthcare
1413
# Dependencies
15-
c2b_version=1.2.3
14+
c2b_version=1.2.5
1615
translations_version=2.0.0-beta.2+1.19.4-pre2

src/main/java/org/samo_lego/healthcare/command/HealthbarCommand.java

Lines changed: 34 additions & 34 deletions
Original file line numberDiff line numberDiff line change
@@ -92,11 +92,11 @@ private static int toggleEntityType(CommandContext<CommandSourceStack> context)
9292

9393
preferences.healthcarePrefs().showType = allowEntityType;
9494

95-
context.getSource().sendSuccess(
96-
Component.translatable("healthcare.healthbar.toggledType", allowEntityType)
97-
.withStyle(ChatFormatting.GREEN)
98-
.append("\n")
99-
.append(Component.translatable("healthcare.healthbar.reloadRequired").withStyle(ChatFormatting.GOLD)),
95+
context.getSource().sendSuccess(() ->
96+
Component.translatable("healthcare.healthbar.toggledType", allowEntityType)
97+
.withStyle(ChatFormatting.GREEN)
98+
.append("\n")
99+
.append(Component.translatable("healthcare.healthbar.reloadRequired").withStyle(ChatFormatting.GOLD)),
100100
false
101101
);
102102
return 1;
@@ -107,16 +107,16 @@ private static int editHealthbarLength(CommandContext<CommandSourceStack> contex
107107
int length = IntegerArgumentType.getInteger(context, "length");
108108
preferences.healthcarePrefs().customLength = length;
109109

110-
context.getSource().sendSuccess(
111-
Component.translatable("healthcare.healthbar.customLengthSet", length)
112-
.withStyle(ChatFormatting.GREEN)
113-
.append("\n")
114-
.append(Component.translatable("healthcare.healthbar.reloadRequired").withStyle(ChatFormatting.GOLD)),
110+
context.getSource().sendSuccess(() ->
111+
Component.translatable("healthcare.healthbar.customLengthSet", length)
112+
.withStyle(ChatFormatting.GREEN)
113+
.append("\n")
114+
.append(Component.translatable("healthcare.healthbar.reloadRequired").withStyle(ChatFormatting.GOLD)),
115115
false
116116
);
117117
if (preferences.healthcarePrefs().healthbarStyle != HealthbarStyle.CUSTOM) {
118-
context.getSource().sendSuccess(
119-
Component.translatable("healthcare.healthbar.useCustomStyle").withStyle(ChatFormatting.GOLD),
118+
context.getSource().sendSuccess(() ->
119+
Component.translatable("healthcare.healthbar.useCustomStyle").withStyle(ChatFormatting.GOLD),
120120
false
121121
);
122122
}
@@ -134,16 +134,16 @@ private static int setSymbol(CommandContext<CommandSourceStack> context, boolean
134134
preferences.healthcarePrefs().customEmptyChar = symbol;
135135
}
136136

137-
context.getSource().sendSuccess(
138-
Component.translatable("healthcare.healthbar.customSymbolSet", full ? "Full" : "Empty", symbol)
139-
.withStyle(ChatFormatting.GREEN)
140-
.append("\n")
141-
.append(Component.translatable("healthcare.healthbar.reloadRequired").withStyle(ChatFormatting.GOLD)),
137+
context.getSource().sendSuccess(() ->
138+
Component.translatable("healthcare.healthbar.customSymbolSet", full ? "Full" : "Empty", symbol)
139+
.withStyle(ChatFormatting.GREEN)
140+
.append("\n")
141+
.append(Component.translatable("healthcare.healthbar.reloadRequired").withStyle(ChatFormatting.GOLD)),
142142
false
143143
);
144144
if (preferences.healthcarePrefs().healthbarStyle != HealthbarStyle.CUSTOM) {
145-
context.getSource().sendSuccess(
146-
Component.translatable("healthcare.healthbar.useCustomStyle").withStyle(ChatFormatting.GOLD),
145+
context.getSource().sendSuccess(() ->
146+
Component.translatable("healthcare.healthbar.useCustomStyle").withStyle(ChatFormatting.GOLD),
147147
false
148148
);
149149
}
@@ -157,11 +157,11 @@ private static int changeVisibility(CommandContext<CommandSourceStack> context)
157157

158158
preferences.healthcarePrefs().alwaysVisible = alwaysVisible;
159159

160-
context.getSource().sendSuccess(
161-
Component.translatable("healthcare.healthbar.visibilitySet", alwaysVisible)
162-
.withStyle(ChatFormatting.GREEN)
163-
.append("\n")
164-
.append(Component.translatable("healthcare.healthbar.reloadRequired").withStyle(ChatFormatting.GOLD)),
160+
context.getSource().sendSuccess(() ->
161+
Component.translatable("healthcare.healthbar.visibilitySet", alwaysVisible)
162+
.withStyle(ChatFormatting.GREEN)
163+
.append("\n")
164+
.append(Component.translatable("healthcare.healthbar.reloadRequired").withStyle(ChatFormatting.GOLD)),
165165
false
166166
);
167167
return 1;
@@ -173,11 +173,11 @@ private static int editHealthbarStyle(CommandContext<CommandSourceStack> context
173173

174174
preferences.healthcarePrefs().healthbarStyle = style;
175175

176-
context.getSource().sendSuccess(
177-
Component.translatable("healthcare.healthbar.styleSet", style)
178-
.withStyle(ChatFormatting.GREEN)
179-
.append("\n")
180-
.append(Component.translatable("healthcare.healthbar.reloadRequired").withStyle(ChatFormatting.GOLD)),
176+
context.getSource().sendSuccess(() ->
177+
Component.translatable("healthcare.healthbar.styleSet", style)
178+
.withStyle(ChatFormatting.GREEN)
179+
.append("\n")
180+
.append(Component.translatable("healthcare.healthbar.reloadRequired").withStyle(ChatFormatting.GOLD)),
181181
false
182182
);
183183
return 1;
@@ -188,11 +188,11 @@ private static int toggleHealthBar(CommandContext<CommandSourceStack> context) t
188188
boolean enabled = !preferences.healthcarePrefs().enabled;
189189
preferences.healthcarePrefs().enabled = enabled;
190190

191-
context.getSource().sendSuccess(
192-
Component.translatable(enabled ? "healthcare.healthbar.healthbarEnabled" : "healthcare.healthbar.healthbarDisabled")
193-
.withStyle(ChatFormatting.GREEN)
194-
.append("\n")
195-
.append(Component.translatable("healthcare.healthbar.reloadRequired").withStyle(ChatFormatting.GOLD)),
191+
context.getSource().sendSuccess(() ->
192+
Component.translatable(enabled ? "healthcare.healthbar.healthbarEnabled" : "healthcare.healthbar.healthbarDisabled")
193+
.withStyle(ChatFormatting.GREEN)
194+
.append("\n")
195+
.append(Component.translatable("healthcare.healthbar.reloadRequired").withStyle(ChatFormatting.GOLD)),
196196
false
197197
);
198198

src/main/java/org/samo_lego/healthcare/command/HealthcareCommand.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -42,8 +42,8 @@ private static int reloadConfig(CommandContext<CommandSourceStack> ctx) {
4242
HealthConfig newConfig = HealthConfig.loadConfigFile(CONFIG_FILE);
4343
config.reload(newConfig);
4444

45-
ctx.getSource().sendSuccess(
46-
Component.translatable("healthcare.config_reload_success").withStyle(ChatFormatting.GREEN),
45+
ctx.getSource().sendSuccess(() ->
46+
Component.translatable("healthcare.config_reload_success").withStyle(ChatFormatting.GREEN),
4747
false
4848
);
4949
return 1;

src/main/java/org/samo_lego/healthcare/config/HealthConfig.java

Lines changed: 2 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -7,14 +7,7 @@
77
import org.samo_lego.config2brigadier.annotation.BrigadierDescription;
88
import org.samo_lego.healthcare.healthbar.HealthbarStyle;
99

10-
import java.io.BufferedReader;
11-
import java.io.File;
12-
import java.io.FileInputStream;
13-
import java.io.FileOutputStream;
14-
import java.io.IOException;
15-
import java.io.InputStreamReader;
16-
import java.io.OutputStreamWriter;
17-
import java.io.Writer;
10+
import java.io.*;
1811
import java.nio.charset.StandardCharsets;
1912
import java.util.Arrays;
2013
import java.util.List;
@@ -55,7 +48,7 @@ public class HealthConfig implements IBrigadierConfigurator {
5548
@SerializedName("// The default style of healthbar. The following are available")
5649
public final String _comment_defaultStyle1 = Arrays.toString(HealthbarStyle.values());
5750
@BrigadierDescription(defaultOption = "PERCENTAGE")
58-
public HealthbarStyle defaultStyle = HealthbarStyle.PERCENTAGE;
51+
public HealthbarStyle defaultStyle = HealthbarStyle.SKYBLOCK;
5952

6053
@SerializedName("// Whether healthbar is enabled by default.")
6154
public final String _comment_enabled = "";

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

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,7 @@ public abstract class ServerPlayNetworkHandlerMixin_HealthTag {
5353
* it accordingly to player's preferences if it is
5454
* an {@link ClientboundSetEntityDataPacket}.
5555
*
56-
* @param packet packet being sent
56+
* @param sendPacket packet being sent
5757
* @param listener
5858
* @param ci
5959
*/
@@ -68,7 +68,7 @@ public abstract class ServerPlayNetworkHandlerMixin_HealthTag {
6868
private void onPacketSend(Packet<?> sendPacket, PacketSendListener listener, CallbackInfo ci) {
6969
if (sendPacket instanceof ClientboundSetEntityDataPacket packet && !this.hc_skipCheck) {
7070
int id = packet.id();
71-
Entity entity = this.player.getLevel().getEntity(id);
71+
Entity entity = this.player.level().getEntity(id);
7272
final var hb = ((HealthbarPreferences) this.player).healthcarePrefs();
7373

7474
if (entity instanceof LivingEntity living &&

0 commit comments

Comments
 (0)