Enchanting
#71
(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
Reply
Thanks given by:
#72
I haven't any knowing about cBlockArea. Maybe you are right but i don't know how can i check then the bookshelves..
Reply
Thanks given by:
#73
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");
					}
				}
			}
		}
Reply
Thanks given by:
#74
The first one is working. The second not.
But a Bookshelf also need to be one block away from the Enchantment Table..
Reply
Thanks given by:
#75
(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..
Reply
Thanks given by:
#76
So i should test every position where a bookshelf should be and not use cBlockArea?
I will try to make it...
Reply
Thanks given by:
#77
(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");
						}
					}
				}
			}
		}
Reply
Thanks given by:
#78
It's working. But sometimes more Bookshelves would be found than there are.
Reply
Thanks given by:
#79
Could you give me the source? I want to try to debug it. Smile
Reply
Thanks given by:
#80
https://github.com/daniel0916/MCServer/tree/Enchanting

I also pushed your newest code..
Reply
Thanks given by:




Users browsing this thread: 21 Guest(s)