77import dev .ftb .mods .ftbchunks .client .map .MapMode ;
88import dev .ftb .mods .ftbchunks .client .minimap .MinimapComponentConfig ;
99import dev .ftb .mods .ftbchunks .client .minimap .components .*;
10- import dev .ftb .mods .ftbchunks .util .HeightUtils ;
1110import dev .ftb .mods .ftblibrary .config .manager .ConfigManager ;
1211import dev .ftb .mods .ftblibrary .snbt .SNBTCompoundTag ;
1312import dev .ftb .mods .ftblibrary .snbt .config .*;
@@ -113,10 +112,10 @@ static void saveConfig() {
113112 ConfigManager .getInstance ().save (KEY );
114113 }
115114
116- class ChunkPosCustomYSetValue extends BaseValue <Set <HeightUtils . ChunkPosWithMinY >> {
115+ class ChunkPosCustomYSetValue extends BaseValue <Set <ChunkPosWithMinY >> {
117116 private final HashMap <Long , Integer > lookup = new HashMap <>();
118117
119- protected ChunkPosCustomYSetValue (@ Nullable SNBTConfig c , String n , Set <HeightUtils . ChunkPosWithMinY > def ) {
118+ protected ChunkPosCustomYSetValue (@ Nullable SNBTConfig c , String n , Set <ChunkPosWithMinY > def ) {
120119 super (c , n , def );
121120 super .set (new HashSet <>());
122121 }
@@ -125,7 +124,7 @@ protected ChunkPosCustomYSetValue(@Nullable SNBTConfig c, String n, Set<HeightUt
125124 public void write (SNBTCompoundTag tag ) {
126125 var listTag = new ListTag ();
127126
128- for (HeightUtils . ChunkPosWithMinY pos : get ()) {
127+ for (ChunkPosWithMinY pos : get ()) {
129128 var posTag = new SNBTCompoundTag ();
130129 posTag .putInt ("x" , pos .chunkX ());
131130 posTag .putInt ("z" , pos .chunkZ ());
@@ -139,26 +138,32 @@ public void write(SNBTCompoundTag tag) {
139138 @ Override
140139 public void read (SNBTCompoundTag tag ) {
141140 var list = tag .getList (key , SNBTCompoundTag .class );
142- Set <HeightUtils . ChunkPosWithMinY > set = new HashSet <>();
141+ Set <ChunkPosWithMinY > set = new HashSet <>();
143142
144143 for (SNBTCompoundTag posTag : list ) {
145144 int x = posTag .getInt ("x" );
146145 int z = posTag .getInt ("z" );
147146 int minY = posTag .getInt ("min_y" );
148- set .add (new HeightUtils . ChunkPosWithMinY (x , z , minY ));
147+ set .add (new ChunkPosWithMinY (x , z , minY ));
149148 }
150149
151150 set (set );
151+ }
152+
153+ @ Override
154+ public void set (Set <ChunkPosWithMinY > value ) {
155+ super .set (value );
152156
153- // Rebuild lookup
154157 lookup .clear ();
155- for (HeightUtils . ChunkPosWithMinY pos : set ) {
158+ for (ChunkPosWithMinY pos : value ) {
156159 lookup .put (ChunkPos .asLong (pos .chunkX (), pos .chunkZ ()), pos .minY ());
157160 }
158161 }
159162
160- public HashMap <Long , Integer > lookup () {
161- return lookup ;
163+ public Map <Long , Integer > lookup () {
164+ return Collections . unmodifiableMap ( lookup ) ;
162165 }
163166 }
167+
168+ record ChunkPosWithMinY (int chunkX , int chunkZ , int minY ) {}
164169}
0 commit comments