Reika_Mods_Issues
Reika_Mods_Issues copied to clipboard
[Chromaticraft] Enrichment vines, and other non-ticking TEs, don't properly initialize TE cache data
So DragonAPI TileEntities keep an adjacent TileEntity cache, presumably for speed purposes. This cache is normally filled on first tick, in this method: https://github.com/ReikaKalseki/DragonAPI/blob/b988eda2ddfea6a9912d77d0940ba94500089a3e/Base/TileEntityBase.java#L681
if (this.getTicksExisted() == 0) {
for (int i = 0; i < 6; i++)
this.updateCache(dirs[i]);
This works fine for ticking TileEntities, but non-ticking TEs never tick, so the adjacency cache isn't automatically filled on TE creation.
An in-game example of this effect is with the Coalescence Orchid; it produces cobblestone and a few other recipes, and the output per operation is determined by the length of the enrichment vine it's hanging on, starting at 1 with no vines, and doubling with each vine to 2 -> 4 -> 8 -> 16 -> 32 -> 64 at 6 vines. However, if you simply place 6 enrichment vines and then the orchid, you'll probably only get 2 items per operation. This is because the (ticking) orchid will properly fill its adjacency cache with the closest enrichment vine on first tick; then to get to the next one, it "asks" that first enrichment vine what it is connected to, and because that vine probably didn't fill its cache, it'll think it's adjacent to nothing, ergo the connectivity check stops propagating the other 5 vines are never "read".
An in-game workaround is to apply a redstone pulse to each enrichment vine after placing it, which seems to force the TE to update its cache. Sometimes a block update will do it, but not reliably.
Apparently the proper solution for this is to schedule a random tick on the non-ticking TE block when it's placed, and handle TE cache initialization when the random tick fires on the next game tick, since TE cache initialization apparently can't be done on the same tick as TE creation.