Skip to content

Commit

Permalink
fix: fix to last reward table commit
Browse files Browse the repository at this point in the history
  • Loading branch information
desht committed Jan 9, 2025
1 parent 3f03c67 commit 920eaae
Showing 1 changed file with 9 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -226,9 +226,15 @@ public void readData(CompoundTag nbt, HolderLookup.Provider provider) {
for (int i = 0; i < list.size(); i++) {
boolean newReward = false;
CompoundTag rewardTag = list.getCompound(i);
long rewardId = file.getID(rewardTag.get("id"));
if (rewardId == 0L) {
// should only occur on server when the client has sent a reward table with new reward(s)
if (!rewardTag.contains("id") && file.isServerSide()) {
// can happen on server when reading in an older quest book where reward table rewards didn't have IDs
rewardTag.putString("id", QuestObjectBase.getCodeString(file.newID()));
}
long rewardId = QuestObjectBase.parseCodeString(rewardTag.getString("id"));
if (rewardId == 0L && file.isServerSide()) {
// Can happen on server when the client has sent a reward table with new reward(s)
// Note: can also happen on client when copying rewards that haven't been sent to server yet (reward editor screen)
// - in that case, an id of 0 is fine, so don't do anything here
rewardId = file.newID();
rewardTag.putString("id", QuestObjectBase.getCodeString(rewardId));
newReward = refreshIds = true;
Expand Down

0 comments on commit 920eaae

Please sign in to comment.