diff options
author | Mattes D <github@xoft.cz> | 2019-10-16 10:06:34 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2019-10-16 10:06:34 +0200 |
commit | 221cc4ec5cb6301743e947eaabed3fecedba796f (patch) | |
tree | 4e44c8bb7523e5d1d04468fc906ae24674c10abc /src/Blocks/BlockChest.h | |
parent | Fixed crash in hopper while pulling items from blockentity above itself (#4412) (diff) | |
download | cuberite-221cc4ec5cb6301743e947eaabed3fecedba796f.tar cuberite-221cc4ec5cb6301743e947eaabed3fecedba796f.tar.gz cuberite-221cc4ec5cb6301743e947eaabed3fecedba796f.tar.bz2 cuberite-221cc4ec5cb6301743e947eaabed3fecedba796f.tar.lz cuberite-221cc4ec5cb6301743e947eaabed3fecedba796f.tar.xz cuberite-221cc4ec5cb6301743e947eaabed3fecedba796f.tar.zst cuberite-221cc4ec5cb6301743e947eaabed3fecedba796f.zip |
Diffstat (limited to 'src/Blocks/BlockChest.h')
-rw-r--r-- | src/Blocks/BlockChest.h | 40 |
1 files changed, 31 insertions, 9 deletions
diff --git a/src/Blocks/BlockChest.h b/src/Blocks/BlockChest.h index 804c3d34a..0e277532e 100644 --- a/src/Blocks/BlockChest.h +++ b/src/Blocks/BlockChest.h @@ -1,24 +1,31 @@ #pragma once -#include "BlockEntity.h" +#include "../BlockEntities/ChestEntity.h" #include "../BlockArea.h" #include "../Entities/Player.h" -#include "MetaRotator.h" +#include "Mixins.h" class cBlockChestHandler : - public cMetaRotator<cBlockEntityHandler, 0x07, 0x02, 0x05, 0x03, 0x04> + public cMetaRotator<cContainerEntityHandler<cBlockEntityHandler>, 0x07, 0x02, 0x05, 0x03, 0x04> { + using super = cMetaRotator<cContainerEntityHandler<cBlockEntityHandler>, 0x07, 0x02, 0x05, 0x03, 0x04>; + public: - cBlockChestHandler(BLOCKTYPE a_BlockType) - : cMetaRotator<cBlockEntityHandler, 0x07, 0x02, 0x05, 0x03, 0x04>(a_BlockType) + + cBlockChestHandler(BLOCKTYPE a_BlockType): + super(a_BlockType) { } + + + + virtual bool GetPlacementBlockTypeMeta( cChunkInterface & a_ChunkInterface, cPlayer & a_Player, int a_BlockX, int a_BlockY, int a_BlockZ, eBlockFace a_BlockFace, @@ -65,6 +72,10 @@ public: return true; } + + + + virtual bool CanBeAt(cChunkInterface & a_ChunkInterface, int a_RelX, int a_RelY, int a_RelZ, const cChunk & a_Chunk) override { int BlockX = a_RelX + a_Chunk.GetPosX() * cChunkDef::Width; @@ -72,6 +83,10 @@ public: return CanBeAt(a_ChunkInterface, BlockX, a_RelY, BlockZ); } + + + + virtual bool CanBeAt(cChunkInterface & a_ChunkInterface, int a_BlockX, int a_BlockY, int a_BlockZ) { cBlockArea Area; @@ -137,6 +152,10 @@ public: return (NumChestNeighbors < 2); } + + + + /** Translates player yaw when placing a chest into the chest block metadata. Valid for single chests only */ static NIBBLETYPE PlayerYawToMetaData(double a_Yaw) { @@ -164,6 +183,10 @@ public: } } + + + + /** If there's a chest in the a_Area in the specified coords, modifies its meta to a_NewMeta and returns true. */ bool CheckAndAdjustNeighbor(cChunkInterface & a_ChunkInterface, const cBlockArea & a_Area, int a_RelX, int a_RelZ, NIBBLETYPE a_NewMeta) { @@ -175,10 +198,9 @@ public: return true; } - virtual void ConvertToPickups(cItems & a_Pickups, NIBBLETYPE a_BlockMeta) override - { - a_Pickups.push_back(cItem(m_BlockType, 1, 0)); - } + + + virtual ColourID GetMapBaseColourID(NIBBLETYPE a_Meta) override { |