summaryrefslogtreecommitdiffstats
path: root/src/Blocks/BlockHandler.h (unfollow)
Commit message (Collapse)AuthorFilesLines
2020-10-08Merged OnBreak with OnPlayerBreak (#4967)12xx121-14/+5
Co-authored-by: 12xx12 <12xx12100@gmail.com> Co-authored-by: Tiger Wang <ziwei.tiger@outlook.com>
2020-10-05Fix cmake not adding Werror on clang, and _lots_ of warnings (#4963)peterbell101-4/+6
* Fix cmake not adding Werror on clang, and _lots_ of warnings * WIP: Build fixes * Cannot make intermediate blockhandler instance * Tiger's changes * Fix BitIndex check * Handle invalid NextState values in cMultiVersionProtocol Co-authored-by: Tiger Wang <ziwei.tiger@outlook.com>
2020-09-28Fortune Drops (#4932)KingCol131-0/+9
+ Implemented and standardized all clamped discrete random drops. + Changed cItems Add from push_back to emplace_back. Implement fortune for crops. + Enabled hoes to be enchanted with efficiency, silk touch and fortune. Made leaves, gravel and crops affected by fortune. Co-authored-by: Tiger Wang <ziwei.tiger@outlook.com>
2020-09-25Remove unused Temporary namespaceTiger Wang1-11/+0
2020-09-25Unify block entity pickup conversionTiger Wang1-7/+1
- Removed normal BlockHandler knowledge of block entities during conversion + Added cBlockEntity::ConvertToPickups that handles it
2020-09-23Limit fortune level, style fixesTiger Wang1-1/+1
2020-09-20Implement fortune for ores, glowstone and sea lanterns (#4897)KingCol131-0/+4
* Implemented fortune for ores, glowstone and sea lanterns (but nothing organic or flint). * Cleanup printf * Stopped playing golf, gave the Camels a FirstHump and moved the FortuneDropMult comment. Thanks for the review :). * Got rid of FortuneDropMult and replaced with Peter's massive optimization/simplification. * Fixed default lapis max droprate (8 -> 9). * Clamp max drops for non-redstone ores to 10. * Comment justifying the clamp.
2020-09-20BlockHandler initialisation is a constant expression (#4891)Tiger Wang1-32/+32
* BlockHandler initialisation is a constant expression If we can't make it all namespaces, this is the next best I guess. + Tag handlers constexpr, const as needed + Inherit constructors * Privatise handler functions * More constexpr Co-authored-by: Alexander Harkness <me@bearbin.net>
2020-09-17BlockHandler: no dynamic allocation (#4862)Tiger Wang1-3/+3
* BlockHandler: no dynamic allocation
2020-08-04OnBroken/OnPlaced are for entity actionsTiger Wang1-22/+5
* Call OnPlaced/OnBroken in PlaceBlock/DigBlock - Remove unused Placing/Breaking handlers * Have the blockhandler's Check handle neighbour updating, instead of QueueTickBlockNeighbors
2020-04-21Vector3 in Handlers (#4680)Mattes D1-28/+52
Refactored all cBlockHandler and cItemHandler descendants to use Vector3.
2020-04-17More Vector3 in cBlockHandler (#4644)Mattes D1-3/+16
* cBlockHandler.OnUpdate uses Vector3 params. Also slightly changed how block ticking works.
2020-04-03Pulled the BlockID and BlockInfo headers from Globals.h. (#4591)Mattes D1-1/+1
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
2019-10-28Moved growing from cWorld / cChunk to cBlockHandler descendants.Mattes D1-0/+4
2019-10-16Refactored block-to-pickup conversion. (#4417)Mattes D1-27/+67
2019-08-05Register vanilla blocks in BlockTypeRegistry.Mattes D1-0/+7
2018-01-08Rewrite cClientHandle::HandleRightClick (#4089)9caihezi1-1/+2
* 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.
2017-11-20cChunkInterface GetBlock, GetBlockMeta, GetBlockTypeMeta use vectors (#4050)Bond-0091-1/+1
2017-08-25Bed piston fix (#3956)Lane Kolbly1-2/+2
* 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-24Minor changes (#3909)mathiascode1-1/+1
2017-08-01cBlockHandler: take player by refpeterbell101-6/+6
2017-07-28Check for intersection between placed blocks and entities. (#3850)Lane Kolbly1-0/+7
* 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-07BigFlower fixes (#3826)peterbell101-9/+4
* BigFlowers fixes * Correct upper part meta * Documented parameters to DoesIgnoreBuildCollision
2017-07-07Added bed entity (#3823)Lukas Pioch1-0/+4
* 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
2016-02-05Bulk clearing of whitespaceLogicParrot1-21/+21
2015-12-13blockheight mechanismGargaj1-1/+5
2015-12-13allow use failures to propagate from the entity/block to the playerGargaj1-2/+3
2015-08-19* Logic for handling plant growth has been centralized into cBlockPlant, and all growable plants now inherit from it.Samuel Barney1-0/+3
* Blocks now have an effect upon plant growth, just like in vanilla.
2015-07-31Unified the doxy-comment format.Mattes D1-19/+18
2015-07-14Improved mapsTiger Wang1-0/+3
2015-07-01Added neighbor specification in the OnNeighborChanged() block callback.Mattes D1-7/+13
Fixes the OnNeighborChanged endless recursion with large melon / pumpkin fields. Fixes #2213.
2015-06-22Rebased version of CodeSamuel Barney1-3/+0
2014-12-24Refactored all player block placing to go through hooks.Mattes D1-11/+10
Fixes #1618.
2014-10-23En masse NULL -> nullptr replaceTiger Wang1-1/+1
2014-10-20En masse NULL -> nullptr replaceTiger Wang1-1/+1
2014-09-26Removed more unessicary includesTycho1-4/+4
2014-09-13Improved cBlockHandler::DropBlockTiger Wang1-1/+1
2014-09-09Moved sound-configs into BlockID.h and fixed/ added loads of soundsMasy981-3/+0
2014-07-24Fixed block dropsTiger Wang1-1/+2
* Fixes #1242 (the issue addressed within)
2014-07-24Removed redundant semicolons and re-added warningarchshift1-4/+4
2014-07-20Proper comment for DropBlock()Tiger Wang1-2/+5
2014-07-17Fixed issues relating to saplings and leavesTiger Wang1-5/+5
- Removed cBlockInfo::RequiresSpecialTool * Fixes #1195 * Fixes #1201
2014-07-17Basic style fixes.madmaxoft1-11/+11
2014-05-07Rename CanChangeDirtToGrass to CanDirtGrowGrassHowaner1-2/+2
2014-04-06Remove old importHowaner1-1/+1
2014-04-06Add CanChangeDirtToGrass function to Block Handlers.Howaner1-0/+3
2014-03-08Fixed issues with int vs size_t and a few other warningsTycho1-0/+2
2014-03-05Add SendBlockTo to cWorldInterfaceHowaner1-1/+1
2014-03-05Add data backsending, when the Client interacts a Block and the Interact is cancelled.Howaner1-1/+4
2014-03-02cBlockInfo now manages the respective cBlockHandlerandrew1-19/+3
2014-02-04Improved Type safety of eBlockFaceTycho1-3/+3
May Fix #640
2014-02-02Changed Signiture of OnUpdateTycho1-3/+4
2014-02-01Changed Signiture of OnDiggingTycho1-1/+1
2014-02-01Changed Signiture of OnDestroyedByPlayerTycho1-2/+2
2014-02-01Changed pointers to referencesTycho1-9/+9
2014-02-01Changed signitures of Several BLockHandler MethodsTycho1-4/+4
Changed the signitures of the following to use interfaces: GetPlacementBlockTypeMeta OnPlaced OnPlacedByPlayer OnDestroyed OnNeighbourChanged NeighbourChanged OnUse CanBeAt Check
2014-01-26Refactored GetPlacementBlockTypeMetaTycho1-1/+1
2014-01-26Refactored cBlockHandler::OnUse and dependentsTycho1-6/+6
2014-01-25First attempt at Implementing InterfacesTycho1-1/+2
2013-12-22merged in warnings changesTycho Bickerstaff1-1/+5
2013-12-22converted commneted paramater names to the unused macroTycho Bickerstaff1-1/+5
2013-12-21Piston is now warnings cleanTycho Bickerstaff1-1/+1
2013-11-30Changed cBlockHandler->OnUpdate() to use cChunk directly.madmaxoft1-3/+4
2013-11-30Properly fixed snow height, fixes #98 and #264Tiger Wang1-10/+17
2013-11-24Moved source to srcAlexander Harkness1-0/+0
2013-11-05Clarified cBlockHandler::ConvertToPickups() dox.madmaxoft1-1/+1
2013-09-15Removed leftover CanBePlacedOnSideTiger Wang1-3/+0
2013-09-15Removed leftover DoesAllowBlockOnTopTiger Wang1-4/+1
2013-07-29Changed everyting to Unix line endings.Alexander Harkness1-158/+158
2013-03-26BlockArea: Finished rotation and mirroring with meta. Implemented example meta handling for vines, stairs and torches.madmaxoft@gmail.com1-0/+15
git-svn-id: http://mc-server.googlecode.com/svn/trunk@1319 0a769ca7-a7f5-676a-18bf-c427514a06d6
2013-03-15Huge performance boost in blockhandlers, they have direct access to chunk data when blockchecking.madmaxoft@gmail.com1-4/+5
Also fixed vines' placement. git-svn-id: http://mc-server.googlecode.com/svn/trunk@1278 0a769ca7-a7f5-676a-18bf-c427514a06d6
2013-01-27Added the HOOK_BLOCK_TO_PICKUPS hook that fires when a block is dug up and should be converted to pickups.madmaxoft@gmail.com1-2/+2
Note that cItems is used in the function signature but not yet exported in the API, TODO! git-svn-id: http://mc-server.googlecode.com/svn/trunk@1176 0a769ca7-a7f5-676a-18bf-c427514a06d6
2013-01-12Merged branch "branches/hooks" into "trunk".madmaxoft@gmail.com1-10/+24
git-svn-id: http://mc-server.googlecode.com/svn/trunk@1139 0a769ca7-a7f5-676a-18bf-c427514a06d6
2012-10-23New Block property g_BlockIsSolid[]; Fixed ladder, torches and vines placement. (Patch contributed by funmaker)luksor111@gmail.com1-1/+1
git-svn-id: http://mc-server.googlecode.com/svn/trunk@1005 0a769ca7-a7f5-676a-18bf-c427514a06d6
2012-10-14Floody fluid simulator now dries up correctly, too.madmaxoft@gmail.com1-0/+6
git-svn-id: http://mc-server.googlecode.com/svn/trunk@964 0a769ca7-a7f5-676a-18bf-c427514a06d6
2012-10-03Moved blockticking into blockhandler classes.madmaxoft@gmail.com1-18/+19
Also slightly refactored the variable / argument names (BlockID is deprecated, use BlockType instead) git-svn-id: http://mc-server.googlecode.com/svn/trunk@921 0a769ca7-a7f5-676a-18bf-c427514a06d6
2012-10-01Slight refactoring of BlockHandlers - dropping unneeded virtual functionsmadmaxoft@gmail.com1-42/+73
( http://forum.mc-server.org/showthread.php?tid=434&pid=4734#pid4734 ) git-svn-id: http://mc-server.googlecode.com/svn/trunk@917 0a769ca7-a7f5-676a-18bf-c427514a06d6
2012-09-29Unified folder name-casingmadmaxoft@gmail.com1-0/+0
git-svn-id: http://mc-server.googlecode.com/svn/trunk@902 0a769ca7-a7f5-676a-18bf-c427514a06d6
2012-09-24Source files cleanup: The rest of the files renamed.madmaxoft@gmail.com1-0/+0
git-svn-id: http://mc-server.googlecode.com/svn/trunk@887 0a769ca7-a7f5-676a-18bf-c427514a06d6
2012-09-11Merged in a patch for sounds by l0udPLmadmaxoft@gmail.com1-1/+2
http://forum.mc-server.org/showthread.php?tid=434&pid=4564#pid4564 git-svn-id: http://mc-server.googlecode.com/svn/trunk@858 0a769ca7-a7f5-676a-18bf-c427514a06d6
2012-08-22Added a documentation for block and item handlerslapayo94@gmail.com1-6/+29
Probably fixed dependencies on cWebPlugin_Lua Fixed VC2010 Project file git-svn-id: http://mc-server.googlecode.com/svn/trunk@778 0a769ca7-a7f5-676a-18bf-c427514a06d6
2012-08-19Fixed Bug #236lapayo94@gmail.com1-1/+2
Workbench, Chest and Furnace are usable again git-svn-id: http://mc-server.googlecode.com/svn/trunk@755 0a769ca7-a7f5-676a-18bf-c427514a06d6
2012-08-06A bit of cleanup and documentation around the UI window handlingmadmaxoft@gmail.com1-12/+21
git-svn-id: http://mc-server.googlecode.com/svn/trunk@716 0a769ca7-a7f5-676a-18bf-c427514a06d6
2012-08-06BLOCKTYPE signedness change - fixed more detailsmadmaxoft@gmail.com1-1/+1
git-svn-id: http://mc-server.googlecode.com/svn/trunk@713 0a769ca7-a7f5-676a-18bf-c427514a06d6
2012-07-16Some code improvementslapayo94@gmail.com1-6/+5
git-svn-id: http://mc-server.googlecode.com/svn/trunk@677 0a769ca7-a7f5-676a-18bf-c427514a06d6
2012-07-16Fixed some small bugs :)lapayo94@gmail.com1-0/+3
git-svn-id: http://mc-server.googlecode.com/svn/trunk@672 0a769ca7-a7f5-676a-18bf-c427514a06d6
2012-07-15A new Block handling system :olapayo94@gmail.com1-0/+54
It was really a lot of work :D Took me the complete weekend :D Would really like to here your opinion on this =) The aim of this is to put all the actions for one block in one place so it is not spread around the source. (ToPickup, Action in cWorld, Action in cChunk, Action here, action there :D) git-svn-id: http://mc-server.googlecode.com/svn/trunk@671 0a769ca7-a7f5-676a-18bf-c427514a06d6