Electrical-Age / ElectricalAge

Electrical Age (ELN) is a Minecraft Mod offering the ability to perform large-scale in-game electrical simulations.
https://electrical-age.net/
Other
213 stars 97 forks source link

Disapearing blocks #204

Closed Mastercrafter898 closed 9 years ago

Mastercrafter898 commented 9 years ago

I've had a problem that sometimes when I get back on my world all the blocks(but not items) are gone. This issue may be caused by the other mods in the pack but I don't know. The pack by the way is on the AT launcher and is called Buildpak (the code is "buildpak" if you want to try it yourself.) Thanks

perkinslr commented 9 years ago

I've encountered this too, when the server doesn't shut down cleanly. I suspect it's related to the node saving system which is supposed to prevent world corruption, but seems to do so by not saving on crashes. I've poked at the code, but not been able to spot where it is deciding to not save.

egeis commented 9 years ago

After every server crash all of this mods blocks disappear. Except for the some ghost blocks which are already invisible except with WAILA. The buttom block of a windmill was gone, nothing from it was showing up except the upper portions still gave information, nothing was being rendered though.

perkinslr commented 9 years ago

Lamps and teleporters do the same thing. I have a patched version that doesn't remove possibly invalid tiles. The issue is if the world doesn't save the node list, then when the tile entity tries to look up the node in the eln network, it's null, so it removes the tile entity. I patched my install to reinitialize the node automatically, and the problem has gone away.

egeis commented 9 years ago

Do you have a fork of the changes?

perkinslr commented 9 years ago

Not yet, internet here isn't reliable enough to upload it, but I should be able to tonight. Note that the name localization is broken when I built it, eln uses the deprecated name system, instead of .lang files. I fixed it on my server using minetweaker's i18n system.

egeis commented 9 years ago

I have already used minetweaker to rename items, so it wont be a problem correcting names.

perkinslr commented 9 years ago

Okay, it's up here. It's a fork from a slightly older revision, about 5 weeks ago (commit e02c87cfd0cd1b732062a5b127141c3fa0595513), since I didn't fork the repo then, I don't have a clean diff, if you really want one I can probably figure out how to provide one. Should just build via ./gradlew build though. Oh, and there are a couple other changes. I patched it so that eln to other converters work in reverse, which lets eln handle long distance power transmission without causing lag, and still have other forms of power generation on both ends, and redid the different weights of cable to be similar to standard US house wiring sizes at 20, 30, 40, and 50 amp in terms of resistance per meter.

egeis commented 9 years ago

I could not get it to build, neither could the pack creator im working with until several errors were corrected involving the old language system.

After a crash all of the blocks rotate 90 degrees - For example a cable on the ground rotated would attached itself to an air blocks side. Also in SP the console seems to be spammed constantly from Utils.fatal().

egeis commented 9 years ago

http://imgur.com/rcxIzFQ Correction some rotate 180, other 90.

perkinslr commented 9 years ago

Try now, last time I didn't sync the resources or other directories, this time it should be a perfect match. I figured out how to roll my fork back to the revision I'd checked out, and committed a diff off of it. Seems that they are working on moving away from the old language system, so I probably need to see about making a clean patch and updating. I probably won't have time to do that for a couple days, but it should work now. If you like, I can also provide a binary package till I have time to update my fork with the latest advances, and sorry for the bad version, I'm still getting the hang of git and github.

perkinslr commented 9 years ago

The binary build is available here and the source for it (complete with build artifacts and what not, should be able to run ./gradlew build) is here.

egeis commented 9 years ago

neither of those links work yet, ill try again in a hour incase you are still uploading.

perkinslr commented 9 years ago

Try now, my fileserver was in the process of rebooting.

egeis commented 9 years ago

I got it to work, had to rea-dd the dependencies. Was missing the api's which caused the build to fail. I managed to crash seveal times and the EA appeared to stay. Your language changes however are causing a lot of console spam from errors accessing language related classes. Brings the FPS of the game to 1. Thanks for the help.

perkinslr commented 9 years ago

Oh, yeah, I'm running bleeding edge everything, so I removed the APIs and added the latest jars to the java class path for building. If you want to post a sample of the console spam, I can poke at it and see if I can quiet it down some.

egeis commented 9 years ago

http://pastebin.com/FQaizwfb

all the errors point back to Utils.fatal()

perkinslr commented 9 years ago

Actually, Utils.fatal is just a helper function to make it print a stack trace. The problem is in TransparentNodeBlock, where it's trying to get the node on the client side. I'm not sure why it's calling that for you, but not for my install, but the fix is pretty simple, just check to make sure that it's server side before pulling the node. I'm updating the source snapshot now, I'll try again in a little while to get the github fork to work too.

egeis commented 9 years ago

i have been testing primarily is SP, I only setup a forge server yesterday for my pack.

perkinslr commented 9 years ago

Ah, that probably explains the difference, I only bothered to test with a dedicated server. It's also possible that it's related to the significant other modifications I've made to forge, or one of the core mods.

egeis commented 9 years ago

all i have installed is Electrical Age and Terrafirmacraft.

perkinslr commented 9 years ago

Okay, the source and binary files are updated to (hopefully) fix that bug, and I fixed a bug in Coordonate.java where trueDistanceTo would return NAN because java's sqrt function is dumb (uses Math.hypot now instead).

Dolu1990 commented 9 years ago

I think i have a good solution about this issue. Because it realy seem that minecraft make a bad file management. So the solution is juste to manage the saving file by our self. I'm working on. I keep you informed if it's realy the case XD

perkinslr commented 9 years ago

That's a fairly common approach, opencomputers and computercraft do that. Just make sure you don't end up with an inconsistent state because of it, lots of SMP servers run with a non-standard autosave interval since saving is a large cause of tps loss (my server autosaves every 30m). Eln saving to a different file would be good, but make sure it does it as part of the world save process, since I imagine saving the network node data and not saving the tile entites would be bad.

Dolu1990 commented 9 years ago

I think it's now ok. I don't have submit changes. Could someone test it, because i never success fully reproduct the bug? I send you the release by skype / mail.

Dolu1990 commented 9 years ago

Good news, i get it. So, Minecraft, in some bad way, call @SubscribeEvent public void onWorldSave(Save e) {

then

@SubscribeEvent
public void onWorldUnload(Unload e) {

then one time again

@SubscribeEvent
public void onWorldSave(Save e) {

But the problem is that i can't save a unloaded world <3 The worst at all is there is no console print when it do the seconde and sneaky save !

So i have fix it and will release the fix today. Thanks for issues

perkinslr commented 9 years ago

Wow, that's unexpected, but does explain a bunch of the odd behaviour. The second onWorldSave saves the player profiles, and fires even when world saving is disabled, there must be some flag in the Save object to determine if it is a full save or not.

Dolu1990 commented 9 years ago

Yes, The only workaround is to have our own file managment for saving, and don't save a unloaded world XD

perkinslr commented 9 years ago

Hm, if you catch Unload events, it should be possible to ignore the second Save event. Basically on a Load event, set a flag to true, then on unload set it to false. If save is called while the flag is false, ignore the save call.