mirror of
https://github.com/GTNewHorizons/Postea.git
synced 2026-11-20 04:09:43 +00:00
Saving world data
This commit is contained in:
1 parent
f693ca75b9
commit
06350f82ac
4 files changed
+151
-4
No files matched your search
@@ -1,7 +1,13 @@
|
||||
package com.colen.postea.Utility;
|
||||
|
||||
import cpw.mods.fml.common.Loader;
|
||||
import cpw.mods.fml.common.ModContainer;
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Collections;
|
||||
import java.util.Objects;
|
||||
|
||||
public abstract class PosteaUtilities {
|
||||
|
||||
@SuppressWarnings("unused")
|
||||
@@ -21,4 +27,29 @@ public abstract class PosteaUtilities {
|
||||
return tagCompound;
|
||||
}
|
||||
|
||||
|
||||
public static int getModListHash() {
|
||||
|
||||
// We iterate over every mod, get its version and put it into a giant list.
|
||||
// This is done so we can see if our mods have actually changed, if so, we
|
||||
// will recheck every chunk for Postea adjustments.
|
||||
|
||||
ArrayList<String> modList = new ArrayList<>();
|
||||
|
||||
for (ModContainer mod : Loader.instance().getActiveModList()) {
|
||||
modList.add(mod.getModId() + ":" + mod.getVersion());
|
||||
}
|
||||
|
||||
// Sort this first.
|
||||
Collections.sort(modList);
|
||||
|
||||
// Step 2: Append all elements into one string
|
||||
StringBuilder combinedModStringSorted = new StringBuilder();
|
||||
for (String element : modList) {
|
||||
combinedModStringSorted.append(element);
|
||||
}
|
||||
|
||||
return Objects.hash(combinedModStringSorted);
|
||||
}
|
||||
|
||||
}
|
||||
Reference in new issue
Block a user