1
0
Commit Graph

57 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
Tiger Wang
429117c1f6 Doors: check power & toggle correctly
* Fixed upper half ignoring its updates
* Fixes #4945
* Fixed doors playing sound effects when they didn't actually toggle
2020-09-28 23:40:19 +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
Tiger Wang
71ba18d6c6 Door drops respect player gamemode
* Rely on caller to handle converting to pickups, all OnBroken needs to do is to maintain the unity of the door
* Fixes #4797
* Fixes #4796
2020-08-04 18:15:18 +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
8914355895 Fix rotation metas on blocks 2020-04-11 19:00:05 +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
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
peterbell10
ee84197014
Force all headers other than "Globals.h" to be included with relative paths (#4269)
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-08-29 01:51:25 +01: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
Lane Kolbly
5402b214b3 Check for intersection between placed blocks and entities. (#3850)
* 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-28 17:59:21 +01:00
LogicParrot
ca6ef58b1e Bulk clearing of whitespace 2016-02-05 23:50:18 +02: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
mmdk95
c12704183b Fix duping doors (#1327) 2015-07-14 18:42:40 +02:00
Lane Kolbly
dafdded7d9 Fixed typo in BlockDoor.h 2015-06-13 08:00:20 -05:00
tycho
dae9e5792a Made -Weverything an error. 2015-05-24 12:56:56 +01:00
wraith11
794013315b Fix door placing in connection with slabs
Except top-half slabs as transparent blocks for doors.
2015-04-21 20:47:02 +02:00
Mattes D
9e478c6f29 Fixed door placement. 2014-12-25 01:00:51 +01:00
Mattes D
ccdf03daaf Refactored all player block placing to go through hooks.
Fixes #1618.
2014-12-24 07:20:17 +01:00
Howaner
7d3016c7ad Code improvements 2014-09-30 20:59:59 +02:00
Howaner
5111628ba5 Fixed 1.8 doors. 2014-09-30 19:49:42 +02:00
Masy98
6dd47e783a Added default value to switch and spruce gate to fence gate handler 2014-09-27 15:11:35 +02:00
Masy98
30f9a4d3ab Fixed convertToPickups for doors 2014-09-27 14:19:45 +02:00
Tycho
a3f940f47c Removed more unessicary includes 2014-09-26 18:13:19 +01:00
Masy98
6cc4ac0bca Removed old sound-configuration for doors 2014-09-09 16:28:08 +02:00
madmaxoft
5e198c6730 Basic style fixes. 2014-07-17 22:50:58 +02:00
Tycho
84c83e0deb Fix a few warnings 2014-06-16 15:03:07 +01:00
madmaxoft
2b45e720ad Added Y coord checks and documentation to cBlockDoorHandler. 2014-06-09 21:35:46 +02:00
Howaner
683da71c0f Moved the IsDoor check before the meta get. 2014-05-31 11:48:54 +02:00
Howaner
0b7ed0f493 Add doxy-comment 2014-05-31 11:47:03 +02:00
Howaner
d8e16f8c1f Better SetOpen() and IsOpen() function from the doors. 2014-05-30 22:22:42 +02:00
Howaner
b4ba220934 Add SetOpen() and IsOpen() to BlockDoor.h and fix door redstone bug. 2014-05-29 19:21:56 +02:00
narroo
3df4f8609d Fixed spelling; Rotater to Rotator. 2014-03-25 17:26:13 -04:00
narroo
2343b0dfbe Added MetaRotate/Mirror Support for a number of classes. 2014-03-23 22:11:01 -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
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
5093b75ef1 Revesed typedef 2014-03-01 10:14:24 -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