zhuowei / MCPELauncher

Source code for BlockLauncher, a launcher that patches Minecraft for Android
Apache License 2.0
683 stars 189 forks source link

setSignText Not Permanent? #224

Open zedman2000 opened 9 years ago

zedman2000 commented 9 years ago

Hello, I'm not sure this is intentional or not, but I wanted to set some text, but have it be permanent. As it is, it seems that any text that is set by script, is removed as soon as I exit the game...or it is not properly saved into the tileEntity Block that signs get. That is, the script would say, set some coordinates of a different block on line 2. Then, when you tap that sign, my script is supposed to read those coordinates out of line 2, which does all seem to work. So, at least in some temporary way, the data is being placed into that "sign". However, every time you quit the game, the data that was "in" the signs disappears. The original text (if I had any) is placed back into the sign.

Is there some kind of trick to this? I have tried to remove and create the item at the given coordinates, but do not see any way to write into the separate database that includes the text from the 4 lines.

zedman2000 commented 9 years ago

I found that if I drop a new sign touching the sign that the SCRIPT posted to, exit, then enter the game the sign will stick. Does this help understand what is going on?

zedman2000 commented 9 years ago

Still an issue in 0.11.1, using BL Pro 1.9.10 Although, it now seems to be less random. That is maybe 50% of the time I do not need to add the additional sign. With previous BL (1.8.6?) and MC 0.9.5, It would be much less that I did not need to add the additional sign.

zedman2000 commented 9 years ago

+RandomAltThing,thanks for the comment, I was thinking that I might need to do that at some point, however a SaveData is for parsing off data into a BL database. AFAIK, it does not travel WITH the MCPE database (under games on the SDCARD). You can use that for saving data that cannot be embedded into MCPE (say you created a new MOB and he needs to keep some sort of statitics). So, if I used that with signs, I would have to have a new function that went out and re-set all the signs with data each time the game was loaded.

https://github.com/Connor4898/ModPE-Docs/wiki/ModPE Search "saveData"

For now, the work around seems to work. I think that the BL code just needs to trigger the same "block update" command that adding a new sign does. If you read the work around, that does work 100% of the time, it is just annoying to add a sign with text, then have to place a new sign, quit to title, then come back into the game. If I am adding 4-5 signs, I have to quit + re-enter 4-5 times. Tedious, but at least it works!

Thanks again for the comment! At least now I know that people ARE reading these and the project is not abandoned!!

zedman2000 commented 9 years ago

@RandomAltThing that seems to work much better. I was wondering why the + did not do anything! Thanks for the information!

zedman2000 commented 8 years ago

@zhuowei tried this in 0.14 with the beta release of BL for 0.14 (released a few days ago), still an issue. The workaround still works, so I do not think this is a CRITICAL item, but if you are looking for things to fix... The work around seems to "force" the Minecraft Engine to perform cleanup or a write to the database. Basically, you place a sign near the one you just changed with code, then exit the world, enter the world and you can remove the "extra" sign.