04-13-2014, 04:55 AM
It's all enchanting done?
Enchanting
|
04-13-2014, 04:55 AM
It's all enchanting done?
04-13-2014, 06:15 AM
(This post was last modified: 04-13-2014, 05:52 PM by daniel0916.)
Enchanting is almost done. But currently on every item will be 3 enchantments when you have enough levels. And i forgot to remove the level from the player.
04-13-2014, 09:37 PM
(This post was last modified: 04-13-2014, 09:58 PM by daniel0916.)
I fixed now some bugs.
2 features aren't working currently. The first is the bookshelf checking and the second that every item will become the max amount of enchantments. https://github.com/daniel0916/MCServer/c...9f4d1a651e The Level in XP Converting is not perfect. When i am level 31 and enchant something i will have 3 level after the enchanting And i found a bug in MCServer. The Enchantments are invisible. I will make a Report on Github
04-14-2014, 01:42 AM
(This post was last modified: 04-14-2014, 01:43 AM by daniel0916.)
LO1ZB has a good idea.
He will check the bookshelves not on every enchanting. He will check the bookshelves when a enchantment table will be placed (and save). He will check the bookshelves when a bookshelves will be mined in the area of a enchantment table (and save). He will check the bookshelves when a bookshelves will be placed in the area of a enchantment table (and save). Is this better than check every enchanting how many bookshelves are around the enchantment table?
04-14-2014, 01:52 AM
Not really. To save, he would need to make a place to save the info - so an enchantment table block entity with data that the vanilla doesn't have. So if someone loads a vanilla-generated world, you still need to calculate the number of bookshelves. Not to mention such weird cases such as a bookshelf being in one chunk and the enchanting table in the neighboring chunk, which is already unloaded, and for some reason the bookshelf gets destroyed - there's nowhere to save the updated value, because the enchanting table's chunk is not loaded.
Too much work for very little gain. The actual check for the number of bookshelves is done so infrequently that it's not worth the "optimizations". Much better to calculate the value when the enchantment table is rclked (so store the value in its UI window). Thanks given by: daniel0916
04-14-2014, 06:12 AM
https://github.com/mc-server/MCServer/issues/886
Have anyone a idea why it's buggy?
04-15-2014, 01:01 AM
(This post was last modified: 04-15-2014, 01:02 AM by daniel0916.)
Okay good. The enchanting system is ready. Only one thing didn't work. When you will move a item with shift click into the enchanting table the item is in the slot but the Clicked Method from cSlotAreaEnchanting won't be called. How can i add the shift click feature? Shift Click in the enchantment slot to do the item out is working (https://github.com/daniel0916/MCServer/b...a.cpp#L710 ).
04-16-2014, 10:05 PM
04-17-2014, 05:11 AM
@xoft
What is wrong with this code? int Bookshelves = 0; cBlockArea Area; Area.Read(a_World, PosX - 2, PosX + 2, PosY, PosY + 1, PosZ - 2, PosZ + 2); static const struct { int m_BookX, m_BookY, m_BookZ; // Coords to check for bookcases int m_AirX, m_AirY, m_AirZ; // Coords to check for air; if not air, the bookcase won't be counted } CheckCoords[] = { { -2, 0, -2, -1, 0, -1 }, // Bookcase at {-2, 0, -2}, air at {-1, 0, -1} { -1, 0, -2, -1, 0, -1 }, // Bookcase at {-1, 0, -2}, air at {-1, 0, -1} { 0, 0, -2, 0, 0, -1 }, // Bookcase at {0, 0, -2}, air at {0, 0, -1} { 1, 0, -2, 1, 0, -1 }, // Bookcase at {1, 0, -2}, air at {1, 0, -1} { 2, 0, -2, 1, 0, -1 }, // Bookcase at {2, 0, -2}, air at {1, 0, -1} { 2, 0, -1, 1, 0, -1 }, // Bookcase at {2, 0, -1}, air at {1, 0, -1} { 2, 0, 0, 1, 0, 0 }, // Bookcase at {2, 0, 0}, air at {1, 0, 0} { 2, 0, 1, 1, 0, 1 }, // Bookcase at {2, 0, 1}, air at {1, 0, 1} { 2, 0, 2, 1, 0, 1 }, // Bookcase at {2, 0, 2}, air at {1, 0, 1} { 1, 0, 2, 1, 0, 1 }, // Bookcase at {1, 0, 2}, air at {1, 0, 1} { 0, 0, 2, 0, 0, 1 }, // Bookcase at {0, 0, 2}, air at {0, 0, 1} { -1, 0, 2, -1, 0, 1 }, // Bookcase at {-1, 0, 2}, air at {-1, 0, 1} { -2, 0, 2, -1, 0, 1 }, // Bookcase at {-2, 0, 2}, air at {-1, 0, 1} { -2, 0, 1, -1, 0, 1 }, // Bookcase at {-2, 0, 1}, air at {-1, 0, 1} { -2, 0, 0, -1, 0, 0 }, // Bookcase at {-2, 0, 0}, air at {-1, 0, 0} { -2, 0, -1, -1, 0, -1 }, // Bookcase at {-2, 0, -1}, air at {-1, 0, -1} { -2, 1, -2, -1, 1, -1 }, // Bookcase at {-2, 1, -2}, air at {-1, 1, -1} { -1, 1, -2, -1, 1, -1 }, // Bookcase at {-1, 1, -2}, air at {-1, 1, -1} { 0, 1, -2, 0, 1, -1 }, // Bookcase at {0, 1, -2}, air at {0, 1, -1} { 1, 1, -2, 1, 1, -1 }, // Bookcase at {1, 1, -2}, air at {1, 1, -1} { 2, 1, -2, 1, 1, -1 }, // Bookcase at {2, 1, -2}, air at {1, 1, -1} { 2, 1, -1, 1, 1, -1 }, // Bookcase at {2, 1, -1}, air at {1, 1, -1} { 2, 1, 0, 1, 1, 0 }, // Bookcase at {2, 1, 0}, air at {1, 1, 0} { 2, 1, 1, 1, 1, 1 }, // Bookcase at {2, 1, 1}, air at {1, 1, 1} { 2, 1, 2, 1, 1, 1 }, // Bookcase at {2, 1, 2}, air at {1, 1, 1} { 1, 1, 2, 1, 1, 1 }, // Bookcase at {1, 1, 2}, air at {1, 1, 1} { 0, 1, 2, 0, 1, 1 }, // Bookcase at {0, 1, 2}, air at {0, 1, 1} { -1, 1, 2, -1, 1, 1 }, // Bookcase at {-1, 1, 2}, air at {-1, 1, 1} { -2, 1, 2, -1, 1, 1 }, // Bookcase at {-2, 1, 2}, air at {-1, 1, 1} { -2, 1, 1, -1, 1, 1 }, // Bookcase at {-2, 1, 1}, air at {-1, 1, 1} { -2, 1, 0, -1, 1, 0 }, // Bookcase at {-2, 1, 0}, air at {-1, 1, 0} { -2, 1, -1, -1, 1, -1 } // Bookcase at {-2, 1, -1}, air at {-1, 1, -1} }; for (size_t i = 0; i < ARRAYCOUNT(CheckCoords); i++) { if ( (Area.GetRelBlockType(CheckCoords[i].m_AirX, CheckCoords[i].m_AirY, CheckCoords[i].m_AirZ) == E_BLOCK_AIR) && // There's air in the checkspot (Area.GetRelBlockType(CheckCoords[i].m_BookX, CheckCoords[i].m_BookY, CheckCoords[i].m_BookZ) == E_BLOCK_BOOKCASE) // There's bookcase in the wanted place ) { Bookshelves++; cRoot::Get()->BroadcastChat("Bookshelf"); } } // for i - CheckCoords
04-17-2014, 05:31 AM
This is just an idea, but you could maybe use the cLineBlockTracer class.
|
« Next Oldest | Next Newest »
|