96 Commits

Author SHA1 Message Date
Dylan K. Taylor
2e9e44ba05 Moved JSON blobs to submodule 2018-06-12 18:49:18 +01:00
Dylan K. Taylor
05af87e1d4 Strip empty lines at the end of classes 2018-06-11 13:19:23 +01:00
Dylan K. Taylor
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
Dylan K. Taylor
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
Dylan K. Taylor
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
Dylan K. Taylor
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
Dylan K. Taylor
bc836aaec1 Make CraftingManager::sort() more cool with spaceship operators 😎 2018-03-29 11:45:12 +01:00
Dylan K. Taylor
145a4fad0f CraftingManager: Make sort() static
this doesn't need access to $this
2018-03-29 11:45:06 +01:00
Dylan K. Taylor
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
Dylan K. Taylor
73e09392b6 Timings: Clean up some terrible code, move namespaces 2018-03-19 19:05:51 +00:00
Dylan K. Taylor
dfc2d1dfe6 Stop hardcoding src/pocketmine/resources everywhere 2017-12-11 19:52:49 +00:00
Dylan K. Taylor
b7cd8dbfa9 Fixed CraftingManager->cloneItemMap() being utterly useless 2017-10-31 19:01:03 +00:00
Dylan K. Taylor
1486b5aa71 make more properties in CraftingManager protected 2017-10-31 18:49:49 +00:00
Dylan K. Taylor
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
Dylan K. Taylor
240cc3043a Rewritten crafting, fixed #45 2017-09-24 14:14:24 +01:00
Dylan K. Taylor
f01ce8e994 null and void typehints 2017-09-21 12:54:04 +01:00
Dylan K. Taylor
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
Dylan K. Taylor
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
Dylan K. Taylor
fd33a65e3b Small cleanup of recipe UUID handling (furnace recipes don't need UUIDs) 2017-09-20 09:34:00 +01:00
Dylan K. Taylor
ca23864e4c CraftingManager: use null coalesce for matching furnace recipes 2017-09-19 20:03:21 +01:00
Dylan K. Taylor
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
Dylan K. Taylor
76acb1da7b New crafting recipe data format, more readable & more compact 2017-08-24 12:05:35 +01:00
Dylan K. Taylor
876659cc73 Item factory refactor and added capability to register custom items 2017-08-21 17:49:26 +01:00
Dylan K. Taylor
e4a5cb6021 Changed NBT representation in JSON to hex, fix encoding problems with UTF-8 2017-08-06 14:50:18 +01:00
Dylan K. Taylor
24bdf330d5 Merge branch 'moar-typehints' 2017-07-15 09:43:43 +01:00
Dylan K. Taylor
6de8415c79 Merge network refactors 2017-07-14 13:04:02 +01:00
Dylan K. Taylor
c3b8be3f60 and more typehints 2017-07-14 10:56:51 +01:00
Dylan K. Taylor
2a7b736f18 Heap of bugfixes, cleanup and PHP 7 upgrades 2017-07-13 19:18:56 +01:00
Dylan K. Taylor
3a214b7ce6 Cleaned up isEncoded mess 2017-07-13 12:21:26 +01:00
Dylan K. Taylor
a365c831a8 Fixed some doc problems 2017-06-25 12:07:28 +01:00
Dylan K. Taylor
e18a3ac933 Fixed UUID-related issues 2017-06-07 13:11:03 +01:00
Dylan K. Taylor
51b0673b4b Bite the bullet and enable strict types on everything 2017-06-07 12:53:16 +01:00
Dylan K. Taylor
c7fdbea0f0 Merge branch 'master' into api3/network 2017-03-08 20:35:41 +00:00
Dylan K. Taylor
56990eb28b MCPE protocol gets its own namespace 2017-03-08 20:28:39 +00:00
Dylan K. Taylor
663cb514e2 Fixed missing Cake recipe
TODO: add support for multiple crafting recipe result items
2017-03-04 15:03:53 +00:00
Dylan K. Taylor
9c36e0cd1c Added crafting data packet cache, reduces on-join lag spikes, close #248 (#269) 2017-01-23 11:03:46 +00:00
Dylan K. Taylor
5443b10257 Use -1 for anydamage and empty string for null NBT, closes #146 2016-12-21 14:45:34 +00:00
Dylan K. Taylor
ea7313779e Update crafting recipes 2016-11-09 14:20:24 +00:00
Dylan K. Taylor
06f8390b30 Fix furnaces and wrong smelting data recipe encoding 2016-10-28 21:46:20 +01:00
SOFe
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
SOF3
e913b16804
Fixed some lines indented with 4 spaces rather than tabs 2016-10-03 00:58:34 +08:00
SOF3
6fc435da0e
Imports rearrangement 2016-10-03 00:43:46 +08:00
PEMapModder
80250aa78e Resolved 1️⃣ in #3961 2016-02-19 18:33:21 +08:00
Intyre
d5f3c19054
Fix crafting not taking item from inventory 2016-01-25 23:10:18 +01:00
Intyre
c7c78b1159
Read recipes from json 2016-01-25 20:40:26 +01:00
Intyre
734736492a
Added some creative items and removed nether reactor 2015-11-23 21:56:38 +01:00
Intyre
85dc136631
Crafting recipes, and packet fix 2015-09-29 00:45:57 +02:00
willowmaster66
0b9ef5b856 Update of the stonecutter recipes
Added the shaped recipes and removed the shapeless ones.
2015-09-18 22:18:14 +02:00
Shoghi Cervantes
a9ead5567b Improved NBT json parsing, attribute base 2015-08-08 22:39:43 +02:00
Shoghi Cervantes
1fa467eb58 Proper recipe ingredient matching, fixed crafting type resetting 2015-08-07 22:00:35 +02:00