summaryrefslogtreecommitdiffstats
path: root/src/Blocks/BlockBed.cpp (unfollow)
Commit message (Collapse)AuthorFilesLines
2021-05-05Move item placement into item handlers (#5184)Tiger Wang1-16/+0
* Move item placement into item handlers + Add appropriate CanBeAt checks in cPlayer::PlaceBlocks, into which all placement handlers call. * Partly addresses #5157 * Fixes #4878 * Fixes #2919 * Fixes #4629 * Fixes #4239 * Fixes #4849 Co-authored-by: changyong guo <guo1487@163.com> Co-authored-by: Xotheus <shady3300@outlook.com> Co-authored-by: Krist Pregracke <krist@tiger-scm.com> * Review fixes * Update APIDesc.lua * Rename Co-authored-by: changyong guo <guo1487@163.com> Co-authored-by: Xotheus <shady3300@outlook.com> Co-authored-by: Krist Pregracke <krist@tiger-scm.com>
2021-05-03Add player statistics to API (#5193)nshah251-1/+1
* Fixed issue #5166 Co-authored-by: 12xx12 <44411062+12xx12@users.noreply.github.com> Co-authored-by: Tiger Wang <ziwei.tiger@outlook.com>
2021-04-30Chest, weather, crash, and miscellaneous fixes (#5215)Tiger Wang1-0/+1
* Alpha-sort cChestEntity * Chests: use SendUpdateBlockEntity * Pathfinder: fix out of range Y * 1.13: correct weather packet ID * Chests: fix neighbour scanner + Add OnAddToWorld and overload to scan neighbours there, instead of in the constructor/OnUse. This fixes hoppers accessing newly loaded double chests and seeing a null m_Neighbour, thus thinking its a single chest. * Fix typo in cross coords computation. * Simplify hopper logic. * Block entities: ASSERT that type is correct If you match the block type first before calling DoWithBlockEntity, the corresponding block entity must either be empty or correspond to the block type. * Chunk: fix some forgotten PendingSendBE cleanup + Add cleanup in SetAllData, WriteBlockArea - Remove RemoveBlockEntity (used once), HasBlockEntity (not used) * Replace MakeIndex with MakeIndexNoCheck * Remove extraneous MarkDirty in hopper & chests
2021-04-12Improve bed handling robustnessTiger Wang1-60/+49
+ Boot the player out if the bed was destroyed
2021-04-12Fix sending incorrect date values on world changeTiger Wang1-2/+2
Yak shave: make more things use cTickTime. Fix a couple of incorrect modulo-on-millisecond-value by making them use WorldTickAge.
2021-03-28Do not fake a tool when converting to pickups (#5170)Tiger Wang1-1/+1
* When the cause of destruction was world-induced (CanBeAt check failed) there is no tool. Pass the nullptr directly to ConvertToPickups and let it handle it. * Fixes #4795 - Remove unused a_Digger parameter to ConvertToPickups.
2021-03-28Unify DoWithBlockEntity (#5168)Tiger Wang1-6/+6
+ DoWith calls now broadcast the block entity and mark the chunk dirty + Add block entity change queue to synchronise BE updates with block updates * Fixed a few incorrect assertions about BE type - Remove manual overloads
2020-10-08Merged OnBreak with OnPlayerBreak (#4967)12xx121-1/+3
Co-authored-by: 12xx12 <12xx12100@gmail.com> Co-authored-by: Tiger Wang <ziwei.tiger@outlook.com>
2020-09-25Unify block entity pickup conversionTiger Wang1-7/+3
- Removed normal BlockHandler knowledge of block entities during conversion + Added cBlockEntity::ConvertToPickups that handles it
2020-09-20BlockHandler initialisation is a constant expression (#4891)Tiger Wang1-4/+4
* 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-05Add more statistic tracking (#4837)12xx121-0/+1
+ Added possible 1.8 stats + Added stat tracking for 1.8.2 + Added stat tracking for 1.9 + Added the breed cow achievement Co-authored-by: 12xx12 <12xx12100@gmail.com>
2020-08-05Update bed behavior (#4545)Mat1-7/+24
2020-05-15Enable some more clang-tidy linter checks (#4738)peterbell101-5/+1
* Avoid inefficient AString -> c_str() -> AString round trip * Avoid redundant string init expressions * Avoid unnecessary return, continue, etc. * Add .clang-format to help with clang-tidy fix-its * Avoid unnecessary passing by value * Avoid unnecessary local copying * Avoid copying in range-for loops * Avoid over-complicated boolean expressions * Some violations missed by my local clang-tidy * Allow unnecessary continue statements * Add brackets * Another expression missed locally * Move BindingsProcessor call into clang-tidy.sh and add space * Fix pushd not found error * Different grouping of CheckBlockInteractionRate
2020-04-21Vector3 in Handlers (#4680)Mattes D1-68/+82
Refactored all cBlockHandler and cItemHandler descendants to use Vector3.
2020-04-03New hotfix to prevent calling OnBroken (#4600)Alexander Harkness1-8/+8
* Fix stack overflow in breaking ice. Stupid fix, but it does work and is used in other places too... * Replace hotfix for pistons with better one * Fix comments in BlockBed handler
2019-10-28Moved growing from cWorld / cChunk to cBlockHandler descendants.Mattes D1-2/+2
2019-10-16Refactored block-to-pickup conversion. (#4417)Mattes D1-22/+18
2018-08-29Force all headers other than "Globals.h" to be included with relative paths (#4269)peterbell101-1/+1
Closes #4236 CMake now creates a header file in the build directory under the path "include/Globals.h" which just includes "src/Globals.h" with an absolute path. Then instead of adding "src/" to the include directories, it adds "include/". #include "Globals.h" still works by including the build generated file and any other src-relative path will not work.
2018-07-24Broadcast refactor (#4264)peterbell101-2/+2
* Move Broadcast functions from cChunkMap to cBroadcaster - Remove cBroadcastInterface in favour of cBroadcaster. - cChunk: Remove broadcast functions. * resurect broadcast interface * Absorb cBroadcaster into cWorld. Removes the need for forwarding the function calls. * Improve const-correctness * Use Int8 instead of char + Comment `ForClients` functions * Improve comments * Broadcaster: Rename ForClients functions
2017-11-20cChunkInterface GetBlock, GetBlockMeta, GetBlockTypeMeta use vectors (#4050)Bond-0091-6/+5
2017-09-19Removed UTF-8 BOM (#4033)Lukas Pioch1-1/+1
2017-09-11Replace ItemCallbacks with lambdas (#3993)peterbell101-95/+35
2017-09-02Revert "Replace ItemCallbacks with lambdas (#3948)"LogicParrot1-35/+95
This reverts commit 496c337cdfa593654018c171f6a74c28272265b5.
2017-09-01Replace ItemCallbacks with lambdas (#3948)peterbell101-95/+35
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-02Removed double includes (#3885)Lukas Pioch1-1/+0
2017-08-01cBlockHandler: take player by refpeterbell101-14/+14
2017-07-07Added bed entity (#3823)Lukas Pioch1-2/+60
* 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-02You can't use beds when there are hostile mobs nearbyBond_0091-8/+32
2015-12-13allow use failures to propagate from the entity/block to the playerGargaj1-1/+2
2015-05-16Bed uses bottom two bits for direction not threeworktycho1-2/+2
2015-03-05Reverted non-functional changesTiger Wang1-5/+8
2015-02-08Handle client 'leave bed' requestTiger Wang1-17/+10
* Fixes #1728
2014-12-24Refactored all player block placing to go through hooks.Mattes D1-19/+1
Fixes #1618.
2014-09-26Removed more unessicary includesTycho1-0/+9
2014-09-12Fixed farmland issues.Howaner1-1/+1
2014-07-21Style: Normalized to no spaces before closing parenthesis.madmaxoft1-2/+2
2014-07-19Fixed style: spaces after commas.madmaxoft1-1/+1
2014-07-17Basic style fixes.madmaxoft1-2/+2
2014-07-17Normalized comments.madmaxoft1-4/+4
This was mostly done automatically and then visually inspected for obvious errors. All //-style comments should have a 2-space separation from the code, and 1 space after the comment sign.
2014-06-01Implemented bed homesTiger Wang1-0/+2
+ Implemented bed home positions * Fixed some inventory and health server/client mismatches after world change
2014-05-29Very minor code changesTiger Wang1-1/+1
2014-03-09Fixed VERIFYTiger Wang1-1/+1
2014-03-09Beds now work properly fixes #707Tiger Wang1-7/+66
Also fixes FS392 Conflicts: src/Blocks/WorldInterface.h src/ClientHandle.cpp
2014-02-23Fixed Formatting, Added DropChances and CanPickUpLoot attributes to MonstersTheJumper1-1/+1
2014-02-23BlockBed.cpp: Fixed Multiple people in one bed.TheJumper1-7/+18
OnUse in BlockBed.cpp now checks whether bit flag 0x4 in the Data values of the bed is set before somebody can try to sleep in the bed.
2014-02-20BlockBed.cpp: Fixed space at if statementTheJumper1-1/+1
Added a space after an if statement and before the first bracket to keep up code conventions.
2014-02-20BlockBed.cpp: Fixed Multiple people in one bed.TheJumper1-7/+18
OnUse in BlockBed.cpp now checks whether bit flag 0x4 in the Data values of the bed is set before somebody can try to sleep in the bed.
2014-02-06Server internally uses new functionsTiger Wang1-1/+1
2014-02-04Improved Type safety of eBlockFaceTycho1-2/+2
May Fix #640
2014-02-01Changed pointers to referencesTycho1-16/+16
2014-02-01Changed signitures of Several BLockHandler MethodsTycho1-1/+1
Changed the signitures of the following to use interfaces: GetPlacementBlockTypeMeta OnPlaced OnPlacedByPlayer OnDestroyed OnNeighbourChanged NeighbourChanged OnUse CanBeAt Check
2014-01-26Refactored cBlockHandler::OnUse and dependentsTycho1-5/+5
2014-01-25First attempt at Implementing InterfacesTycho1-16/+16
2013-11-24Moved source to srcAlexander Harkness1-0/+0
2013-09-07Renamed cWorld::DoExplosiontAt() to cWorld::DoExplosionAt()madmaxoft1-1/+1
2013-08-09Added OnExploding() and OnExploded() hooks.madmaxoft1-3/+6
As requested in FS 413, with extra parameters: World, BlockX, BlockY, BlockZ, Size, CanCauseFire, Source, SourceData OnExploding() can return 3 values: StopHook, CanCauseFire, ExplosionSize
2013-07-29Changed everyting to Unix line endings.Alexander Harkness1-85/+85
2013-06-15Fixed compilation on linux.nielsbreu@gmail.com1-1/+1
Any idea why SendMessageA works on Windows and not on linux? git-svn-id: http://mc-server.googlecode.com/svn/trunk@1595 0a769ca7-a7f5-676a-18bf-c427514a06d6
2013-06-15You can only sleep when the time is day, and beds explode if the dimension is not Overworld.nielsbreu@gmail.com1-11/+21
git-svn-id: http://mc-server.googlecode.com/svn/trunk@1592 0a769ca7-a7f5-676a-18bf-c427514a06d6
2013-01-12Merged branch "branches/hooks" into "trunk".madmaxoft@gmail.com1-20/+12
git-svn-id: http://mc-server.googlecode.com/svn/trunk@1139 0a769ca7-a7f5-676a-18bf-c427514a06d6
2012-10-03Moved blockticking into blockhandler classes.madmaxoft@gmail.com1-15/+21
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-09-29Forgot to commit BlockBed.cppfaketruth1-0/+77
git-svn-id: http://mc-server.googlecode.com/svn/trunk@913 0a769ca7-a7f5-676a-18bf-c427514a06d6