Commit Graph

57 Commits

Author SHA1 Message Date
d679fb7546 Block: Rename onActivate() -> onInteract() 2019-02-28 17:35:30 +00:00
0f7f5362b8 Revert "Block: Get rid of state bitmasks"
This reverts commit b7b05e729e.

Apparently this was premature, because we still need these things to deal with default state remapping.
2019-02-24 18:30:18 +00:00
b7b05e729e Block: Get rid of state bitmasks
This story dates back to the days when getVariantBitmask() was introduced. The purpose of this function was to allow the variant info to be extracted from the metadata, for use with item drops. This was later changed to state bitmask for reasons I don't clearly recall.
In the great 4.0 refactor, we now store variant magic numbers separately, so we don't need any generic bitmask to split up variant and state information anymore. Variant is now only ever serialized and never deserialized. The same thing goes for blockIDs. States are read from the world by matching the full stateID against a table of prefilled known blocks, so the variant doesn't need to be deserialized - only the state does, and the state metadata readers already do bit fuckery by themselves and don't need this mask - notice how little actual changes were required to get rid of this?
2019-02-24 14:42:53 +00:00
a5c260352d Infect remaining places with PHP 7.1 nullable typehints 2019-02-22 12:16:45 +00:00
635fb5dde4 Clean up ID flattening hacks 2019-02-21 10:38:29 +00:00
a95ecb3ff9 FenceGate: implement in-wall checks 2019-02-18 19:00:58 +00:00
7b6d76871c Block: add face and clickVector to onActivate() parameters, closes #267
this is an old old old issue, i don't know why it wasn't addressed sooner.
2019-02-13 14:29:59 +00:00
78a80a6958 Tighten validity checks for block metadata
This filters out over 200 invalid states which were previously considered just fine, including zero-width cakes, buttons with broken facing values, furnace/chest with crazy values, and more.
2018-12-28 14:33:09 +00:00
20aaa8373a Sound no longer extends Vector3 2018-12-16 14:26:42 +00:00
39e383a175 Entity: add getHorizontalFacing(), clean up some boilerplate code 2018-12-05 20:27:43 +00:00
b2201c8c59 Further cleanup to general AABB handling 2018-11-24 19:17:03 +00:00
101de7adda Update Math dependency, obliterate some nasty code from Block 2018-11-23 19:41:52 +00:00
75f364fcf2 Level: Remove obsolete \$direct parameter from setBlock()
this parameter was previously used to send blocks with a different set of flags, immediately, to players. However, the flags have been demonstrated useless and the direct sending is pointless now since packets are buffered now per session, so we might as well take advantage of the batched block update sending.
2018-09-27 16:15:07 +01:00
56d9943b0d Nuke Block->meta, split into variant and state properties, lots of cleanup
This is a major change to the way block metadata is handled within the PM core. This separates variant metadata (which really ought to be part of the ID) from state metadata, and in a couple of cases flattens separate states of blocks together.

The result of this is that invalid variants can be much more easily detected, and additionally state handling is much cleaner since meta is only needed at the serialize layer instead of throughout the code.
2018-09-21 19:28:10 +01:00
1bb4daa7d1 Fixed mess of rotations being inverted 2018-09-16 17:37:36 +01:00
2b8405e6ee Make use of Bearing::opposite() 2018-09-13 19:35:47 +01:00
c0962a47be Block: Use parent::place() instead of setBlock() directly 2018-09-13 12:54:03 +01:00
f218868338 Separate facing/bearing handling from Vector3, deobfusticate a ton of @shoghicp old code 2018-09-05 19:56:14 +01:00
99a0c2a188 Block: Make recalculation of BB non-dependent on block position
This now computes BBs relative to 0,0,0 and then offsets them as appropriate. This requires less boilerplate code and also furthers the goal of separating block types from instances.
2018-06-21 19:58:28 +01:00
e66b1953de Block: added flame encouragement and flammability properties 2018-04-10 09:58:08 +01:00
55d0684565 Move block-breaking tool-type constants to a BlockToolType interface 2017-12-12 13:45:52 +00:00
d1db27016e s/facePos/clickVector/
clickVector better describes this
2017-10-27 19:05:26 +01:00
d8b1757ebc added some nullable and void typehints to Block API 2017-10-11 18:45:40 +01:00
6d5620606e Block->place() parameter refactor to make things clearer 2017-08-26 14:41:49 +01:00
e1d894057c Changed face position floating-point params to Vector3s 2017-08-20 10:23:34 +01:00
41c6cb6f97 Added Block->getVariantBitmask(0 to cut down on getDrops() boilerplate, fixed several blocks incorrectly retaining meta when broken 2017-08-18 19:49:28 +01:00
d8f0dd6db8 Changed Block->getDrops() to return Item[] 2017-08-18 11:21:33 +01:00
83af4dcd59 Block API typehints 2017-08-17 13:50:19 +01:00
6efa4343b1 Cleaned up fuel duration handling, fixed some fuel items not working in furnaces 2017-08-17 10:22:47 +01:00
3135fe3c69 Added API method Block->getItemId(), cleaned up excess wooden stairs and fence-gate classes, added more wooden door types 2017-08-04 13:02:24 +01:00
6ae24c5c19 Removed unnecessary methods Block->canBeActivated() and Item->canBeActivated() (needless extra confusion) 2017-07-30 18:14:43 +01:00
51b0673b4b Bite the bullet and enable strict types on everything 2017-06-07 12:53:16 +01:00
4ae18526d1 Fix fence gates opening in opposite direction to expected
This still occasionally occurs due to a bug that seems to exist with
entity rotation calculations. May happen at 45° 135° 225° and 315°
2017-02-22 09:46:54 +00:00
9004417456 Fixed file headers (#255) 2017-01-13 16:57:05 +00:00
bf4b96e144 Block: Fix fence gate rotation when opened or closed. TODO: fix gate opening direction 2016-09-28 13:59:52 +01:00
ccca3ec0bf FIxed a bug No sound for FenceGate
missing "use pocketmine\level\sound\DoorSound;"
2015-09-06 22:55:56 +09:00
311d8d94dd Added sound for opening/closing (FenceGates)
Added DoorSound on opening/closing FenceGates depending on #3367 @0929hitoshi 's Idea
2015-08-11 12:48:41 +02:00
0380e9009a Added block break tool type, fixed falling sand, fixed duplicated jungle leaves 2015-07-27 20:31:55 +02:00
26c9eed82e Added all block hardness 2015-07-27 20:31:55 +02:00
747f7685e7 Fix formatting issues due to bad IDE settings 2014-12-07 16:30:04 +01:00
a0d4bff385 Block creating and property handling rewrite, part1 2014-12-07 01:53:27 +01:00
545f68382c Increased Fence, Fence Gate and Stone Wall Y bounding box 2014-11-22 13:44:05 +01:00
522b75645c Merge branch 'master' into 0.10 2014-11-05 19:04:36 +01:00
8601405a88 Fixed CPU leak 2014-10-31 21:07:00 +01:00
4fba6d7c86 Merge branch 'master' into 0.10 2014-10-30 23:20:59 +01:00
289bc56b4b Blocks now save their bounding box, fixed entity block collision check 2014-10-29 15:43:23 +01:00
7abf52e615 Implemented Vector3 List and AxisAlignedBB Pool to decrease object allocation 2014-10-27 15:39:20 +01:00
d3327f450c Added different Fence Gates, new Fence Gate crafting recipes 2014-10-18 17:56:18 +02:00
1eec333501 Save block bounding boxes, improves block cache 2014-10-13 18:38:00 +02:00
e9a2f88847 Added Fire, Lava damage 2014-09-16 10:42:29 +02:00