Note: This document is a translation of the original Japanese README. Some translations may not be perfect.
rail_movement for high-speed driving
Copy the build directory into the scripts directory of your behavior pack.
You can use a submodule to keep up with updates.
git submodule add https://github.com/TCMB-Project/rail_mo_plus.gitIf you are using @minecraft/server 1.19.0 or earlier, please use the v1 branch.
cd rail_mo_plus
git checkout v1For JavaScript:
import { RailMoPlusEntity } from "./build/rail_mo_plus.js";For TypeScript:
import { RailMoPlusEntity } from "./src/rail_mo_plus.ts";An example where an entity "foo:bar" always moves at 10km/h on rails:
import { world } from "@minecraft/server";
import { RailMoPlusEntity } from "./build/rail_mo_plus.js";
const entities = new Map();
world.afterEvents.entitySpawn.subscribe((e) => {
const entity = e.entity;
if(e.entity.typeId !== "foo:bar") return;
const railInstance = new RailMoPlusEntity(entity);
railInstance.setSpeed(10);
entities.set(entity.id, railInstance);
});MIT License