Commit Graph

48 Commits

Author SHA1 Message Date
bfce478e72 BlockFactory: keep the generic types for PHPStan, which actually understands it 2020-02-07 20:10:40 +00:00
495bfda044 Drop a bunch of invalid null defaults
phpstan doesn't report these out of the box, for reasons I'm not clear on. It's also not clear if having null defaults has any effect on nullability behaviour, so they are best removed. In addition, these would be problematic on 7.4.
2020-02-05 20:53:54 +00:00
3f7e7352fb added SplFixedArray generics for phpstan 0.12.9 2020-02-05 11:57:37 +00:00
9f44adf04a pass 2, manual removal of incorrect non-nullable @param for nullable native types 2020-01-21 15:44:34 +00:00
c4793241f5 Mass removal of useless @param/@return PHPDoc annotations, pass 1 2020-01-21 15:10:18 +00:00
8e9f787d33 Implement runtimeID table randomization, closes #2841 2019-03-29 14:35:06 +00:00
372545e47e Merge branch '3.5' into 3.6 2019-02-12 16:56:53 +00:00
8913b48700 "Implement" info-update and reserved6 2019-02-12 16:56:12 +00:00
6ee4a0e090 Implement invisible bedrock to fix placement issues
I don't know why this wasn't done a long time ago, but here it is.
2019-02-12 16:41:23 +00:00
b8703d5dff Protocol changes for 1.9.0 2019-02-07 21:56:42 +00:00
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
09985c5763 Fixed async light population producing garbage when generator isn't registered, closes #2488 2018-10-24 15:49:00 +01:00
45c9caa38c Fixup some formatting issues 2018-10-21 18:15:25 +01:00
986077e03c Protocol changes for 1.6.0.1 2018-08-21 17:14:53 +01:00
d8cf835f92 BlockFactory: better handling for dodgy IDs
I thought I'd already dealt with this, but it seems not.
2018-07-13 12:31:22 +01:00
41a179e6e1 BlockFactory: fix bug in light filters which could result in negative light levels (and therefore wraparounds) 2018-06-05 18:12:45 +01:00
ec28612a12 BlockFactory: partial revert of 515e4aabc4
it's necessary to register these to fill the static property arrays. Someday these won't be necessary I hope...
2018-06-01 17:08:58 +01:00
d535fe20a3 BlockFactory: split up static ID mapping registration from other things
this is actually HUGELY WASTEFUL on memory. An average of 3 MB is wasted per AsyncWorker on this.
2018-06-01 10:28:53 +01:00
515e4aabc4 BlockFactory: minor reduction in memory usage
removing useless array and don't pre-populate with UnknownBlock objects
2018-06-01 10:15:20 +01:00
aa6666872a BlockFactory: added a hack for weird air blocks with non-zero damage values
I don't know what causes this to occur, but they should never have non-zero damage values, so we discard the metadata.
2018-04-09 16:35:31 +01:00
5b7b2dd0e2 Merge changes from ALPHA11 for 1.2.13 2018-04-04 11:31:39 +01:00
a1cf5dbd1e fix doc inconsistency 2018-04-04 11:01:14 +01:00
c86132028e BlockFactory: add new "dynamic" fake runtime IDs for unknown legacy ID/meta combinations
This is basically how blockstate discovery would actually work in the full-blown system. This maps blocks with unrecognized blockstates to static runtimeIDs not known to the client.

This means that all blocks which don't have corresponding runtimeIDs in the new system will translate to update! blocks instead.

Mojang do this differently: they try to a) match id+meta, if that fails b) match id+0, and if that fails, then replace with update! block runtime ID. I can't do that here because I need to be able to convert both ways. They only need to be able to convert from legacy -> new.
2018-04-04 11:00:58 +01:00
5ce55bd3b0 duct tape for block ID remapping 2018-04-04 11:00:39 +01:00
af2435f199 Removed redundant checks from ItemFactory::init() and BlockFactory::init()
These are never called accidentally, or at least it's highly unlikely to do so. It might be reasonable to throw exceptions for this, but for the meantime they are redundant - extra indentation for no good reason.

This also removes the $force parameter from BlockFactory::init().
2018-02-15 17:42:03 +00:00
a84aba5517 Replaced some bad usages of Vector3 get*() with their respective getFloor*() 2018-02-14 18:45:10 +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
686e1c4470 Implement ender chest (#1462) 2017-11-22 14:25:21 +00:00
2794df34ab Basic implementation of banners, including API to modify them with ease. (#1331)
Banner crafting is NOT implemented yet.
2017-11-15 11:10:46 +00:00
5c92c8a9d3 added red sandstone and red sandstone stairs 2017-10-18 19:42:12 +01:00
d2dc49cd9c Refactor Slab logic away from WoodenSlab, added StoneSlab2 and its double 2017-10-18 19:27:54 +01:00
eeea4fa06a Added some new blocks 2017-10-13 11:51:38 +01:00
3eb73ab468 Abstracted Fence code away from wooden fences 2017-10-12 17:04:49 +01:00
d8b1757ebc added some nullable and void typehints to Block API 2017-10-11 18:45:40 +01:00
2be8b576ef Changed constructor of ItemBlock to allow handling blocks with different item IDs, added more doors 2017-10-09 11:58:58 +01:00
c79a5509f6 Implemented concrete powder
this is a little buggy with water updating due to a hack for liquids to fix a CPU leak (210bdc2436), but everything works fine when a block nearby gets updated.
2017-09-26 18:56:43 +01:00
f5b0cbb337 Generated some TODOs for BlockFactory & ItemFactory 2017-09-26 16:15:35 +01:00
5aba87b250 Added brown and red mushroom blocks 2017-09-21 14:07:51 +01:00
07268e4b37 Added API methods to determine if a block or item is already registered 2017-09-11 16:22:55 +01:00
6abef6b22d Made block and item factory lists private to stop people doing stupid things with them 2017-08-29 10:53:01 +01:00
37b050f864 Return an UnknownBlock if the BlockFactory hasn't been initialized yet 2017-08-28 17:07:39 +01:00
9e142655ea Removed redundant count parameter from item constructors, added some documentation and tightened safety checks
the count parameter is useless since Item ctor should now only be used for constructing item _types_, not actual items. All item creations for inventories etc, should go through the ItemFactory.
2017-08-25 19:06:23 +01:00
1fec16f167 Fix Block::get() regression introduced in 02f42eba 2017-08-25 18:15:53 +01:00
cd7724d94a Added concrete 2017-08-25 13:13:11 +01:00
76e213ae73 Cleaned up shared rotation code, fixed quartz pillar rotation, added bone blocks 2017-08-25 13:06:16 +01:00
0712979908 Fixed blastResistance array not being initialized 2017-08-22 19:45:53 +01:00
8a35b9da29 Added some documentation 2017-08-22 10:28:43 +01:00
02f42eba48 Move block registration to its own class 2017-08-20 18:05:01 +01:00