Commit Graph

36 Commits

Author SHA1 Message Date
36cde9f352 inventory: populate missing return type information 2020-01-19 17:05:31 +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
5dbb0d177e Fixed double chest inventory desync issues, closes #2261 (#2279)
chest pairing really needs rewriting... this code really sucks
2018-07-05 17:42:30 +01:00
697723b551 DoubleChestInventory: remove redundant clear() override
this calls setItem() which deals with the necessary logic anyway.
2018-07-04 20:06:42 +01:00
5926d80525 DoubleChestInventory: fixed wrong logic for setting items into the right-hand side 2018-07-04 20:04:40 +01:00
30a83544a0 don't break double chests 2018-03-27 10:23:18 +01:00
3e35bc38e2 Inventory: Fixed crash when breaking right half of a double chest while open 2018-01-27 10:57:04 +00:00
b0d0932ed9 DoubleChestInventory: Fixed items getting rearranged in single chests when creating a double chest
I fixed this elsewhere more than 18 months ago, why is this still here?
2018-01-23 15:50:13 +00:00
1de7c5b114 Inventory: Added includeEmpty parameter to getContents() 2018-01-22 22:33:57 +00:00
2fb580db26 Inventory: Removed need for Inventory to have an InventoryHolder
Inventory holders are now freed from BaseInventory. They are now declared by subclasses by convention, but are not required in most cases.

Ideally, this would be followed by the removal of the need for inventories to know their holders at all. They should just be simple containers of items.

This fixes #1560 by removing FakeBlockMenu.
2018-01-22 19:44:52 +00:00
cc553a157d Clean up BlockEventPacket handling for Chests and fix wrong data for chest open 2017-10-13 20:07:33 +01:00
f01ce8e994 null and void typehints 2017-09-21 12:54:04 +01:00
4a1fc1bdf7 don't try to send contents during inventory construction 2017-09-20 10:18:24 +01:00
78d49f8e66 Merge branch 'php/7.0' into mcpe-1.2 2017-09-03 15:02:41 +01:00
0b83c61494 Fixed cyclic reference with chest tiles and DoubleChestInventory 2017-09-03 11:24:34 +01:00
260179197b Use SplFixedArrays in inventory, added more typehints and cleaned up some duplicated code 2017-08-09 13:12:07 +01:00
98e0a2ecba Removed InventoryType, added new inventory API methods 2017-08-07 11:31:36 +01:00
c3b8be3f60 and more typehints 2017-07-14 10:56:51 +01:00
51b0673b4b Bite the bullet and enable strict types on everything 2017-06-07 12:53:16 +01:00
56990eb28b MCPE protocol gets its own namespace 2017-03-08 20:28:39 +00:00
58ff381557 PhpStorm automated formatting (#11)
* PhpStorm reformatting

* Tuned PhpStorm reformatting

* Improved ItemIds and BlockIds formatting

* Tuned more PhpStorm reformatting

* Improved string concatenation
2016-10-03 19:05:48 +08:00
6fc435da0e Imports rearrangement 2016-10-03 00:43:46 +08:00
8edebed11c Update DoubleChestInventory.php 2015-11-25 21:08:04 +09:00
31ef7721b1 Removed network channels, bumped protocol 2015-08-12 14:59:48 +02:00
3e2cce3c2c use cleanup 2015-08-07 21:26:24 +02:00
f7ec1de0fd Players now have entity id 0 2015-06-19 14:40:05 +02:00
840690d801 Replaced old deprecated calls 2015-05-18 15:52:31 +02:00
0b176b3fe0 Implemented Channeled packet sending 2015-04-14 18:24:40 +02:00
0a85ad0d1f Improved trees, improved inventory transactions, improved snowball/bow usage 2015-03-28 16:59:15 +01:00
37bc1273ee Implemented double chest fix, closes #2744, fixes #2493 2015-03-17 18:00:19 +01:00
8601405a88 Fixed CPU leak 2014-10-31 21:07:00 +01:00
afaa2cf722 Fixed Double Chest behavior 2014-10-29 12:57:26 +01:00
be0a31697a Fixed Double Chest inventory holder 2014-06-21 19:16:33 +02:00
2674902eaa Preparing to merge 2014-06-05 01:22:04 +02:00
f66560ccd4 Update ContainerInventory on Transaction refused 2014-05-28 17:11:06 +02:00
53749483c3 Implemented new Inventory windows on Player, Chest and Furnace 2014-05-23 20:53:06 +02:00