Minecraft Script API starter for Idris2.
This project demonstrates a simple process and Idris2 compilation for Minecraft.
This code will generate a file signs.idr
.
deno run gen.ts
To start with this project you must have the idris2
and idris2-pack
installed.
pack build ideal.ipkg
In the following example, we're listening for the blockPlace event on afterEvents. When a block is placed, we spawn a pig at the block placement location:
module Main
import MC.Server
overworld : Dimension
overworld = getDimension world "overworld"
on_place : BlockPlaceAfterEvent -> IO Entity
on_place e = pure $ spawnEntity overworld "minecraft:pig" (location $ block $ asBlockEvent e)
sub : (BlockPlaceAfterEvent -> IO ()) -> IO (BlockPlaceAfterEvent -> IO ())
sub = subscribe $ blockPlace $ afterEvents world
main : IO ()
main = ignore $ sub (ignore . on_place)
Idris2 is a statically typed functional programming language that places a strong emphasis on type safety and correctness. It has a very powerful type-checker hence you don't need to tag every Data Types.
You can find more examples on the folder test/src
.
pack build
check the make.sh
file for more details.
This project is still working in progress.
- Implement @minecraft/server
- Basic Data Types support
- Event system
- Promise and more complex data types
- Interfaces and Enum
- JS primitive types
- Implement @minecraft/server-ui and more
- Auto code generation
- A code Starter
- Project management