summaryrefslogtreecommitdiffstats
path: root/src/UI
diff options
context:
space:
mode:
authordaniel0916 <theschokolps@gmail.com>2014-04-14 11:56:50 +0200
committerdaniel0916 <theschokolps@gmail.com>2014-04-14 11:56:50 +0200
commitfb26d2ba870f63deb5515521ecf5ce0c35780a2b (patch)
tree968b66acb1243f6723cb4dcfc1c8db1b18e0934e /src/UI
parentBug fixes (diff)
downloadcuberite-fb26d2ba870f63deb5515521ecf5ce0c35780a2b.tar
cuberite-fb26d2ba870f63deb5515521ecf5ce0c35780a2b.tar.gz
cuberite-fb26d2ba870f63deb5515521ecf5ce0c35780a2b.tar.bz2
cuberite-fb26d2ba870f63deb5515521ecf5ce0c35780a2b.tar.lz
cuberite-fb26d2ba870f63deb5515521ecf5ce0c35780a2b.tar.xz
cuberite-fb26d2ba870f63deb5515521ecf5ce0c35780a2b.tar.zst
cuberite-fb26d2ba870f63deb5515521ecf5ce0c35780a2b.zip
Diffstat (limited to '')
-rw-r--r--src/UI/SlotArea.cpp18
1 files changed, 10 insertions, 8 deletions
diff --git a/src/UI/SlotArea.cpp b/src/UI/SlotArea.cpp
index 673c036b6..23108c256 100644
--- a/src/UI/SlotArea.cpp
+++ b/src/UI/SlotArea.cpp
@@ -659,29 +659,31 @@ void cSlotAreaEnchanting::ClickedResult(cPlayer & a_Player)
cEnchantingWindow * Window = (cEnchantingWindow*)&m_ParentWindow;
Window->GetBlockPos(PosX, PosY, PosZ);
+ int bookshelves = 0;
cBlockArea Area;
Area.Read(a_Player.GetWorld(), PosX - 2, PosX + 2, PosY, PosY + 1, PosZ - 2, PosZ + 2);
- for (int x = 0; x < 6; x++)
+ for (int y = 0; y <= 2; y++)
{
- for (int y = 0; y < 3; y++)
+ for (int x = 0; x <= 4; x++)
{
- for (int z = 0; z < 6; z++)
+ for (int z = 0; z <= 4; z++)
{
- if ((((x == 0) || (x == 5)) || ((z == 0) || (z == 5))) && ((y == 0) || y == 1))
+ if ((((x == 0) || (x == 4)) || ((z == 0) || (z == 4))) && ((y == 0) || y == 1))
{
- LOG("%i", Area.GetRelBlockType(x, y, z));
-
if (Area.GetRelBlockType(x, y, z) == E_BLOCK_BOOKCASE)
{
- LOG("BookShelf");
+ bookshelves++;
}
}
}
}
}
- int bookshelves = 15; // TODO: Check Bookshelves
+ if (bookshelves > 15)
+ {
+ bookshelves = 15;
+ }
cFastRandom Random;
int base = (Random.GenerateRandomInteger(1, 8) + floor(bookshelves / 2) + Random.GenerateRandomInteger(0, bookshelves));