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;
|
|
|
|
|
|
|
|
|
|
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());
|
|
|
|
|
}
|
|
|
|
|
else {
|
|
|
|
|
customNPCData.setNBT(replace);
|
|
|
|
|
}
|
2025-01-23 17:45:13 -05:00
|
|
|
customNPCData.updateClient = true;
|
2025-01-23 16:10:01 -05:00
|
|
|
}
|
|
|
|
|
}
|