{"action":"created","issue":{"url":"https://api.github.com/repos/PrismarineJS/node-minecraft-protocol/issues/231","labels_url":"https://api.github.com/repos/PrismarineJS/node-minecraft-protocol/issues/231/labels{/name}","comments_url":"https://api.github.com/repos/PrismarineJS/node-minecraft-protocol/issues/231/comments","events_url":"https://api.github.com/repos/PrismarineJS/node-minecraft-protocol/issues/231/events","html_url":"https://github.com/PrismarineJS/node-minecraft-protocol/issues/231","id":105741916,"number":231,"title":"High level abstractions above nmp","user":{"login":"rom1504","id":2346494,"avatar_url":"https://avatars.githubusercontent.com/u/2346494?v=3","gravatar_id":"","url":"https://api.github.com/users/rom1504","html_url":"https://github.com/rom1504","followers_url":"https://api.github.com/users/rom1504/followers","following_url":"https://api.github.com/users/rom1504/following{/other_user}","gists_url":"https://api.github.com/users/rom1504/gists{/gist_id}","starred_url":"https://api.github.com/users/rom1504/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/rom1504/subscriptions","organizations_url":"https://api.github.com/users/rom1504/orgs","repos_url":"https://api.github.com/users/rom1504/repos","events_url":"https://api.github.com/users/rom1504/events{/privacy}","received_events_url":"https://api.github.com/users/rom1504/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":1,"created_at":"2015-09-10T06:43:56Z","updated_at":"2015-09-10T15:36:14Z","closed_at":null,"body":"So this is not really a nmp issue : there is nothing to fix in nmp in this issue, but it's an issue that can concern several nmp users.\r\n\r\nThe starting point of this issue is to see that mineflayer provide an high-level api for clients, flying-squid is starting to provide an high-level api for servers, and some things are common in these two implementations.\r\n\r\nSo what is common ?\r\n\r\nThere are 4 main things that are done with nmp : \r\n1) reading client bound packets\r\n2) writing server bound packets\r\n3) reading server bound packets\r\n4) writing client bound packets\r\n\r\nMineflayer is doing 1 and 2 and flying-squid is doing 3 and 4.\r\n\r\nNow there's a third kind of nmp users : proxies, like the one @Egoscio is building. And proxies actually do these 4 things : they need to understand the 2 direction and send packets to the 2.\r\n\r\nMineflayer and flying-squid can both use certain type of representation to store information, for example prisimarine-block, prisimarine-entity, prisimarine-world, node-vec3. \r\n\r\nNow the handling of reading and writing packets is different with just the storing information part.\r\n\r\nI think what would be interesting for all these users would be to provide methods that would make it easier to read and write the packets at a higher level. For example the block_place packet contain a direction number and a reference block position, it would be interesting to transform that into an event containing the position of the future block, and a direction vector instead of the direction number. This is just one example ( and I will add more) but this is the kind of things that would make writing mineflayer and flying-squid easier.\r\n\r\nSo basically the idea is to provide methods to facilitate writing packets and reading packets from a higher level perspective.\r\n\r\nIn a second stage it might be interesting to have 2 back ends for that representation : mcpc and mcpe. That way it would be easier to write bots, servers and proxies that would work for both mcpc and mcpe.\r\n\r\nThis is the basic idea and I'll add more examples later to make sure and prove that having a higher level representation of these network operations make sense.\r\n\r\n"},"comment":{"url":"https://api.github.com/repos/PrismarineJS/node-minecraft-protocol/issues/comments/139283797","html_url":"https://github.com/PrismarineJS/node-minecraft-protocol/issues/231#issuecomment-139283797","issue_url":"https://api.github.com/repos/PrismarineJS/node-minecraft-protocol/issues/231","id":139283797,"user":{"login":"rom1504","id":2346494,"avatar_url":"https://avatars.githubusercontent.com/u/2346494?v=3","gravatar_id":"","url":"https://api.github.com/users/rom1504","html_url":"https://github.com/rom1504","followers_url":"https://api.github.com/users/rom1504/followers","following_url":"https://api.github.com/users/rom1504/following{/other_user}","gists_url":"https://api.github.com/users/rom1504/gists{/gist_id}","starred_url":"https://api.github.com/users/rom1504/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/rom1504/subscriptions","organizations_url":"https://api.github.com/users/rom1504/orgs","repos_url":"https://api.github.com/users/rom1504/repos","events_url":"https://api.github.com/users/rom1504/events{/privacy}","received_events_url":"https://api.github.com/users/rom1504/received_events","type":"User","site_admin":false},"created_at":"2015-09-10T15:36:14Z","updated_at":"2015-09-10T15:36:14Z","body":"Some ideas : \r\n* transform field type like block id, entity id, position to their corresponding classes (prismarine-block, prisimarine-entity, vec3)\r\n* group some packets like the spawn entity packet\r\n* compare mcpc and mcpe protocols to have ideas about how to build a common representation\r\n\r\nI think that representation should be made available to users but the low level representation should still be available even if we would encourage users to use only the high level representation if possible.\r\n"}}