File tree Expand file tree Collapse file tree 2 files changed +17
-2
lines changed
src/main/java/net/torocraft/torohealth Expand file tree Collapse file tree 2 files changed +17
-2
lines changed Original file line number Diff line number Diff line change @@ -134,8 +134,7 @@ public enum HealthChangeType {
134134 }
135135
136136
137- @ Override
138- public void validatePostLoad () {
137+ public void postLoad () {
139138 // Recalculate dependent field
140139 particleOptions .particleDistanceSquared = particleOptions .particleDistance * particleOptions .particleDistance ;
141140 }
Original file line number Diff line number Diff line change 22
33import java .util .Random ;
44
5+ import net .minecraft .util .ActionResult ;
56import net .fabricmc .api .ModInitializer ;
67import net .torocraft .torohealth .display .Hud ;
78import net .torocraft .torohealth .util .RayTrace ;
9+ import me .shedaniel .autoconfig .AutoConfig ;
10+ import me .shedaniel .autoconfig .ConfigHolder ;
811
912public class ToroHealth implements ModInitializer {
1013
@@ -21,6 +24,19 @@ public class ToroHealth implements ModInitializer {
2124 @ Override
2225 public void onInitialize () {
2326 ModConfig .init ();
27+
28+ ConfigHolder <ModConfig > holder =
29+ AutoConfig .getConfigHolder (ModConfig .class );
30+
31+ holder .registerSaveListener ((h , c ) -> {
32+ c .postLoad ();
33+ return ActionResult .SUCCESS ;
34+ });
35+
36+ holder .registerLoadListener ((h , c ) -> {
37+ c .postLoad ();
38+ return ActionResult .SUCCESS ;
39+ });
2440 CONFIG = ModConfig .INSTANCE ;
2541 }
2642}
You can’t perform that action at this time.
0 commit comments