Cuberite Forum

Full Version: Enchanting
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
Pages: 1 2 3 4 5 6 7 8 9 10 11
(04-12-2014, 11:06 PM)daniel0916 Wrote: [ -> ]But the ID's aren't right. 137 = command block. But there isn't a command block.

I think you try to check the wrong area, i made 2 Screenshorts what i think that
the first screnn is what i think what your code ic checking, the second what it schould check.
http://1drv.ms/1kSJta2

the tables are only for relativ posittion to the checked area
I haven't any knowing about cBlockArea. Maybe you are right but i don't know how can i check then the bookshelves..
I havent worked with the MCServer code at all, but please try:
cBlockArea Area;
		Area.Read(a_Player.GetWorld(), PosX - 2, PosX + 2, PosY, PosY + 1, PosZ - 2, PosZ + 2);

		for (int x = 0; x < 6; x++)
		{
			for (int y = 0; y < 3; y++)
			{
				for (int z = 0; z < 6; z++)
				{
					LOG("%i", Area.GetRelBlockType(x, y, z));

					if (Area.GetRelBlockType(x, y, z) == E_BLOCK_BOOKCASE)
					{
						LOG("BookShelf");
					}
				}
			}
		}
And:
cBlockArea Area;
		Area.Read(a_Player.GetWorld(), PosX - 2, PosX + 2, PosY, PosY + 1, PosZ - 2, PosZ + 2);

		for (int x = 0; x < 6; x++)
		{
			for (int y = 0; y < 3; y++)
			{
				for (int z = 0; z < 6; z++)
				{
					LOG("%i", Area.GetBlockType(x, y, z));

					if (Area.GetBlockType(x, y, z) == E_BLOCK_BOOKCASE)
					{
						LOG("BookShelf");
					}
				}
			}
		}
The first one is working. The second not.
But a Bookshelf also need to be one block away from the Enchantment Table..
(04-12-2014, 11:59 PM)daniel0916 Wrote: [ -> ]The first one is working. The second not.
But a Bookshelf also need to be one block away from the Enchantment Table..
Try to think about what blocks need to be checkt and make an algorithm that ckects them without even thinking of the BlockArea.
the block has to be
x = lenght; z = with; y = hight
((((x == 0) || (x == 5)) || ((z == 0) || (z == 5))) && ((y == 0) || y == 1)))
dont know if it works, also the block between the table an the bookshelf has to be air..
So i should test every position where a bookshelf should be and not use cBlockArea?
I will try to make it...
(04-13-2014, 12:28 AM)daniel0916 Wrote: [ -> ]So i should test every position where a bookshelf should be and not use cBlockArea?
I will try to make it...

You have to check inside the loop if the "selected" block can be a bookshelf

cBlockArea Area;
		Area.Read(a_Player.GetWorld(), PosX - 2, PosX + 2, PosY, PosY + 1, PosZ - 2, PosZ + 2);
 
		for (int x = 0; x < 6; x++)
		{
			for (int y = 0; y < 3; y++)
			{
				for (int z = 0; z < 6; z++)
				{
					if((((x == 0) || (x == 5)) || ((z == 0) || (z == 5))) && ((y == 0) || y == 1))
					{
						LOG("%i", Area.GetRelBlockType(x, y, z));
 
						if (Area.GetRelBlockType(x, y, z) == E_BLOCK_BOOKCASE)
						{
							LOG("BookShelf");
						}
					}
				}
			}
		}
It's working. But sometimes more Bookshelves would be found than there are.
Could you give me the source? I want to try to debug it. Smile
Pages: 1 2 3 4 5 6 7 8 9 10 11