Cuberite Forum
Enchanting - Printable Version

+- Cuberite Forum (https://forum.cuberite.org)
+-- Forum: Cuberite (https://forum.cuberite.org/forum-4.html)
+--- Forum: Development (https://forum.cuberite.org/forum-13.html)
+--- Thread: Enchanting (/thread-1321.html)

Pages: 1 2 3 4 5 6 7 8 9 10 11


RE: Enchanting - daniel0916 - 02-01-2014

But this aren't random enchantments or?


RE: Enchanting - ThuGie - 02-01-2014

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.


RE: Enchanting - daniel0916 - 04-08-2014

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.
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?


RE: Enchanting - tonibm19 - 04-08-2014

I think you should wait until 1.8


RE: Enchanting - bearbin - 04-08-2014

Well, a crash needs a bug report, almost always. Why not report it on GitHub?


RE: Enchanting - daniel0916 - 04-09-2014

(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...


RE: Enchanting - daniel0916 - 04-12-2014

Currently i'm working on the bookshelves checking.

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.


RE: Enchanting - NiLSPACE - 04-12-2014

Well.. What's the problem? What is it supposed to do?


RE: Enchanting - xoft - 04-12-2014

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()


RE: Enchanting - daniel0916 - 04-12-2014

Now i have this code:
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.