2025-01-29 13:20:04 -05:00
|
|
|
package kamkeel.npcs.controllers.data;
|
2025-01-23 16:10:01 -05:00
|
|
|
|
2025-02-18 06:25:09 -05:00
|
|
|
import kamkeel.npcs.controllers.SyncController;
|
2025-01-23 16:10:01 -05:00
|
|
|
import net.minecraft.entity.player.EntityPlayer;
|
2025-02-18 06:25:09 -05:00
|
|
|
import net.minecraft.entity.player.EntityPlayerMP;
|
2025-01-23 16:10:01 -05:00
|
|
|
import net.minecraft.nbt.NBTTagCompound;
|
|
|
|
|
import noppes.npcs.controllers.data.PlayerData;
|
2025-02-19 00:21:40 -05:00
|
|
|
import java.util.ArrayList;
|
|
|
|
|
import java.util.List;
|
2025-01-23 16:10:01 -05:00
|
|
|
|
|
|
|
|
public class CNPCData implements IProfileData {
|
|
|
|
|
|
|
|
|
|
@Override
|
|
|
|
|
public String getTagName() {
|
|
|
|
|
return "CustomNPC+";
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@Override
|
|
|
|
|
public NBTTagCompound getCurrentNBT(EntityPlayer player) {
|
|
|
|
|
PlayerData customNPCData = PlayerData.get(player);
|
|
|
|
|
return customNPCData.getNBT();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@Override
|
|
|
|
|
public void save(EntityPlayer player) {
|
|
|
|
|
PlayerData customNPCData = PlayerData.get(player);
|
|
|
|
|
customNPCData.save();
|
2025-02-18 06:25:09 -05:00
|
|
|
SyncController.syncPlayerData((EntityPlayerMP) player, false);
|
2025-01-23 16:10:01 -05:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@Override
|
|
|
|
|
public void setNBT(EntityPlayer player, NBTTagCompound replace) {
|
|
|
|
|
PlayerData customNPCData = PlayerData.get(player);
|
|
|
|
|
if(replace.hasNoTags()){
|
|
|
|
|
PlayerData newData = new PlayerData();
|
|
|
|
|
newData.player = player;
|
|
|
|
|
customNPCData.setNBT((NBTTagCompound) newData.getNBT().copy());
|
2025-02-19 00:21:40 -05:00
|
|
|
}
|
|
|
|
|
else {
|
2025-01-23 16:10:01 -05:00
|
|
|
customNPCData.setNBT(replace);
|
|
|
|
|
}
|
2025-01-23 17:45:13 -05:00
|
|
|
customNPCData.updateClient = true;
|
2025-01-23 16:10:01 -05:00
|
|
|
}
|
2025-02-18 20:05:55 -05:00
|
|
|
|
|
|
|
|
@Override
|
|
|
|
|
public int getSwitchPriority() {
|
|
|
|
|
return 0;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@Override
|
|
|
|
|
public boolean verifySwitch(EntityPlayer player) {
|
|
|
|
|
return true;
|
|
|
|
|
}
|
2025-02-19 00:21:40 -05:00
|
|
|
|
|
|
|
|
@Override
|
|
|
|
|
public List<String> getInfo(EntityPlayer player, NBTTagCompound compound) {
|
|
|
|
|
PlayerData playerData = new PlayerData();
|
|
|
|
|
playerData.player = player;
|
|
|
|
|
playerData.setNBT(compound);
|
|
|
|
|
|
|
|
|
|
List<String> info = new ArrayList<>();
|
|
|
|
|
|
|
|
|
|
info.add("QuestsFinished" + "###" + playerData.questData.finishedQuests.size());
|
|
|
|
|
info.add("QuestsActive" + "###" + playerData.questData.activeQuests.size());
|
|
|
|
|
info.add("DialogsRead" + "###" + playerData.dialogData.dialogsRead.size());
|
|
|
|
|
|
|
|
|
|
return info;
|
|
|
|
|
}
|
2025-01-23 16:10:01 -05:00
|
|
|
}
|