Skip to content

Instantly share code, notes, and snippets.

@badryan
Created December 8, 2015 10:38
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save badryan/e1ea40f5658f40a060ea to your computer and use it in GitHub Desktop.
Save badryan/e1ea40f5658f40a060ea to your computer and use it in GitHub Desktop.
Get Steve's position in Minecraft

This is a short flow to demonstrate how to communicate from Node-RED with Minecraft. It uses a TCP request to push "player.getPos()\n" into Steve's world and will receive the coordinate tuple in a node.js buffer format that is converted .toString before printing in the debug panel. Note that you have to run Minecraft and enter a world before triggering this flow.

[{"id":"945e5f77.182da8","type":"function","z":"a59a50d2.5a65b","name":"function","func":"msg.payload = \"player.getPos()\\n\";\nreturn msg;","outputs":1,"noerr":0,"x":128,"y":153,"wires":[["ec2d4ccc.7365b","c5a42bac.ef9ba"]]},{"id":"c5a42bac.ef9ba","type":"debug","z":"a59a50d2.5a65b","name":"","active":true,"console":"false","complete":"false","x":378,"y":54,"wires":[]},{"id":"f1098e71.8eb9d","type":"inject","z":"a59a50d2.5a65b","name":"inject","topic":"","payload":"Hello World","payloadType":"string","repeat":"","crontab":"","once":false,"x":90,"y":54,"wires":[["945e5f77.182da8"]]},{"id":"ec2d4ccc.7365b","type":"tcp request","z":"a59a50d2.5a65b","server":"127.0.0.1","port":"4711","out":"char","splitc":"\\n","name":"","x":244,"y":253,"wires":[["f4f5b8bd.154d68"]]},{"id":"f4f5b8bd.154d68","type":"function","z":"a59a50d2.5a65b","name":"conversion","func":"msg.payload = msg.payload.toString();\nreturn msg;","outputs":1,"noerr":0,"x":367,"y":154,"wires":[["c5a42bac.ef9ba"]]}]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment