1
0
Commit Graph

57 Commits

Author SHA1 Message Date
Tiger Wang
6bdd130aab OnBroken/OnPlaced are for entity actions
* Call OnPlaced/OnBroken in PlaceBlock/DigBlock
- Remove unused Placing/Breaking handlers
* Have the blockhandler's Check handle neighbour updating, instead of QueueTickBlockNeighbors
2020-08-04 18:15:18 +01:00
Mattes D
487f9a2aa9
Vector3 in Handlers (#4680)
Refactored all cBlockHandler and cItemHandler descendants to use Vector3.
2020-04-21 22:19:22 +02:00
Mattes D
26ac146f41
More Vector3 in cBlockHandler (#4644)
* cBlockHandler.OnUpdate uses Vector3 params.

Also slightly changed how block ticking works.
2020-04-17 10:36:37 +01:00
Mattes D
01b8ed5295
Pulled the BlockID and BlockInfo headers from Globals.h. (#4591)
The BlockID.h file was removed from Globals.h and renamed to BlockType.h (main change)
The BlockInfo.h file was removed from Globals.h (main change)
The ENUM_BLOCK_ID and ENUM_ITEM_ID enum names were replaced with ENUM_BLOCK_TYPE and ENUM_ITEM_TYPE (cosmetics)
The various enums, such as eDimension, eDamageType and eExplosionSource were moved from BlockType.h to Defines.h, together with the helper functions for converting between them and strings (StringToDimension et al.) (minor)
Many inline functions were moved from headers to their respective cpp files, so that BlockType.h could be included only into the cpp file, rather than the header.
That broke our tests a bit, since they pick bits and pieces out of the main code and provide stubs for the rest; they had to be re-stubbed and re-verified.
eMonsterType values are no longer tied to E_ITEM_SPAWN_EGG_META_* values
2020-04-03 08:57:01 +02:00
Mattes D
61904af626 Moved growing from cWorld / cChunk to cBlockHandler descendants. 2019-10-28 10:45:43 +01:00
Mattes D
221cc4ec5c
Refactored block-to-pickup conversion. (#4417) 2019-10-16 10:06:34 +02:00
Mattes D
8212f163b5 Register vanilla blocks in BlockTypeRegistry. 2019-08-05 21:42:54 +02:00
9caihezi
4242431407 Rewrite cClientHandle::HandleRightClick (#4089)
* Add hand parameter to distinguish main hand/off hand.
* Add a new function cClientHandle::HandleUseItem to separate the functionality of using an item without a target block. This matches the protocol with client version >= 1.9
* Always actively update the status of a block if the placement fails (by out of reach or rejected by plugin).
* Do not call plugin callback CallHookPlayerRightClick(-1, 255, -1, -1, 0, 0, 0) when using item.
   The CallHookPlayerUsingItem will still be called.
   Now at most one of CallHookPlayerRightClick, CallHookPlayerUsingBlock,
   CallHookPlayerUsingItem and CallHookPlayerEating will be called based on
   the type of action (not including the used version of callbacks).
* Do not count using item as BlockInteractionsRate check (Using item takes time).
* Now we can open chests(etc.) when sneaking as long as the player's hand is empty.
   This is what vanilla server does.
2018-01-08 13:37:10 +00:00
Bond-009
5badb9bcca cChunkInterface GetBlock, GetBlockMeta, GetBlockTypeMeta use vectors (#4050) 2017-11-20 11:13:11 +00:00
Lane Kolbly
87c89a1727 Bed piston fix (#3956)
* Threaded world interface into ConvertBlockToPickups

* Changed how cBlockPiston::PushBlocks sets the old block to air, so that the block exists for the DropBlock call.

* Removed unused a_Digger argument.

* Removed incorrect comment

* This time actually removed a_Digger references.
2017-08-25 10:56:01 +01:00
mathiascode
02775e52c4 Minor changes (#3909) 2017-08-24 11:19:40 +02:00
peterbell10
0d0323608d cBlockHandler: take player by ref 2017-08-01 08:21:20 +02:00
Lane Kolbly
5402b214b3 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.
2017-07-28 17:59:21 +01:00
peterbell10
bbf5bec817 BigFlower fixes (#3826)
* BigFlowers fixes

* Correct upper part meta
* Documented parameters to DoesIgnoreBuildCollision
2017-07-07 16:37:53 +02:00
Lukas Pioch
885d828712 Added bed entity (#3823)
* Added bed entity

* Export cBedEntity to lua
* Set color of bed through item damage value
* Added bed entity to APIDoc
* NBT: Added loading and saving
* Crafting recipes for the colored beds
2017-07-07 09:31:45 +02:00
LogicParrot
ca6ef58b1e Bulk clearing of whitespace 2016-02-05 23:50:18 +02:00
Gargaj
66e6589883 blockheight mechanism 2015-12-13 15:16:15 +01:00
Gargaj
f9008a4860 allow use failures to propagate from the entity/block to the player 2015-12-13 13:27:38 +01:00
Samuel Barney
cc83c4641d * Logic for handling plant growth has been centralized into cBlockPlant, and all growable plants now inherit from it.
* Blocks now have an effect upon plant growth, just like in vanilla.
2015-08-19 10:48:21 -06:00
Mattes D
6e4122e551 Unified the doxy-comment format. 2015-07-31 16:49:10 +02:00
Tiger Wang
8656e149c8 Improved maps 2015-07-14 21:46:30 +01:00
Mattes D
66a164a9a7 Added neighbor specification in the OnNeighborChanged() block callback.
Fixes the OnNeighborChanged endless recursion with large melon / pumpkin fields.
Fixes #2213.
2015-07-01 10:40:16 +02:00
Samuel Barney
e70e2b8ecc Rebased version of Code 2015-06-22 11:29:38 -06:00
Mattes D
ccdf03daaf Refactored all player block placing to go through hooks.
Fixes #1618.
2014-12-24 07:20:17 +01:00
Tiger Wang
a26541a7c3 En masse NULL -> nullptr replace 2014-10-22 20:12:49 -07:00
Tycho
a3f940f47c Removed more unessicary includes 2014-09-26 18:13:19 +01:00
Tiger Wang
fdabfd77e2 Improved cBlockHandler::DropBlock 2014-09-13 22:49:27 +01:00
Masy98
acae3c9c65 Moved sound-configs into BlockID.h and fixed/ added loads of sounds 2014-09-09 16:00:26 +02:00
Tiger Wang
d3012d6904 Merge remote-tracking branch 'origin/master' 2014-07-24 21:38:46 +01:00
Tiger Wang
3a6002de5b Fixed block drops
* Fixes #1242 (the issue addressed within)
2014-07-24 21:38:25 +01:00
archshift
4191be7ddb Removed redundant semicolons and re-added warning 2014-07-24 11:21:37 -07:00
Tiger Wang
d0e7b2f18b Merge branch 'master' into saplingsandleaves
Conflicts:
	src/Bindings/DeprecatedBindings.cpp
	src/Blocks/BlockSapling.h
2014-07-20 12:02:23 +01:00
Tiger Wang
f68b04e029 Proper comment for DropBlock() 2014-07-20 12:00:20 +01:00
Tiger Wang
0f8c24e04d Fixed issues relating to saplings and leaves
- Removed cBlockInfo::RequiresSpecialTool
* Fixes #1195
* Fixes #1201
2014-07-17 22:26:53 +01:00
madmaxoft
5e198c6730 Basic style fixes. 2014-07-17 22:50:58 +02:00
Howaner
36a2aa2f21 Rename CanChangeDirtToGrass to CanDirtGrowGrass 2014-05-07 12:59:48 +02:00
Howaner
4d7b250a50 Remove old import 2014-04-06 21:45:55 +02:00
Howaner
039191499c Add CanChangeDirtToGrass function to Block Handlers. 2014-04-06 21:41:01 +02:00
Tycho
307fad0f25 Fixed issues with int vs size_t and a few other warnings 2014-03-08 08:33:38 -08:00
Howaner
594ddd86a0 Add SendBlockTo to cWorldInterface 2014-03-05 19:33:43 +01:00
Howaner
d4a5b16c52 Add data backsending, when the Client interacts a Block and the Interact is cancelled. 2014-03-05 15:10:20 +01:00
andrew
070d483236 cBlockInfo now manages the respective cBlockHandler 2014-03-02 21:25:05 +02:00
Tycho
8464f689ea Improved Type safety of eBlockFace
May Fix #640
2014-02-04 10:59:05 -08:00
Tycho
b82fc394dd Changed Signiture of OnUpdate 2014-02-02 06:49:37 -08:00
Tycho
6e39ed3868 Changed Signiture of OnDigging 2014-02-01 08:35:48 -08:00
Tycho
cf3b4ec226 Changed Signiture of OnDestroyedByPlayer 2014-02-01 06:01:13 -08:00
Tycho
c6304b2b4f Changed pointers to references 2014-02-01 05:06:32 -08:00
Tycho
25ec7750aa Changed signitures of Several BLockHandler Methods
Changed the signitures of the following to use interfaces:
GetPlacementBlockTypeMeta
OnPlaced
OnPlacedByPlayer
OnDestroyed
OnNeighbourChanged
NeighbourChanged
OnUse
CanBeAt
Check
2014-01-31 15:17:41 -08:00
Tycho
a13d009a30 Refactored GetPlacementBlockTypeMeta 2014-01-26 07:06:25 -08:00
Tycho
14e48ccb4b Refactored cBlockHandler::OnUse and dependents 2014-01-26 06:20:39 -08:00