Profile + Effect Loading

This commit is contained in:
Kam committed 2025-02-19 00:21:40 -05:00
1 parent e8f657f7e6
commit 5a38f9057f
9 files changed
+354 -139

No files matched your search

@@ -576,6 +576,40 @@ public class ProfileController {
}
}
public static List<String> getProfileInfo(EntityPlayer player, int slotId) {
List<String> infoList = new ArrayList<>();
Profile profile = getProfile(player);
if (profile == null)
return infoList;
List<IProfileData> dataList = new ArrayList<>(profileTypes.values());
dataList.sort(Comparator.comparingInt(IProfileData::getSwitchPriority));
if (slotId == profile.currentID) {
// Use current data (not stored slot data) for active slot.
for (IProfileData pd : dataList) {
NBTTagCompound currentNBT = pd.getCurrentNBT(player);
List<String> subInfo = pd.getInfo(player, currentNBT);
infoList.addAll(subInfo);
}
} else {
// Use stored data from the specified slot.
if (!profile.slots.containsKey(slotId))
return infoList;
NBTTagCompound slotCompound = profile.slots.get(slotId).getCompound();
for (IProfileData pd : dataList) {
if (slotCompound.hasKey(pd.getTagName())) {
NBTTagCompound sub = slotCompound.getCompoundTag(pd.getTagName());
List<String> subInfo = pd.getInfo(player, sub);
infoList.addAll(subInfo);
}
}
}
return infoList;
}
public static EntityPlayerMP getPlayer(String username){
return MinecraftServer.getServer().getConfigurationManager().func_152612_a(username);
}