| 
		
	
	
	
		
	Posts: 1,450 
	Threads: 53 
	Joined: Feb 2011
	
 Thanks: 15Given 130 thank(s) in 99 post(s)
 
 
	
		
		
		11-12-2012, 08:36 AM 
(This post was last modified: 11-12-2012, 08:48 AM by FakeTruth.)
		
	 
		int Sections = a_NBT.FindChildByName(Level, "Sections"); 
returns -1 in cWSSAnvil::LoadChunkFromNBT that's what's causing the chunks to be regenerated. I have no idea why it returns -1 though...
 
 
I used NBTExplorer  to check the anvil files created by Android, and it seems there are no "Sections" in there :/ wtf
	 
	
	
	
		
	Posts: 6,482 
	Threads: 176 
	Joined: Jan 2012
	
 Thanks: 131Given 1085 thank(s) in 857 post(s)
 
 
	
	
		No idea about that. Can the Anvil files be parsed normally at all, or are they mis-formed?If they parse, why arent Sections there? Aren't they being written? Maybe some endianness problem?
 
	
	
	
		
	Posts: 1,450 
	Threads: 53 
	Joined: Feb 2011
	
 Thanks: 15Given 130 thank(s) in 99 post(s)
 
 
	
	
		Curious, I added a buttload of extra values to be added to each chunk. 	a_Writer.AddString("TestString", "o hai I'm string");
	a_Writer.AddDouble("TestDouble", 1.23);
	a_Writer.AddFloat("TestFloat", 1.23f);
	a_Writer.AddInt("TestInt", 2);
	a_Writer.AddLong("TestLong", 1234);
	a_Writer.AddShort("TestShort", 1234);
	a_Writer.AddByte("TestByte", 34);
When I add this piece of code BEFORE the Sections list it is added it shows up in the file, but if I add it AFTERwards it is nowhere to be found. It seems the Sections list breaks something...
	 
	
	
	
		
	Posts: 6,482 
	Threads: 176 
	Joined: Jan 2012
	
 Thanks: 131Given 1085 thank(s) in 857 post(s)
 
 
	
	
		Try adding an IntArray before the Section. I'm suspecting a breakage there.
	 
	
	
	
		
	Posts: 1,450 
	Threads: 53 
	Joined: Feb 2011
	
 Thanks: 15Given 130 thank(s) in 99 post(s)
 
 
	
		
		
		11-17-2012, 02:20 AM 
(This post was last modified: 11-17-2012, 02:21 AM by FakeTruth.)
		
	 
		Actually it seems to screw up after the Biome data 	a_Writer.BeginCompound("Level");
	a_Writer.AddInt("xPos", a_Chunk.m_ChunkX);
	a_Writer.AddInt("zPos", a_Chunk.m_ChunkZ);
	cNBTChunkSerializer Serializer(a_Writer);
	if (!m_World->GetChunkData(a_Chunk.m_ChunkX, a_Chunk.m_ChunkY, a_Chunk.m_ChunkZ, Serializer))
	{
		return false;
	}
	Serializer.Finish();  // Close NBT tags
	a_Writer.AddString("TestString1", "o hai I'm string");
	a_Writer.AddDouble("TestDouble1", 1.23);
	a_Writer.AddFloat("TestFloat1", 1.23f);
	a_Writer.AddInt("TestInt1", 2);
	a_Writer.AddLong("TestLong1", 1234);
	a_Writer.AddShort("TestShort1", 1234);
	a_Writer.AddByte("TestByte1", 34);
	// Save biomes, both MCS (IntArray) and MC-vanilla (ByteArray):
	if (Serializer.m_BiomesAreValid)
	{
		a_Writer.AddByteArray("Biomes",    (const char *)(Serializer.m_VanillaBiomes), ARRAYCOUNT(Serializer.m_VanillaBiomes));
		a_Writer.AddIntArray ("MCSBiomes", (const int *)(Serializer.m_Biomes),         ARRAYCOUNT(Serializer.m_Biomes));
	}
	a_Writer.AddString("TestString2", "o hai I'm string");
	a_Writer.AddDouble("TestDouble2", 1.23);
	a_Writer.AddFloat("TestFloat2", 1.23f);
	a_Writer.AddInt("TestInt2", 2);
	a_Writer.AddLong("TestLong2", 1234);
	a_Writer.AddShort("TestShort2", 1234);
	a_Writer.AddByte("TestByte2", 34);
	a_Writer.AddIntArray("TestIntArray", (const int *)Serializer.m_Biomes, 2);
	// Save blockdata:
	a_Writer.BeginList("Sections", TAG_Compound);
	int SliceSizeBlock  = cChunkDef::Width * cChunkDef::Width * 16;
	int SliceSizeNibble = SliceSizeBlock / 2;
	const char * BlockTypes    = (const char *)(Serializer.m_BlockTypes);
	const char * BlockMetas    = (const char *)(Serializer.m_BlockMetas);
	const char * BlockLight    = (const char *)(Serializer.m_BlockLight);
	const char * BlockSkyLight = (const char *)(Serializer.m_BlockSkyLight);
	a_Writer.AddIntArray("TestIntArray2", (const int *)Serializer.m_Biomes, 2);
	for (int Y = 0; Y < 16; Y++)
	{
		a_Writer.BeginCompound("");
		a_Writer.AddByteArray("Blocks",     BlockTypes    + Y * SliceSizeBlock,  SliceSizeBlock);
		a_Writer.AddByteArray("Data",       BlockMetas    + Y * SliceSizeNibble, SliceSizeNibble);
		a_Writer.AddByteArray("SkyLight",   BlockSkyLight + Y * SliceSizeNibble, SliceSizeNibble);
		a_Writer.AddByteArray("BlockLight", BlockLight    + Y * SliceSizeNibble, SliceSizeNibble);
		a_Writer.AddByte("Y", (unsigned char)Y);
		a_Writer.EndCompound();
	}
	a_Writer.EndList();  // "Sections"
	a_Writer.AddIntArray("TestIntArray3", (const int *)Serializer.m_Biomes, 2);
	a_Writer.AddString("TestString3", "o hai I'm string");
	a_Writer.AddDouble("TestDouble3", 1.23);
	a_Writer.AddFloat("TestFloat3", 1.23f);
	a_Writer.AddInt("TestInt3", 2);
	a_Writer.AddLong("TestLong3", 1234);
	a_Writer.AddShort("TestShort3", 1234);
	a_Writer.AddByte("TestByte3", 34);
	// Store the information that the lighting is valid. 
	// For compatibility reason, the default is "invalid" (missing) - this means older data is re-lighted upon loading.
	if (Serializer.IsLightValid())
	{
		a_Writer.AddByte("MCSIsLightValid", 1);
	}
	
	a_Writer.EndCompound();  // "Level"
Gives this:
 ![[Image: ruxiyc.png]](http://i50.tinypic.com/ruxiyc.png)  
	
	
	
		
	Posts: 6,482 
	Threads: 176 
	Joined: Jan 2012
	
 Thanks: 131Given 1085 thank(s) in 857 post(s)
 
 
	
		
		
		11-17-2012, 02:49 AM 
(This post was last modified: 11-17-2012, 02:52 AM by xoft.)
		
	 
		The last thing that is written seems to be an IntArray - as I predicted   
Wasn't cFastNBTWriter::AddIntArray() the function that was failing? It might still be failing, but now in a different sense   
 
Ah, of course!
 Code: #if defined(ANDROID_NDK)// THIS NEEDS TO GO AWAY: m_Result.append(a_NumElements * 4, (char)0);
 for (size_t i = 0; i < a_NumElements; i++)
 {
 int Element = htonl(a_Value[i]);
 m_Result.append((const char *)&Element, 4);
 }
 #else
 int * Elements = (int *)(m_Result.data() + m_Result.size());
 m_Result.append(a_NumElements * 4, (char)0);
 for (size_t i = 0; i < a_NumElements; i++)
 {
 Elements[i] = htonl(a_Value[i]);
 }
 #endif
The non-android code works by appending zero bytes first, then overwriting them with real values; Android cannot overwrite, so it's appending the values one by one - therefore it must not have the zero-appending code
	 
	
	
	
		
	Posts: 1,450 
	Threads: 53 
	Joined: Feb 2011
	
 Thanks: 15Given 130 thank(s) in 99 post(s)
 
 
	
	
		Oh wow, I'm an idiot, thanks
	 
	
	
	
		
	Posts: 1,450 
	Threads: 53 
	Joined: Feb 2011
	
 Thanks: 15Given 130 thank(s) in 99 post(s)
 
 
	
		
		
		11-17-2012, 08:26 AM 
(This post was last modified: 11-17-2012, 08:27 AM by FakeTruth.)
		
	 
		Alright, here's the latest version of MCServer for Android http://code.google.com/p/mc-server/downl...nloadCount 
	
	
	
		
	Posts: 4,637 
	Threads: 115 
	Joined: Dec 2011
	
 Thanks: 697Given 518 thank(s) in 441 post(s)
 
 
	
	
		what is the fastest world.ini for android? i now have the default for android and i get 0.59 ch/s 
its now like this:
 Code: [Generator]BiomeGen=
 DistortedVoronoiCellSize=96
 DistortedVoronoiBiomes=
 BiomeGenCacheSize=64
 HeightGen=
 HeightGenCacheSize=64
 CompositionGen=
 BiomalSeaLevel=62
 Structures=Trees,MarbleCaves,OreNests
 Finishers=SprinkleFoliage,Ice,Snow,Lilypads,BottomLava,DeadBushes,PreSimulator
 BottomLavaLevel=10
and maybe could you add a function in the web configurator that allows you to change someone's rank. its very difficoult now to make yourself admin on android. 
but i think MC-Server is now good enough to be uploaded to the play store. (if you want becouse it cost money   )
	 
	
	
	
		
	Posts: 1,450 
	Threads: 53 
	Joined: Feb 2011
	
 Thanks: 15Given 130 thank(s) in 99 post(s)
 
 
	
	
		 (11-17-2012, 08:51 AM)STR_Warrior Wrote:  what is the fastest world.ini for android? i now have the default for android and i get 0.59 ch/sits now like this:
 
 Code: [Generator]BiomeGen=
 DistortedVoronoiCellSize=96
 DistortedVoronoiBiomes=
 BiomeGenCacheSize=64
 HeightGen=
 HeightGenCacheSize=64
 CompositionGen=
 BiomalSeaLevel=62
 Structures=Trees,MarbleCaves,OreNests
 Finishers=SprinkleFoliage,Ice,Snow,Lilypads,BottomLava,DeadBushes,PreSimulator
 BottomLavaLevel=10
 Oh right, remove MarbleCaves and replace it with the worm nest caves. That should make it at least twice as fast I think.
  (11-17-2012, 08:51 AM)STR_Warrior Wrote:  and maybe could you add a function in the web configurator that allows you to change someone's rank. its very difficoult now to make yourself admin on android. True, I still need to do that.
  (11-17-2012, 08:51 AM)STR_Warrior Wrote:  but i think MC-Server is now good enough to be uploaded to the play store. (if you want becouse it cost money  ) Well dunno, I first want to thoroughly test this before I put it on the market (if I ever put it on the market) to make sure it doesn't harm the phone. Many people may be unaware of the amount of storage MCServer can consume on their SD card and they may not know how to delete MCServer properly to free that space up again. 
Putting MCServer on the market is free for me.
	 |