{"id":29117888,"url":"https://github.com/prismarinejs/prismarine-physics","last_synced_at":"2026-04-02T18:43:22.858Z","repository":{"id":37621334,"uuid":"277335496","full_name":"PrismarineJS/prismarine-physics","owner":"PrismarineJS","description":"Provide the physics engine for minecraft entities","archived":false,"fork":false,"pushed_at":"2025-01-26T21:54:17.000Z","size":93,"stargazers_count":35,"open_issues_count":16,"forks_count":40,"subscribers_count":4,"default_branch":"master","last_synced_at":"2025-06-28T11:48:28.037Z","etag":null,"topics":["minecraft","physics-engine","prismarinejs"],"latest_commit_sha":null,"homepage":"","language":"JavaScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/PrismarineJS.png","metadata":{"files":{"readme":"README.md","changelog":"HISTORY.md","contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null}},"created_at":"2020-07-05T15:58:38.000Z","updated_at":"2025-01-26T21:54:21.000Z","dependencies_parsed_at":"2023-02-12T13:01:32.337Z","dependency_job_id":"e8bf3ed8-5231-4e62-9686-441bdc0deff7","html_url":"https://github.com/PrismarineJS/prismarine-physics","commit_stats":{"total_commits":83,"total_committers":25,"mean_commits":3.32,"dds":0.7469879518072289,"last_synced_commit":"4cdd93ea32b1b14cf34f7149bcc881b64945c061"},"previous_names":[],"tags_count":24,"template":false,"template_full_name":null,"purl":"pkg:github/PrismarineJS/prismarine-physics","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/PrismarineJS%2Fprismarine-physics","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/PrismarineJS%2Fprismarine-physics/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/PrismarineJS%2Fprismarine-physics/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/PrismarineJS%2Fprismarine-physics/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/PrismarineJS","download_url":"https://codeload.github.com/PrismarineJS/prismarine-physics/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/PrismarineJS%2Fprismarine-physics/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":262589898,"owners_count":23333257,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["minecraft","physics-engine","prismarinejs"],"created_at":"2025-06-29T12:07:59.195Z","updated_at":"2026-04-02T18:43:22.826Z","avatar_url":"https://github.com/PrismarineJS.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# prismarine-physics\n\n[![NPM version](https://img.shields.io/npm/v/prismarine-physics.svg)](http://npmjs.com/package/prismarine-physics)\n[![Build Status](https://github.com/PrismarineJS/prismarine-physics/workflows/CI/badge.svg)](https://github.com/PrismarineJS/prismarine-physics/actions?query=workflow%3A%22CI%22)\n[![Discord](https://img.shields.io/badge/chat-on%20discord-brightgreen.svg)](https://discord.gg/GsEFRM8)\n[![Gitter](https://img.shields.io/badge/chat-on%20gitter-brightgreen.svg)](https://gitter.im/PrismarineJS/general)\n[![Irc](https://img.shields.io/badge/chat-on%20irc-brightgreen.svg)](https://irc.gitter.im/)\n\n[![Try it on gitpod](https://img.shields.io/badge/try-on%20gitpod-brightgreen.svg)](https://gitpod.io/#https://github.com/PrismarineJS/prismarine-physics)\n\nProvide the physics engine for minecraft entities\n\n## Usage\n\n```js\nconst { Physics, PlayerState } = require('prismarine-physics')\nconst { Vec3 } = require('vec3')\n\nconst mcData = require('minecraft-data')('1.13.2')\nconst Block = require('prismarine-block')('1.13.2')\n\nconst physics = Physics(mcData, world)\nconst controls = {\n  forward: false,\n  back: false,\n  left: false,\n  right: false,\n  jump: false,\n  sprint: false,\n  sneak: false\n}\nconst player = {\n    entity: {\n      position: pos,\n      velocity: new Vec3(0, 0, 0),\n      onGround: false,\n      isInWater: false,\n      isInLava: false,\n      isInWeb: false,\n      isCollidedHorizontally: false,\n      isCollidedVertically: false,\n      elytraFlying: false,\n      yaw: 0,\n      pitch: 0\n    },\n    jumpTicks: 0,\n    jumpQueued: false,\n    fireworkRocketDuration: 0\n  }\nconst playerState = new PlayerState(player, controls)\n\nwhile (!player.entity.onGround) {\n  // simulate 1 tick of player physic, then apply the result to the player\n  physics.simulatePlayer(playerState, world).apply(player)\n}\n```\n\nSee `examples/` for more.\n\n\n## API\n\n### Physics\n\n#### simulatePlayer(playerState, world)\n- playerState : instance of the PlayerState class\n- world : interface with a function `getBlock(position)` returning the prismarine-block at the given position\n\n### PlayerState\n\nA player state is an object containing the properties:\n\nRead / Write properties:\n- pos : position (vec3) of the player entity\n- vel : velocity (vec3) of the player entity\n- onGround : (boolean) is the player touching ground ?\n- isInWater : (boolean) is the player in water ?\n- isInLava : (boolean) is the player in lava ?\n- isInWeb : (boolean) is the player in a web ?\n- isCollidedHorizontally : (boolean) is the player collided horizontally with a solid block ?\n- isCollidedVertically : (boolean) is the player collided vertically with a solid block ?\n- elytraFlying : (boolean) is the player elytra flying ?\n- jumpTicks : (integer) number of ticks before the player can auto-jump again\n- jumpQueued : (boolean) true if the jump control state was true between the last tick and the current one\n- fireworkRocketDuration : (number) how many ticks of firework boost are remaining ?\n\nRead only properties:\n- yaw : (float) the yaw angle, in radians, of the player entity\n- pitch: (float) the pitch angle, in radians, of the player entity\n- control : (object) control states vector with properties:\n  - forward\n  - back\n  - left\n  - right\n  - jump\n  - sprint\n  - sneak","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fprismarinejs%2Fprismarine-physics","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fprismarinejs%2Fprismarine-physics","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fprismarinejs%2Fprismarine-physics/lists"}