Commit Graph

98 Commits

Author SHA1 Message Date
bdd9a7eb52 Kill BatchPacket, clean up batching related things
DataPacketSendEvent and DataPacketReceiveEvent will no longer capture BatchPackets
In most places strings are now used instead of DataPackets, to remove limitations on what data can be sent to a network interface
Removed CraftingManager's cyclic dependency on Server

There is a lot more work to do aside from this, but this commit is intended to clean up what is necessary to fix the handling of BatchPacket.
2018-07-20 12:36:44 +01:00
9f7f62e9e5 Don't use Config for builtin JSON resources
it doesn't make sense to use a config in these cases, and also it just hides problems when the files are missing.
2018-06-16 16:35:47 +01:00
2e9e44ba05 Moved JSON blobs to submodule 2018-06-12 18:49:18 +01:00
05af87e1d4 Strip empty lines at the end of classes 2018-06-11 13:19:23 +01:00
2660448601 Crafting: Match recipe based only on transaction inputs/outputs
As of 1.2.13 release, the client now skips the crafting grid step when it crafts with right-click on the recipe book. This means that we can't validate crafting based on the crafting grid contents anymore. The only way to do it now is to use the inputs and outputs calculated by the transaction balance.
2018-04-04 12:48:17 +01:00
ec332e3e60 Fill null UUIDs in CraftingDataPacket, remove all UUID things from CraftingRecipe
This allows deleting lots of code, and additionally provides a huge reduction in the compressed size of CraftingDataPacket. Since we don't care about these UUIDs (they are only used in CraftingEventPacket, which is broken and unused in PM) we fill them with zeros instead.
2018-03-29 12:05:23 +01:00
a1090623a2 CraftingRecipe: added methods to allow recipes to derive outputs from inputs
this will be needed for special recipes like shulker-box and banner recipes.
2018-03-29 12:05:22 +01:00
8572e9e560 Crafting: nuke
This commit brings in a much-needed rewrite of crafting transaction handling.

The following classes have been removed:
- CraftingTransferMaterialAction
- CraftingTakeResultAction

The following classes have significant changes:
- CraftingTransaction
	- All API methods have been removed and are now handled in CraftItemEvent
- CraftItemEvent
	- added the following:
		- getInputs()
		- getOutputs()
		- getRepetitions() (tells how many times a recipe was crafted in this event)
- Recipe interface:
	- Removed getResult() (individual recipes may handle this differently)
- CraftingRecipe interface
	- removed the following:
		- matchItems()
		- getExtraResults()
		- getAllResults()
	- added the following
		- getResults()
		- getIngredientList() : Item[], which must return a 1D array of items that should be consumed (wildcards accepted).
		- matchesCraftingGrid(CraftingGrid)
- ShapedRecipe
	- constructor now accepts string[], Item[], Item[]
- ShapelessRecipe
	- constructor now accepts Item[], Item[]
2018-03-29 12:05:22 +01:00
bc836aaec1 Make CraftingManager::sort() more cool with spaceship operators 😎 2018-03-29 11:45:12 +01:00
145a4fad0f CraftingManager: Make sort() static
this doesn't need access to $this
2018-03-29 11:45:06 +01:00
a6d7365a28 Moved CraftingManager init to its own function
this allows the crafting manager to be re-initialized on the fly without recreating it.
2018-03-29 11:32:22 +01:00
73e09392b6 Timings: Clean up some terrible code, move namespaces 2018-03-19 19:05:51 +00:00
dfc2d1dfe6 Stop hardcoding src/pocketmine/resources everywhere 2017-12-11 19:52:49 +00:00
b7cd8dbfa9 Fixed CraftingManager->cloneItemMap() being utterly useless 2017-10-31 19:01:03 +00:00
1486b5aa71 make more properties in CraftingManager protected 2017-10-31 18:49:49 +00:00
f79e4237df Cache a compressed CraftingDataPacket to reduce workload on player join
this saves only a couple of ms per player join, but still worth it.
2017-10-29 09:57:55 +00:00
240cc3043a Rewritten crafting, fixed #45 2017-09-24 14:14:24 +01:00
f01ce8e994 null and void typehints 2017-09-21 12:54:04 +01:00
0262465a26 Fixed dupe cake glitch
this is what happens when you try to be clever when not properly awake
2017-09-20 11:19:15 +01:00
7996a7b08c Testing handling multiple result items for ShapedRecipes
this doesn't work yet, I wanted to see how glitchy it is with cakes. The answer is: very glitchy.
2017-09-20 11:14:09 +01:00
fd33a65e3b Small cleanup of recipe UUID handling (furnace recipes don't need UUIDs) 2017-09-20 09:34:00 +01:00
ca23864e4c CraftingManager: use null coalesce for matching furnace recipes 2017-09-19 20:03:21 +01:00
642c7733cd Cleaned up ShapedRecipe handling, ShapedRecipe API changes
use shapes from json instead of just generating maps
fix a ton of bugs
2017-09-17 11:45:16 +01:00
76acb1da7b New crafting recipe data format, more readable & more compact 2017-08-24 12:05:35 +01:00
876659cc73 Item factory refactor and added capability to register custom items 2017-08-21 17:49:26 +01:00
e4a5cb6021 Changed NBT representation in JSON to hex, fix encoding problems with UTF-8 2017-08-06 14:50:18 +01:00
24bdf330d5 Merge branch 'moar-typehints' 2017-07-15 09:43:43 +01:00
6de8415c79 Merge network refactors 2017-07-14 13:04:02 +01:00
c3b8be3f60 and more typehints 2017-07-14 10:56:51 +01:00
2a7b736f18 Heap of bugfixes, cleanup and PHP 7 upgrades 2017-07-13 19:18:56 +01:00
3a214b7ce6 Cleaned up isEncoded mess 2017-07-13 12:21:26 +01:00
a365c831a8 Fixed some doc problems 2017-06-25 12:07:28 +01:00
e18a3ac933 Fixed UUID-related issues 2017-06-07 13:11:03 +01:00
51b0673b4b Bite the bullet and enable strict types on everything 2017-06-07 12:53:16 +01:00
c7fdbea0f0 Merge branch 'master' into api3/network 2017-03-08 20:35:41 +00:00
56990eb28b MCPE protocol gets its own namespace 2017-03-08 20:28:39 +00:00
663cb514e2 Fixed missing Cake recipe
TODO: add support for multiple crafting recipe result items
2017-03-04 15:03:53 +00:00
9c36e0cd1c Added crafting data packet cache, reduces on-join lag spikes, close #248 (#269) 2017-01-23 11:03:46 +00:00
5443b10257 Use -1 for anydamage and empty string for null NBT, closes #146 2016-12-21 14:45:34 +00:00
ea7313779e Update crafting recipes 2016-11-09 14:20:24 +00:00
06f8390b30 Fix furnaces and wrong smelting data recipe encoding 2016-10-28 21:46:20 +01: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
e913b16804 Fixed some lines indented with 4 spaces rather than tabs 2016-10-03 00:58:34 +08:00
6fc435da0e Imports rearrangement 2016-10-03 00:43:46 +08:00
80250aa78e Resolved 1️⃣ in #3961 2016-02-19 18:33:21 +08:00
d5f3c19054 Fix crafting not taking item from inventory 2016-01-25 23:10:18 +01:00
c7c78b1159 Read recipes from json 2016-01-25 20:40:26 +01:00
734736492a Added some creative items and removed nether reactor 2015-11-23 21:56:38 +01:00
85dc136631 Crafting recipes, and packet fix 2015-09-29 00:45:57 +02:00
0b9ef5b856 Update of the stonecutter recipes
Added the shaped recipes and removed the shapeless ones.
2015-09-18 22:18:14 +02:00