25 Commits

Author SHA1 Message Date
Dylan K. Taylor
76f1ee1827 Add restrictions on packet send directions with interfaces
This prevents plugins sending wrong packets at the compiler level (or would, if we had a compiler). It's more robust than a getter for client/server and throwing an exception since a static analysis tool can detect faults created by sending wrong packets from the server. This is also used to deny service to dodgy clients which send wrong packets to the server to attack it.
2019-01-17 12:51:24 +00:00
Dylan K. Taylor
23269da1a6 Fixed the disaster of packet receive error handling 2019-01-16 19:53:48 +00:00
Dylan K. Taylor
4d15eb3327 Cleaned up the InventoryTransactionPacket decoding clusterfuck
@shoghicp, y u do dis... I almost created a sub-packet architecture to deal with this shit :(

This mess really ought to be split into multiple packets. Perhaps the PacketPool can be extended to do that in the future.
2019-01-03 17:24:30 +00:00
Dylan K. Taylor
64ecc373be Split up session base logic and packet handling
this will allow for mutable packet handlers which can be used to cleanly implement multi-stage game sessions.
2018-07-20 12:36:44 +01:00
Dylan K. Taylor
2bba3a0805 Apply typehints to pocketmine\network\mcpe\protocol namespace
this is pulled from network-nuke in order to reduce the size of the diff.
2018-07-05 13:19:15 +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
41592a04b7 InventoryTransactionPacket: Update some field names 2018-01-24 13:50:30 +00:00
Dylan K. Taylor
95d42b9907 Network: Remove legacy Vector3 primitive encode/decode methods 2018-01-20 10:58:39 +00:00
Dylan K. Taylor
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
Dylan K. Taylor
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
Dylan K. Taylor
240cc3043a Rewritten crafting, fixed #45 2017-09-24 14:14:24 +01:00
Dylan K. Taylor
6897cb4774 Moved inventory action magic slot constants where they belong 2017-09-20 18:27:29 +01:00
Dylan K. Taylor
0fac3b9a9d Added encode for InventoryTransactionPacket and refactor some stuff 2017-09-13 11:14:04 +01:00
Dylan K. Taylor
23a38400e2 Added CraftingGrid and BigCraftingGrid, WIP stuff for crafting
moving whole stacks in & out of the crafting grid works now, splitting stacks is fucked up because the transaction system can't handle the same slot changing multiple times in one transaction
2017-09-12 19:34:06 +01:00
Dylan K. Taylor
a3d21de559 Cleaned up network inventory action reading and core action creation 2017-08-28 20:04:35 +01:00
Dylan K. Taylor
9be1b929a5 Added PhpDoc for packet field types and changed float x,y,z to Vector3 2017-08-13 20:02:07 +01:00
Dylan K. Taylor
8958b3c51c Many many changes related to inventory transactions, fixed item dropping, fixed creative menu 2017-08-11 19:57:30 +01:00
Dylan K. Taylor
c1ff7bbef4 Added creative-inventory magic slot numbers and renamed some constants 2017-08-11 12:31:11 +01:00
Dylan K. Taylor
5208ad885c Added crafting use-ingredient fake transaction source 2017-08-10 18:42:14 +01:00
Dylan K. Taylor
7958fffa07 Move some code around to fix block placing, breaking, and throwing snowballs 2017-08-07 12:28:07 +01:00
Dylan K. Taylor
49506659e0 More constants 2017-08-06 17:21:51 +01:00
Dylan K. Taylor
7886918140 Cleaned up some bad code in DataPacket, added encode/decodeHeader and made encode/decodePayload protected 2017-08-06 17:21:51 +01:00
Dylan K. Taylor
50dffeb6a1 Day 3, part 1 2017-08-06 17:21:51 +01:00
Dylan K. Taylor
63d2b341b9 Day 2 2017-08-06 17:21:51 +01:00
Dylan K. Taylor
77cd8e7799 More broken mess to spawn 1.2 2017-08-06 17:21:51 +01:00