dylanrenwick / TeslaCoils

Tesla Coil power transfer minecraft mod
MIT License
4 stars 2 forks source link

Fixed TileEntityTeslaCoil Not Loading Its Saved Data #16

Closed ShetiPhian closed 7 years ago

ShetiPhian commented 7 years ago

The saved data wasn't loading because TileEntities require a nullary constructor. Without it the TileEntity couldn't be created at the time of load, skipping readFromNBT.

For the transfer rate to be preserved it needed to be saved to the nbt, but I didn't do that directly, instead I saved the coil tier. This was done so the changing of a tiers transfer rate updates any coils already in world to the new speed. As an added perk it enables you to add a way to do an in place upgrade to the next tier.

Line 297 was changed to use getTransferRate() to unify where that data comes from. This way if you decided to add an overclocker/transfer boost you only need to change this one spot for it to be applied.

ShetiPhian commented 7 years ago

After this one I can submit the last ones all at once because they don't touch the same classes.

dylanrenwick commented 7 years ago

Awesome, thanks again for the work and the explanation. By the way, you know you can submit a single PR with multiple commits right? Might be easier than submitting multiple PRs to edit a single file.

ShetiPhian commented 7 years ago

Just got in that habit after doing PR's for Forge (if you don't keep things separate nothing gets pulled)

Due to the nature of then last pull requests I'll keep them separate as you may not want all three. One is a crash fix, one is an assumption based adjustment, and the final is a suggested addition.

I'm a tinkerer by nature and started modding by submitting tweaks for other peoples mods. If I don't make these my last commits I'll get carried away, neglect my own mods, and you'll get sick of seeing me :)