1
0
Fork 0
Commit Graph

42 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
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 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
Tiger Wang 4e5ab02a58 Use SimulateChunk in redstone simulator
+ Improved performance, reduces bottleneck in chunkmap lookup
* Stop allocating and throwing away lots of small vectors in Update/GetValidSourcePositions return values
- Remove unused GetPowerLevel virtual
2020-07-26 14:16:46 +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
Alexander Harkness f40aba941e Add mixins for blocks that rotate based on player yaw at placement
Also add observer block handler.
2020-04-10 13:07:16 +00:00
Mat 0d0d019bbe
Fix certain item drops (#4536)
* Fix certain item drops

* Revert unwanted changes

* Revert unwanted changes

* Revert change

* Style fixes
2020-03-23 22:07:08 +02:00
Mattes D 221cc4ec5c
Refactored block-to-pickup conversion. (#4417) 2019-10-16 10:06:34 +02: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 8eb5672920 cWorld::SendBlockTo take player by ref 2017-08-01 08:21:20 +02:00
Tiger Wang d46f7ce2c8 Redstone fixes (#3285)
* Comparators and pistons no longer update instantly
* Fixes #3168.
* Consolidated comparator code
* As a result, fixed an issue where GetPowerLevel didn't consider block
entities behind it (only GetFrontPowerLevel did)
2016-07-31 21:54:35 +01:00
Mattes D a3112cdc45 Revert "Redstone fixes" 2016-07-29 07:56:50 +02:00
Tiger Wang 62090e7bed Consolidated comparator code
* As a result, fixed an issue where GetPowerLevel didn't consider block
entities behind it (only GetFrontPowerLevel did)
2016-07-28 23:20:53 +01:00
Tiger Wang 04cc8aa0f5 Comparators and pistons no longer update instantly
* Fixes #3168.
2016-07-28 23:20:52 +01:00
LogicParrot ca6ef58b1e Bulk clearing of whitespace 2016-02-05 23:50:18 +02:00
Tiger Wang 5b62c4c314 Reorganised the redstone simulator
-> Many thanks to @worktycho for the idea, and @Haxi52 for the implementation plan!
* Uses classes and inheritance now
* Speed should be improved
2015-12-18 13:17:38 +00:00
Gargaj f9008a4860 allow use failures to propagate from the entity/block to the player 2015-12-13 13:27:38 +01:00
Tiger Wang 8656e149c8 Improved maps 2015-07-14 21:46:30 +01:00
Tiger Wang de5b1401f8 Comparators 2015-06-06 12:21:09 +01:00
Mattes D c13b1931ff More style checking.
Spaces around some operators are checked.
2015-05-09 12:58:54 +02:00
Masy98 acae3c9c65 Moved sound-configs into BlockID.h and fixed/ added loads of sounds 2014-09-09 16:00:26 +02:00
madmaxoft 2423fbf2ef Normalized comments.
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-07-17 22:15:34 +02:00
narroo 3df4f8609d Fixed spelling; Rotater to Rotator. 2014-03-25 17:26:13 -04:00
Mattes D 3a6499b192 Merge pull request #729 from worktycho/MetaRotate
Alternitive solution to #503
2014-03-08 18:27:24 +01: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
Tycho a38be148ba Reformatted 2014-03-02 12:33:08 -08:00
Tycho 65edffd5b0 Implemented Rotations 2014-03-01 10:04:50 -08:00
Tycho 84913299f4 Added some Metadate rotaters using templated Mixin 2014-02-27 11:33:35 -08:00
Tycho 8464f689ea Improved Type safety of eBlockFace
May Fix #640
2014-02-04 10:59:05 -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 15b92af166 First attempt at Implementing Interfaces 2014-01-25 11:14:14 -08:00
madmaxoft aec5200893 Removed internal cEntity::GetRot() usage. 2014-01-17 11:11:17 +01:00
Tiger Wang 74645fdfaa Removed obsoleted functions 2014-01-16 19:00:49 +00:00
Tiger Wang cee5160be8 Removed unneeded CPP files
Also removed unneeded #include in BlockStems
2013-11-29 22:25:07 +00:00
Alexander Harkness 675b4aa878 Moved source to src 2013-11-24 14:19:41 +00:00