diff --git a/src/main/java/noppes/npcs/DataInventory.java b/src/main/java/noppes/npcs/DataInventory.java index 57f57563d..601cf1791 100644 --- a/src/main/java/noppes/npcs/DataInventory.java +++ b/src/main/java/noppes/npcs/DataInventory.java @@ -56,8 +56,9 @@ public class DataInventory implements IInventory{ for(int i = 0; i < oldDropChance.entrySet().size(); i++){ dropchance.put(i, Double.valueOf(oldDropChance.get(i))); } + } else { + dropchance = NBTTags.getIntegerDoubleMap(nbttagcompound.getTagList("DoubleDropChance", 10)); } - dropchance = NBTTags.getIntegerDoubleMap(nbttagcompound.getTagList("DoubleDropChance", 10)); lootMode = nbttagcompound.getInteger("LootMode"); } diff --git a/src/main/java/noppes/npcs/quests/QuestKill.java b/src/main/java/noppes/npcs/quests/QuestKill.java index 0f84bd422..ed716b300 100644 --- a/src/main/java/noppes/npcs/quests/QuestKill.java +++ b/src/main/java/noppes/npcs/quests/QuestKill.java @@ -22,15 +22,24 @@ public class QuestKill extends QuestInterface implements IQuestKill { public int targetType = 0; @Override - public void readEntityFromNBT(NBTTagCompound compound) { - targets = NBTTags.getStringIntegerMap(compound.getTagList("QuestDialogs", 10)); - targetType = compound.getInteger("TargetType"); + public void writeEntityToNBT(NBTTagCompound compound) { + compound.setTag("QuestKills", NBTTags.nbtStringIntegerMap(targets)); + //compound.setTag("QuestDialogs", NBTTags.nbtStringIntegerMap(targets)); + compound.setInteger("TargetType",targetType); } @Override - public void writeEntityToNBT(NBTTagCompound compound) { - compound.setTag("QuestDialogs", NBTTags.nbtStringIntegerMap(targets)); - compound.setInteger("TargetType",targetType); + public void readEntityFromNBT(NBTTagCompound compound) { + if(!compound.hasKey("QuestKills")) { + targets.clear(); + HashMap oldTargets = NBTTags.getStringIntegerMap(compound.getTagList("QuestDialogs", 10)); + targets.putAll(oldTargets); + } else { + targets = NBTTags.getStringIntegerMap(compound.getTagList("QuestKills", 10)); + } + + //targets = NBTTags.getStringIntegerMap(compound.getTagList("QuestDialogs", 10)); + targetType = compound.getInteger("TargetType"); } @Override