Enchanting
#81
It's all enchanting done?
Reply
Thanks given by:
#82
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.
Reply
Thanks given by:
#83
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
Reply
Thanks given by:
#84
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?
Reply
Thanks given by:
#85
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).
Reply
Thanks given by:
#86
https://github.com/mc-server/MCServer/issues/886
Have anyone a idea why it's buggy?
Reply
Thanks given by:
#87
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 ).
Reply
Thanks given by:
#88
https://github.com/mc-server/MCServer/pull/890
Reply
Thanks given by:
#89
@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
Reply
Thanks given by:
#90
This is just an idea, but you could maybe use the cLineBlockTracer class.
Reply
Thanks given by:




Users browsing this thread: 1 Guest(s)