Enchanting
#61
But this aren't random enchantments or?
Reply
Thanks given by:
#62
No indeed,
In your code you are checking what kind of armor or weapon it is right ?
Based on that + what option they chose, you should set a enchantment + level that suits it. or multiple enchants of course.
You will have to code that yourself though.
Reply
Thanks given by:
#63
I'm working now on Enchanting..

I added the Enchantment-Slot-Level generating but without bookshelf checking.
Now i will check the amount of bookshelves und i have a problem.
1
m_ParentWindow.GetOwner()->GetBlockPos(x, y, z);
When i will call this method mc-server crash.
Have anyone a better idea to get the position of the enchantment table?
Reply
Thanks given by:
#64
I think you should wait until 1.8
Reply
Thanks given by:
#65
Well, a crash needs a bug report, almost always. Why not report it on GitHub?
Reply
Thanks given by:
#66
(04-08-2014, 04:48 AM)bearbin Wrote: Well, a crash needs a bug report, almost always. Why not report it on GitHub?

I hadn't time yesterday. I will make it later...
Reply
Thanks given by:
#67
Currently i'm working on the bookshelves checking.

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 < 7; x++)
        {
            for (int y = 0; y < 2; y++)
            {
                for (int z = 0; z < 7; z++)
                {
                    LOG(Printf("%i", Area.GetBlockType(x, y, z)).c_str());
 
                    if (Area.GetBlockType(x, y, z) == E_BLOCK_BOOKCASE)
                    {
                        LOG("BookShelf");
                    }
                }
            }
        }

What is wrong? PosX etc.. are the Enchantment Table Position.
Reply
Thanks given by:
#68
Well.. What's the problem? What is it supposed to do?
Reply
Thanks given by:
#69
LOG(Printf("%i", Area.GetBlockType(x, y, z)).c_str());

Don't need to go this difficult, this is enough (LOG() functions work the same as printf):
LOG("%i", Area.GetBlockType(x, y, z));

Your problem probably is that you're using non-relative GetBlockType(). You should use the relative-coord version: GetRelBlockType()
Reply
Thanks given by: daniel0916
#70
Now i have this code:
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 < 7; x++)
        {
            for (int y = 0; y < 2; y++)
            {
                for (int z = 0; z < 7; z++)
                {
                    LOG("%i", Area.GetRelBlockType(x, y, z));
 
                    if (Area.GetRelBlockType(x, y, z) == E_BLOCK_BOOKCASE)
                    {
                        LOG("BookShelf");
                    }
                }
            }
        }

Output:
http://pastebin.com/3EFuU6a0

But the ID's aren't right. 137 = command block. But there isn't a command block.
Reply
Thanks given by:




Users browsing this thread: 1 Guest(s)