Commit Graph

41 Commits

Author SHA1 Message Date
4b9a142a5d Import global functions and constants for enhanced performance
This is better for performance because these then don't need to be reevaluated every time they are called.

When encountering an unqualified function or constant reference, PHP will first try to locate a symbol in the current namespace by that name, and then fall back to the global namespace.
This short-circuits the check, which has substantial performance effects in some cases - in particular, ord(), chr() and strlen() show ~1500x faster calls when they are fully qualified.

However, this doesn't mean that PM is getting a massive amount faster. In real world terms, this translates to about 10-15% performance improvement.
But before anyone gets excited, you should know that the CodeOptimizer in the PreProcessor repo has been applying fully-qualified symbol optimizations to Jenkins builds for years, which is one of the reasons why Jenkins builds have better performance than home-built or source installations.
We're choosing to do this for the sake of future SafePHP integration and also to be able to get rid of the buggy CodeOptimizer, so that phar and source are more consistent.
2019-01-04 20:43:15 +00:00
e66b1953de Block: added flame encouragement and flammability properties 2018-04-10 09:58:08 +01:00
86eee429bb Block: Split onUpdate() into several functions, removed Level::BLOCK_UPDATE_* constants
This allows the removal of lots of ugly code, and also exposes lots of similarities with how this update type was handled. This can be further improved in the future to more generically handle cases.

I realized in the process of changing this, that it might actually be simpler to treat to treat scheduled updates and neighbour updates as one and the same. They use the same mechanism for being saved on chunks (TileTicks),
and doing that would make updating only require one queue instead of two.

RedstoneOre: use onActivate() to trigger glowing
this is not technically correct behaviour, but this preserves the current behaviour.
2018-03-13 17:29:46 +00:00
4f8e4f0522 Add EOF newlines where missing (bulk) (#1836)
This should solve issues with people making GitHub PRs and having the web editor messing things up. GitHub Web Editor sucks :(
2017-12-20 11:56:36 +00:00
717b36a983 Cleaned up non-trivial getDrops() stuff 2017-12-13 14:47:50 +00:00
56f1a6ba37 Block: Migrated all trivial drops code to getDropsForCompatibleTool()
getDrops() should now be overridden only for special cases. There are some non-trivial overrides left that are going to need some extra work to clean up.
2017-12-13 12:49:58 +00:00
55d0684565 Move block-breaking tool-type constants to a BlockToolType interface 2017-12-12 13:45:52 +00:00
74b074753f Bulk addition of constant visibilities
thanks PhpStorm inspections plugin for annoying the shit out of me until
I did this.
2017-11-21 14:44:10 +00:00
d1db27016e s/facePos/clickVector/
clickVector better describes this
2017-10-27 19:05:26 +01:00
9413f155ce implement updating properly for multi-face vines 2017-10-12 10:21:08 +01:00
6569fdbe04 Refactor some variable names in Vine 2017-10-11 20:12:12 +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
8ce833bf74 Stripped redundant trailing commas 2017-08-25 12:41:49 +01:00
ebda6ec19b Cleaned up random-block-ticking registration 2017-08-25 11:47:38 +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
d358e13868 Strict type all the things and fix lots of assorted bugs exposed by strict types (#993)
Strict type all the things
2017-06-08 11:21:51 +01:00
1f630e57f2 Fixed vine block update crashes, close #1032
The meta->side array was the wrong way round (keys & values inverted).
2017-06-08 09:32:38 +01:00
51b0673b4b Bite the bullet and enable strict types on everything 2017-06-07 12:53:16 +01:00
66924729ff Fixed climbing blocks such as ladders and vines
Seems we can now climb ANY block if the climbing flag is true, and nothing if false. This commit adds local block checks to see if a climbable block exists at the entity's feet and if so, sets the flag.
2017-04-14 19:02:53 +01:00
f12a6eed29 Fixed vine block placement 2017-04-14 18:25:50 +01:00
9004417456 Fixed file headers (#255) 2017-01-13 16:57:05 +00:00
aa8a13c4a3 Fix a bunch of block update bugs due to ancient code 2016-12-16 17:08:38 +00: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
ac4194eb3f Added lily pad, checked some bounding boxes 2015-06-05 13:58:59 +02:00
116ede3679 Improved flight detection, added Entity->resetFallDistance(), closes #2632 2015-02-15 17:40:17 +01:00
747f7685e7 Fix formatting issues due to bad IDE settings 2014-12-07 16:30:04 +01:00
a98da3bab1 Renamed old getID() calls to getId() 2014-12-07 15:21:32 +01:00
af82d616c1 Block creating and property handling rewrite, part2 2014-12-07 02:20:26 +01:00
a0d4bff385 Block creating and property handling rewrite, part1 2014-12-07 01:53:27 +01:00
8601405a88 Fixed CPU leak 2014-10-31 21:07:00 +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
1eec333501 Save block bounding boxes, improves block cache 2014-10-13 18:38:00 +02:00
0af3dfedd5 Improved Living entity ticking 2014-10-11 17:35:13 +02:00
62af784d37 Removed unused imports 2014-10-08 17:00:23 +02:00
b83c6fbfa3 Added Vine blocks, closes #2162 2014-10-07 10:18:02 +02:00