Check for intersection between placed blocks and entities. (#3850)
* Check for intersection between placed blocks and entities. + Implemented GetPlacementCollisionBox, to permit custom placement collision boxes for blocks. * Factored block-entity placement checking into another function in cPlayer. - Removed vector min/max functions * Use GetWorld to get the world in DoesPlacingBlocksIntersectEntity. + Added block height checks, allow different cEntity subclasses to decide whether they will prevent block placement.
This commit is contained in:
@@ -3,6 +3,8 @@
|
||||
|
||||
#include "../Defines.h"
|
||||
|
||||
#include "../BoundingBox.h"
|
||||
|
||||
|
||||
|
||||
|
||||
@@ -30,6 +32,11 @@ public:
|
||||
Note that the coords are chunk-relative! */
|
||||
virtual void OnUpdate(cChunkInterface & cChunkInterface, cWorldInterface & a_WorldInterface, cBlockPluginInterface & a_BlockPluginInterface, cChunk & a_Chunk, int a_RelX, int a_RelY, int a_RelZ);
|
||||
|
||||
/** Returns the relative bounding box that must be entity-free in
|
||||
order for the block to be placed. a_XM, a_XP, etc. stand for the
|
||||
blocktype of the minus-X neighbor, the positive-X neighbor, etc. */
|
||||
virtual cBoundingBox GetPlacementCollisionBox(BLOCKTYPE a_XM, BLOCKTYPE a_XP, BLOCKTYPE a_YM, BLOCKTYPE a_YP, BLOCKTYPE a_ZM, BLOCKTYPE a_ZP);
|
||||
|
||||
/** Called before a block is placed into a world.
|
||||
The handler should return true to allow placement, false to refuse.
|
||||
Also, the handler should set a_BlockType and a_BlockMeta to correct values for the newly placed block.
|
||||
|
||||
Reference in New Issue
Block a user