npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2025 – Pkg Stats / Ryan Hefner

codeconnection

v1.2.8

Published

Code minecraft education edition using nodeJS. An attempt to improve on Microsoft Code Connection.

Downloads

71

Readme

Code connection for Minecraft Education Edition clone using NodeJS.

To turn on the server run:

npx codeserver-start

To turn off the server run:

npx codeserver-stop

The server runs an expressJS server (port 3001) and a websocket (port 3000). Minecraft connects to port 3000 using the /connect localhost:3000 slash command.

The player script automatically sends http requests to express that relays them to Minecraft. Minecraft responds (eventually) with some JSON data that is parsed with true/false/useful data being sent back to the player.

To get Minecraft to connect to this application you need to turn off secure websockets in Minecraft.

Do this by:

  1. Opening a world and hitting escape to bring up a menu screen
  2. Selecting settings.
  3. You now need to select "Profile" on the left hand menu
  4. At the top of the right, the third toggle at the top should say "Require encrypted websockets". This needs to be switched off. (toggled left) If this option is grayed out you are already connected to a websocket and will need to disconnect before disabling the secure websockets.

Scripts should start with

const { agent, d, blocks } = require('codeconnection')

agent - this gives access to the agent to send commands d - this gives quick access to direction commands LEFT, RIGHT, UP, DOWN, FORWARD, BACK blocks - a list of blocks so yo don't have to type them

Possible agent commands:

Command | Details ---|--- agent.move(direction, distance) | moves agent number of steps in given direction. Returns true/false agent.turn(direction, times) | turns left or right given number of times. Always returns true agent.getPosition() | returns JSON object with x,y,z co-ordinates of the agent agent.getPlayerPosition() | returns JSON object with x,y,z co-ordinates of the player agent.orientation() | returns direction agent is facing agent.inspect(direction) | return block information of block in direction given form the agent perspective agent.destroy(direction) | agent destroys block in given direction. Returns true/false agent.collect() | agent picks thins up nearby agent.inventory() | returns JSON object with inventory data for agent (id aligns with blocks list) agent.till(direction) | agent tills soil in direction given. Returns true/false agent.attack(direction) | agent attacks in direction given agent.dropAll(direction) | agent drops all inventory in direction given agent.drop(slot,quantity,direction) | drops given number of items from the slot in the direction given (will not allow inventory to go negative) agent.place(direction,slot) | agent places item from given inventory slot in direction indicated agent.detect() | detects if any collidable block exists in given direction (returns true/false) agent.detectRedstone(direction) | detects if redstone in direction given agent.transfer(from slot, to slot, quantity) | self explanatory I hope agent.tpToPlayer() | teleports agent to player agent.face(direction) | makes agent face either NORTH, SOUTH, EAST or WEST agent.radar(block) | will attempt to see if there are any potential matching blocks within 16 blocks on the same vertical height in the world as the agent. It runs the /getchunkdata command to get the colour values of nearby blocks and checks these against a list. Many blocks have the same colour value (e.g. all stone and ore blocks are the same) so they may not help you find diamonds easily.... agent.follow(true/false) | if true (default) then teleport the player to be close to the agent so the agent can continue executing it's commands. Agent must be within 64 units of distance from the player or throws and error message [this is just how the agent works, Minecraft has this programmed in]. If this is set to false, the program pauses until the user moves to within the distance limit and presses a key on the console to resume the commands being sent to the agent. agent.getStats() | returns a cumulative total of the moves the agent has made as an object. It also includes the current running time. agent.give(block,slot,quantity) | places an item in the agent's inventory. Block is from the block list, slot is 1 to 27 and quantity is an integer. Slot defaults to 1 if missing and quantity defaults to 1. Currently there are some items that aren't able to be 'given' to the agent - I think it is a database issue.

Special feature(s)

Starting with

const { agent, d, blocks, special } = require('codeconnection')

gives access to the 'special' functions.

Command | Details --- | --- special.about() | Prints this message.createHeightMap()\nThis centers the player on a 256 x 256 world (old world).It generates a height map as an array of objects and saves it to a file called 'map.json'.The function also returns this information as an object when it completes.It contains teh heights, a colour code that matches different items in the database for the highest block in the world at that location in a 256 x 256 array of objects. special.createHeightMap() | This function centers the players position on an old world (256 x 256). It then scans all the heights of the blocks in the whole world. It produces and object with the following information.offsetX: x offset of the map in world coordinatesoffsetZ: z offset of the map in world coordinatesarray of arrays (256 x 256) with all cells containing objects.Each object has a height which is the highest block at that X,Z coordinate and a colorcode that matchs the block at the coordinate. This is a Base64 encoded RGB value. The database in this system (look in the node module) contains all the color codes for blocks so you can potentially work out what blocks each height could be

I'm sure there are some bugs in here, eventually I'll probably work them out, either that of Minecraft Education Edition will get updated and break everything.