summaryrefslogtreecommitdiffstats
path: root/src/BlockEntities
diff options
context:
space:
mode:
authorTiger Wang <ziwei.tiger@hotmail.co.uk>2014-07-12 23:06:25 +0200
committerTiger Wang <ziwei.tiger@hotmail.co.uk>2014-07-12 23:06:25 +0200
commite71e432633a26d0ab24d2da7e3707e4ab7060296 (patch)
treeb7c83bb6d1040f86907a1f49e0d33e9bdd0a645c /src/BlockEntities
parentSuggestions (diff)
downloadcuberite-e71e432633a26d0ab24d2da7e3707e4ab7060296.tar
cuberite-e71e432633a26d0ab24d2da7e3707e4ab7060296.tar.gz
cuberite-e71e432633a26d0ab24d2da7e3707e4ab7060296.tar.bz2
cuberite-e71e432633a26d0ab24d2da7e3707e4ab7060296.tar.lz
cuberite-e71e432633a26d0ab24d2da7e3707e4ab7060296.tar.xz
cuberite-e71e432633a26d0ab24d2da7e3707e4ab7060296.tar.zst
cuberite-e71e432633a26d0ab24d2da7e3707e4ab7060296.zip
Diffstat (limited to '')
-rw-r--r--src/BlockEntities/BlockEntity.cpp11
-rw-r--r--src/BlockEntities/HopperEntity.cpp17
2 files changed, 18 insertions, 10 deletions
diff --git a/src/BlockEntities/BlockEntity.cpp b/src/BlockEntities/BlockEntity.cpp
index feef088a9..2910c735e 100644
--- a/src/BlockEntities/BlockEntity.cpp
+++ b/src/BlockEntities/BlockEntity.cpp
@@ -27,21 +27,20 @@ cBlockEntity * cBlockEntity::CreateByBlockType(BLOCKTYPE a_BlockType, NIBBLETYPE
{
switch (a_BlockType)
{
- case E_BLOCK_CHEST:
- case E_BLOCK_TRAPPED_CHEST: return new cChestEntity (a_BlockX, a_BlockY, a_BlockZ, a_World, a_BlockType);
- case E_BLOCK_FURNACE:
- case E_BLOCK_LIT_FURNACE: return new cFurnaceEntity(a_BlockX, a_BlockY, a_BlockZ, a_BlockType, a_BlockMeta, a_World);
-
case E_BLOCK_BEACON: return new cBeaconEntity (a_BlockX, a_BlockY, a_BlockZ, a_World);
+ case E_BLOCK_CHEST: return new cChestEntity (a_BlockX, a_BlockY, a_BlockZ, a_World, a_BlockType);
case E_BLOCK_COMMAND_BLOCK: return new cCommandBlockEntity(a_BlockX, a_BlockY, a_BlockZ, a_World);
case E_BLOCK_DISPENSER: return new cDispenserEntity (a_BlockX, a_BlockY, a_BlockZ, a_World);
case E_BLOCK_DROPPER: return new cDropperEntity (a_BlockX, a_BlockY, a_BlockZ, a_World);
case E_BLOCK_ENDER_CHEST: return new cEnderChestEntity (a_BlockX, a_BlockY, a_BlockZ, a_World);
case E_BLOCK_FLOWER_POT: return new cFlowerPotEntity (a_BlockX, a_BlockY, a_BlockZ, a_World);
+ case E_BLOCK_FURNACE: return new cFurnaceEntity(a_BlockX, a_BlockY, a_BlockZ, a_BlockType, a_BlockMeta, a_World);
case E_BLOCK_HEAD: return new cMobHeadEntity (a_BlockX, a_BlockY, a_BlockZ, a_World);
- case E_BLOCK_JUKEBOX: return new cJukeboxEntity (a_BlockX, a_BlockY, a_BlockZ, a_World);
case E_BLOCK_HOPPER: return new cHopperEntity (a_BlockX, a_BlockY, a_BlockZ, a_World);
+ case E_BLOCK_JUKEBOX: return new cJukeboxEntity (a_BlockX, a_BlockY, a_BlockZ, a_World);
+ case E_BLOCK_LIT_FURNACE: return new cFurnaceEntity(a_BlockX, a_BlockY, a_BlockZ, a_BlockType, a_BlockMeta, a_World);
case E_BLOCK_SIGN_POST: return new cSignEntity (a_BlockType, a_BlockX, a_BlockY, a_BlockZ, a_World);
+ case E_BLOCK_TRAPPED_CHEST: return new cChestEntity (a_BlockX, a_BlockY, a_BlockZ, a_World, a_BlockType);
case E_BLOCK_WALLSIGN: return new cSignEntity (a_BlockType, a_BlockX, a_BlockY, a_BlockZ, a_World);
case E_BLOCK_NOTE_BLOCK: return new cNoteEntity (a_BlockX, a_BlockY, a_BlockZ, a_World);
}
diff --git a/src/BlockEntities/HopperEntity.cpp b/src/BlockEntities/HopperEntity.cpp
index bcaf26701..181b6a2ce 100644
--- a/src/BlockEntities/HopperEntity.cpp
+++ b/src/BlockEntities/HopperEntity.cpp
@@ -380,7 +380,7 @@ bool cHopperEntity::MoveItemsFromChest(cChunk & a_Chunk)
return true;
}
- // Check if the chest is a double-chest, if so, try to move from there:
+ // Check if the chest is a double-chest (chest directly above was empty), if so, try to move from there:
static const struct
{
int x, z;
@@ -403,7 +403,11 @@ bool cHopperEntity::MoveItemsFromChest(cChunk & a_Chunk)
}
BLOCKTYPE Block = Neighbor->GetBlock(x, m_PosY + 1, z);
- if ((Block != E_BLOCK_CHEST) && (Block != E_BLOCK_TRAPPED_CHEST))
+ if (
+ ((Block != E_BLOCK_CHEST) && (Block != E_BLOCK_TRAPPED_CHEST)) ||
+ ((Block == E_BLOCK_CHEST) && (Chest->GetBlockType() != E_BLOCK_CHEST)) ||
+ ((Block == E_BLOCK_TRAPPED_CHEST) && (Chest->GetBlockType() != E_BLOCK_TRAPPED_CHEST))
+ )
{
continue;
}
@@ -556,10 +560,11 @@ bool cHopperEntity::MoveItemsToChest(cChunk & a_Chunk, int a_BlockX, int a_Block
}
if (MoveItemsToGrid(*Chest))
{
+ // Chest block directly connected was not full
return true;
}
- // Check if the chest is a double-chest, if so, try to move into the other half:
+ // Check if the chest is a double-chest (chest block directly connected was full), if so, try to move into the other half:
static const struct
{
int x, z;
@@ -584,7 +589,11 @@ bool cHopperEntity::MoveItemsToChest(cChunk & a_Chunk, int a_BlockX, int a_Block
}
BLOCKTYPE Block = Neighbor->GetBlock(x, a_BlockY, z);
- if ((Block != E_BLOCK_CHEST) && (Block != E_BLOCK_TRAPPED_CHEST))
+ if (
+ ((Block != E_BLOCK_CHEST) && (Block != E_BLOCK_TRAPPED_CHEST)) ||
+ ((Block == E_BLOCK_CHEST) && (Chest->GetBlockType() != E_BLOCK_CHEST)) ||
+ ((Block == E_BLOCK_TRAPPED_CHEST) && (Chest->GetBlockType() != E_BLOCK_TRAPPED_CHEST))
+ )
{
continue;
}