fix: Fixed all synchronized WizardData stored variables on dedicated servers. This issue was causing e.g. the Ancient Compass to not display its targets on servers. Fixes #857

This commit is contained in:
WinDanesz
2024-03-28 00:46:25 +01:00
parent 2728012f33
commit df531d3724
4 changed files with 28 additions and 7 deletions
@@ -199,9 +199,14 @@ public class WizardData implements INBTSerializable<NBTTagCompound> {
}
/** Returns a set containing the registered {@link IStoredVariable} objects for which {@link IVariable#isSynced()}
* returns true. Used internally for packet reading. */
public static Set<IVariable> getSyncedVariables(){
return storedVariables.stream().filter(IVariable::isSynced).collect(Collectors.toSet());
* returns true, ordered by their keys obtained from {@link IVariable#getKey()}. Used internally for packets. */
public static Set<IVariable> getSyncedVariablesOrderedByKey(){
Comparator<IVariable> keyComparator = Comparator.comparing(IVariable::getKey);
return storedVariables.stream()
.filter(IVariable::isSynced)
.sorted(keyComparator)
.collect(Collectors.toCollection(LinkedHashSet::new));
}
/**