Posts: 302
Threads: 8
Joined: Feb 2014
Thanks: 48
Given 31 thank(s) in 27 post(s)
04-12-2014, 11:28 PM
(This post was last modified: 04-12-2014, 11:32 PM by LO1ZB.)
(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
Posts: 219
Threads: 11
Joined: Dec 2013
Thanks: 52
Given 8 thank(s) in 4 post(s)
I haven't any knowing about cBlockArea. Maybe you are right but i don't know how can i check then the bookshelves..
Posts: 302
Threads: 8
Joined: Feb 2014
Thanks: 48
Given 31 thank(s) in 27 post(s)
04-12-2014, 11:45 PM
(This post was last modified: 04-12-2014, 11:46 PM by LO1ZB.)
I havent worked with the MCServer code at all, but please try:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 | 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:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 | 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" );
}
}
}
}
|
Posts: 219
Threads: 11
Joined: Dec 2013
Thanks: 52
Given 8 thank(s) in 4 post(s)
The first one is working. The second not.
But a Bookshelf also need to be one block away from the Enchantment Table..
Posts: 302
Threads: 8
Joined: Feb 2014
Thanks: 48
Given 31 thank(s) in 27 post(s)
(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..
Posts: 219
Threads: 11
Joined: Dec 2013
Thanks: 52
Given 8 thank(s) in 4 post(s)
So i should test every position where a bookshelf should be and not use cBlockArea?
I will try to make it...
Posts: 302
Threads: 8
Joined: Feb 2014
Thanks: 48
Given 31 thank(s) in 27 post(s)
(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
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 | 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" );
}
}
}
}
}
|
Posts: 219
Threads: 11
Joined: Dec 2013
Thanks: 52
Given 8 thank(s) in 4 post(s)
It's working. But sometimes more Bookshelves would be found than there are.
Posts: 302
Threads: 8
Joined: Feb 2014
Thanks: 48
Given 31 thank(s) in 27 post(s)
Could you give me the source? I want to try to debug it.
Posts: 219
Threads: 11
Joined: Dec 2013
Thanks: 52
Given 8 thank(s) in 4 post(s)
|