mirror of
https://github.com/KAMKEEL/CustomNPC-Plus.git
synced 2026-11-18 14:59:05 +00:00
Profile + Effect Loading
This commit is contained in:
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);
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user