1.2.4 • Published 4 years ago

@throw-out-error/minecraft-mcfunction v1.2.4

Weekly downloads
1
License
MIT
Repository
github
Last release
4 years ago

mcfunction

A simple way to create your mcfunction files using Typescript syntax.

Commands

Every command is exposed as a function that returns an instance of the command to be executed.

import { difficulty } from "..";

// cmd is an instance of DifficultyCommand
const cmd = difficulty("peaceful");

Keep in mind, that some commands are still under development.

Arguments

The commands usually take the same arguments as their corresponding commands.

Selector

The Selector class takes an object of arguments to filter by:

import { Selector } from "..";

// @a[team=red]
const teamRed = new Selector("player", { team: "red" });

// @e[type=minecraft:sheep,distance=..10]
const closeSheep = new Selector("entity", {
  type: "minecraft:sheep",
  distance: [, 10]
});

For convenience the Selector class provides static methods for the different selector types.

import { Selector } from "..";

// @a
const allPlayers = Selector.player();

// @s
const me = Selector.executer();

// @e[type=minecraft:bat]
const bats = Selector.entity({ type: "minecraft:bat" });

Range

Ranges can be expressed as a single number or a number array of length 2. To represent an open range you can use Infinity or undefined.

import { Range } from "..";

// '..10'
const close: Range = [, 10];

// '30..'
const far: Range = [30, Infinity];

// '5'
const exact: Range = 5;
1.2.4

4 years ago

1.2.3

4 years ago

1.2.0

4 years ago

1.2.2

4 years ago

1.2.1

4 years ago

1.1.4

4 years ago

1.1.3

4 years ago

1.1.1

4 years ago

1.1.0

4 years ago

1.1.2

4 years ago

1.0.3

4 years ago

1.0.2

4 years ago

1.0.1

4 years ago

1.0.0

4 years ago