1
0
Fork 0
Commit Graph

39 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
Tiger Wang 125df19477
Do not fake a tool when converting to pickups (#5170)
* 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-28 14:41:34 +01:00
12xx12 3381c0f6d6
Merged OnBreak with OnPlayerBreak (#4967)
Co-authored-by: 12xx12 <12xx12100@gmail.com>
Co-authored-by: Tiger Wang <ziwei.tiger@outlook.com>
2020-10-08 20:13:44 +01: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
KingCol13 8eca58a1c9
Fortune Drops (#4932)
+ 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-28 13:41:49 +01:00
Tiger Wang c53a0ba5f6 Unify block entity pickup conversion
- Removed normal BlockHandler knowledge of block entities during conversion
+ Added cBlockEntity::ConvertToPickups that handles it
2020-09-25 09:07:01 +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
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
Alexander Harkness b4aa19f329
Item durability loss now depends on the item used. (#4123)
Armour durability also no longer changes when it
is used to break blocks or attack mobs.

Fixes #4119
2018-01-05 11:28:06 +00:00
Bond-009 5badb9bcca cChunkInterface GetBlock, GetBlockMeta, GetBlockTypeMeta use vectors (#4050) 2017-11-20 11:13:11 +00:00
peterbell10 0d0323608d cBlockHandler: take player by ref 2017-08-01 08:21:20 +02:00
peterbell10 bbf5bec817 BigFlower fixes (#3826)
* BigFlowers fixes

* Correct upper part meta
* Documented parameters to DoesIgnoreBuildCollision
2017-07-07 16:37:53 +02:00
peterbell10 9201c7be7a Generated tall flowers have flower type meta in both blocks 2017-06-19 20:18:44 +02:00
dbhicks 8d5f01530d Double tall grass drops seeds when broken by water (#3763) 2017-06-14 14:23:33 +02:00
peterbell10 360d8eade0 FastRandom rewrite (#3754) 2017-06-13 21:35:30 +02:00
Lukas Pioch 36dea62662 Replace double grass and large fern with placed block 2017-04-06 11:14:27 +02:00
Altenius 0896b3b079 Changed big flowers so they don't need air above them. 2017-01-28 13:55:38 +01:00
Altenius 2d376304c2 Changed big flowers so they can only be placed on dirt 2017-01-28 13:55:38 +01:00
LogicParrot ca6ef58b1e Bulk clearing of whitespace 2016-02-05 23:50:18 +02:00
Tiger Wang 8656e149c8 Improved maps 2015-07-14 21:46:30 +01:00
Tommy Santerre 3f6d823aa4 Correct world height validations.
Unify the way we test block above the current one (Height - 1 instead of a_RelY + 1).
Allow generation of world of flat height = 255
2015-03-19 20:32:17 -04:00
Mattes D ccdf03daaf Refactored all player block placing to go through hooks.
Fixes #1618.
2014-12-24 07:20:17 +01: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
Howaner b5ffe06f88 Code formatting fixes. 2014-08-19 22:14:37 +02:00
Tiger Wang 3a6002de5b Fixed block drops
* Fixes #1242 (the issue addressed within)
2014-07-24 21:38:25 +01: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 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 0fb40da877 Change CanBeAt() from big flower 2014-04-03 21:53:18 +02:00
Howaner 736c7950a2 Add "a_RelY < cChunkDef::Height" to BlockBigFlower 2014-03-29 13:11:49 +01:00
Howaner a78bacac3c Add tallgrass drop to big flowers.
Add tallgrass drop, when a players break a tallgrass with the shear.
2014-03-28 23:14:58 +01:00
Howaner f2f6096ee5 door -> flower 2014-03-28 22:24:54 +01:00
Howaner efc89b2c43 Add tall flower handler. 2014-03-28 22:22:29 +01:00