1
0
Fork 0
Commit Graph

21 Commits

Author SHA1 Message Date
Tiger Wang a62b2b1be2
Move item placement into item handlers (#5184)
* 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-05 13:25:10 +00:00
peterbell10 a9031b6bae
Fix cmake not adding Werror on clang, and _lots_ of warnings (#4963)
* 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-10-05 10:27:14 +00:00
Tiger Wang 68cced73af
BlockHandler initialisation is a constant expression (#4891)
* 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-20 13:50:52 +00:00
morsmordere 60c10ef248
Cactus cannot be placed on a forbidden blocks (#4767)
Co-authored-by: Franklin T Kong <ftk@umich.edu>
Co-authored-by: aiugai <aiugai@umich.edu>

Fixes #4641

Overrode GetPlacementBlockTypeMeta for CactusBlock, which gets called before a player places the cactus block, so it returns true if the placement is allowed or false if not, in which case the cactus does not drop as a block but stays in the player's hand which is the expected behavior. Tested in Minecraft client 1.12.2.
2020-06-26 01:23:47 +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 9ee47e5999 Using Super. 2020-04-16 20:07:48 +00: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
Bond-009 f9b56dd859 Break the cactus block when it grows next to a block. (#3851) 2017-07-18 15:14:52 +02: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
Tiger Wang 8656e149c8 Improved maps 2015-07-14 21:46:30 +01:00
Masy98 acae3c9c65 Moved sound-configs into BlockID.h and fixed/ added loads of sounds 2014-09-09 16:00:26 +02:00
andrew d73cdba1f6 g_BlockXXX => cBlockInfo::XXX 2014-03-01 21:34:19 +02:00
Tycho b82fc394dd Changed Signiture of OnUpdate 2014-02-02 06:49:37 -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
STRWarrior 05c670dc50 Fixed cacus breaking when next to any non-air block. 2013-12-22 18:37:56 +01:00
madmaxoft 8610d45ef1 Fixed compiler warning when iterating over a fixed array of items (ARRAYCOUNT). 2013-12-20 16:01:34 +01:00
madmaxoft c70c2fa42f Changed cBlockHandler->OnUpdate() to use cChunk directly. 2013-11-30 15:58:27 +01:00
Alexander Harkness 675b4aa878 Moved source to src 2013-11-24 14:19:41 +00:00