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 - 01-21-2014

I think. It don't give nil in c++. But thanks.

How can i get a window from his id? the enchantment packet returns me the id. But now i need the window from them.


RE: Enchanting - tonibm19 - 01-21-2014

http://mc-server.xoft.cz/LuaAPI/cWindow.html
There is a GetWindowID() function

Why don't you fork MCServer code on github and commit the code you have there?
Then we can have a look and if we can, help.


RE: Enchanting - daniel0916 - 01-21-2014

(01-21-2014, 01:58 AM)tonibm19 Wrote: http://mc-server.xoft.cz/LuaAPI/cWindow.html
There is a GetWindowID() function

Why don't you fork MCServer code on github and commit the code you have there?
Then we can have a look and if we can, help.

This only return the id. But i need to get the window from the id.

Wait i will push my changes to github.


RE: Enchanting - tonibm19 - 01-21-2014

I tried it, the major problem is that we now can't check if an item is enchantable. Maybe we cound do a g_IsItemEnchantable function


RE: Enchanting - NiLSPACE - 01-21-2014

No you could use:
if (a_ItemType == E_ITEM_BOOK
 || ItemCategory->IsTool(a_ItemType)
 || ItemCategory->IsArmor(a_ItemType))
{
 // Do stuff
}



RE: Enchanting - ThuGie - 01-21-2014

Yeah, that was how i wanted to do it as well,
Using this you can also only add the enchants the object is capable of,
If it was coded in the server, you are unable to enchant custom stuff, like a log that has a enchant, for fun of course..


RE: Enchanting - daniel0916 - 01-21-2014

https://github.com/daniel0916/MCServer/commit/0c2b307eab67b7f37d82a7862a6acbcd96b45adb

I used the IsEnchantable Method but there is wood enchantable. Or i made something false.


RE: Enchanting - ThuGie - 01-21-2014

Ah i see you are directly writing this in c++ ?
I was planning to do it tru lua plugin.


RE: Enchanting - daniel0916 - 01-21-2014

(01-21-2014, 03:38 AM)ThuGie Wrote: Ah i see you are directly writing this in c++ ?
I was planning to do it tru lua plugin.

Yes. I will implemented it in MCServer.

How would you like to receive the enchant packet from the client with a plugin?

Should i use IsEnchantable or the Method from STR_Warrior?


RE: Enchanting - tonibm19 - 01-21-2014

I want to do an enchanting plugin too, it was my objective, until I tested LuaWindow and Minecraft crashed Sad