New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
High Voltage Pneumatic Transducer resets tier upon server restart #5
Comments
Yeah, honestly, it seems like a very easy fix. At least to me it does.... |
I have been looking some more at the code and I believe the problem is that initPowerHandler() is being run from the constructor of the TilePTransducer class. The PowerHandler gets set up before the readFromNBT() method has had any time to run. This means tier == 0 while the initPowerHandler() method is running, but afterwards the readFromNBT() method runs and it updates the tier varaible to the correct setting. This explains the textures being correct while the power handler gets set up with the "tier 0" defaults. Without knowing how the Buildcraft PowerHandler works I would assume that this could be fixed by calling initPowerHandler(); at the end of readFromNBT(). |
It could work, however, readFromNBT is a type of, it reads and writes. Not does this and do that. It doesn't really work like that. I could be wrong about that. I am just a beginner at modding. :) I think however, that if you place initPowerHandler above readFromNBT, it should call initPowerHandler first before readFromNBT. Just my thoughts. |
I am also very new to modding in Minecraft, so I have no idea what the life cycle for block like this is like. If I understand correctly, readFromNBT() is called by Minecraft to read in any binary data stored in the map file about whats going on in the block (i might have misunderstood the whole thing though). So if the class saves a boolean on creation and reconfigures the Power Handler the first time the NBT is read, then it might fix the problem. I think I have to download the code and add it to my Eclipse now and see if I can get it to behave :P |
Okay. Seems alright. I have it in my code for a buildcraft pipe. But, I'm not even sure if it even gets called or anything... |
Thanks for reporting this issue. It's caused by initializing power handler in constructor and it gets default values for tier 0. Moving initialization to validate, which is invoked for create tile entity should fix it. I'm finishing next release with this fix, some improvements and additions. I'll probably publish it on monday. |
Version installed: Transducers-1.0.1.398-IC2Experimental-MC1.6.4.zip
I recently installed your mod on a server Minecraft 1.6.2 with IC2 2.0.293 and Buildcraft-A 4.1.2 amongst other mods. I also have EnderIO 0.4.6 installed which includes a MJ reader that tells you how many MJ a block is requesting from the MJ network.
When I place a High Voltage Pneumatic Transducer, hook it up to a gold cable (for EU) and an EnderIO Energy Conduit (for MJ), it gets created correctly and starts requesting 205 MJ/t.
However, after a server restart the block seems to have the limits of a tier 0 (based on the source code at https://github.com/adamros/Transducers/blob/master/adamros/mods/transducers/tileentity/TilePTransducer.java) since it only requests 13 MJ/t (I believe the MJ Reader rounds the numbers) after restart. When I break the block after server restart it still drops a High Voltage version, so it seems the tier information is saved properly but not used correctly on load.
Based on this I am assuming there might be an issue with loading of the tier information of the transducer blocks when the chunk is loaded. I hope you can recreate this. If you need more information, please let me know.
The text was updated successfully, but these errors were encountered: