Problems with Knowledge System
pahimar opened this issue ยท 6 comments
Master ticket to track current issues with the knowledge system in the 0.3.* set of releases
I don't know where i can put something like that but suffering from the issue in a modpack, it doesn't degrade the mod in any way. I take it as an early-mod, when resources can be timed-based (like trees) or need in great amount (like stone from cobble without furnacing). It become very situational and it's a pleasant thing.
With EE3 Build 507 in FTB Horizons Daybreaker 1.2.0, we have a similar issue as in #983, #966, #961, #945, and #872 on our server running official 1.7.10 server with forge 1448 using oracle java 8u45. After some investigation, our observations are very similar to that in #961:
- (1a). In daybreaker pack, when a new player research an item, nothing happened to the player's knowledge json file. When that player logged out, the json file is written without any researched item in it.
- (1b). Also in daybreaker pack, when the player's knowledge json file is pre-filled with several researched items (copied from ssp), and then that player logged in and research another item, still nothing happened to the json file. When that player logged out, the json file is written with content identical to the pre-filled copy-from-ssp file. a.k.a, any research done in smp environment is gone.
- (2). When ee3 build 507 is used alone without any other mods on a test server, all research registry things work just fine. The json file is filled with correct item as soon as the player researched it online, and the json file is kept correctly after player logged out.
So to recap, (2) worked just fine, while in (1) all researches done in smp server are not saved.
Bearing these observations in mind, we start tracking the differences between (1) and (2), and managed to narrow it down to method com.pahimar.ee3.knowledge.TransmutationKnowledge.learnTransmutation()
:
public boolean learnTransmutation(ItemStack itemStack) {
ItemStack unitItemStack = itemStack.copy();
unitItemStack.stackSize = 1;
if (!this.knownTransmutations.contains(unitItemStack)) {
hasBeenModified = true;
return this.knownTransmutations.add(unitItemStack);
}
return false;
}
In environment (2), everytime the player learn a new thing, the block inside if
is evaluated, and thus hasBeenModified
of this player knowledge instance is set, which makes savePlayerKnowledgeToDisk()
actually write to disk.
In environment (1), when a player is researching a new item, the condition of if
is always false
, thus nothing is added to the set, and nothing is actaully written to disk. This is pretty weird, as for a new player, there should be nothing in knownTransmutations
, and any stack should render this condition true (??).
This seems like some kind of cross-mod problems or some ee3 problems triggered by other mods... whatever, we still don't know what happened here.
Our temporary circumvention around this issue is to comment out the if
condition above, making the mod always add to set when something is learnt. Kinda dirty hack, but it worked. We got no idea whether this will cause more weird side effects later...
p.s. due to API change (?), git master doesn't work in daybreaker pack, so we work only on build 507...
In the Horizons Daybreaker pack 1.2.0, this problem is fixed by disabling the WiiEMC mod. Not sure what the problem is exactly, but just wanted to let you know that it's probably something with that mod.
I'm also using Daybreaker pack 1.2.0 on my server and I followed the suggestion by Deekun to disable the WiiEMC mod. I'm happy to say that as soon as I disabled this mod the issue with losing known transmutations went away. The fix persisted after server and client restart, so it's not a fluke. The WiiEMC mod was certainly the issue.