Get Started
Installation
NormaConstructor requires nodejs and git.
If you don't have nodejs, install itopen in new window now.
If you don't have git, install itopen in new window now.
Now you can clone the repository.
$ git clone https://github.com/NorthernOceanS/NormaConstructor.git
$ cd NormaConstructor
$ npm install
2
3
If you are in China mainland, you can clone from a mirror (not synchronously update).
$ git clone https://e.coding.net/Northern_OceanS/NormaConstructor/NormaConstructor.git
Hello World
The project have a structure like this, and to write a new Generator
,
all you need to do is creating a folder with a file index.js
in packs/behaviors/scripts/plugin/
.
.
- packs
- behaviors
- scripts
- client
- client.js
- system.js
- plugin
- nc
- index.js
- hello
- index.js
- ...
- nc
- ...
- client
- scripts
- resources
- ...
- behaviors
The blod ones is created by you.
// in plugin/hello/index.js
import {systemInstance as system} from 'norma-core';
system.registerCanonicalGenerator({
name: "hello world",
criteria: {
positionsLength: 0,
blockTypesLength: 0,
directionsLength: 0,
},
method: {
generate: function (e) {
return [];
// the Generator can not actually generate anything,
// but it can be a sample of how to register a generator.
}
}
});
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
To know more, see following sections.
plugin location
All plugins are enclosed by a folder and placed inside the plugin
folder. An index.js
must be present.
- plugin
- nc
- index.js
- hello
- index.js
- ...
- nc
The folder nc
contain the offical Generator
s of NC.
system
API
system
is a global unique object.
Register API
system.registerGenerator()
is one of the most useful API.
It can be used to register Generator
s to the system.
However, you may find system.registerCanonicalGenerator()
more useful.
system.registerNOSProgram()
is an API which can register a command parser to system.
Runtime API
Runtime API can only used in runtime.
The runtime will provide API like runtime.getBlock()
in runtime.
Runtime API may be platform dependant, because some platform may haven't feature other platforms have.
Scripts
The project use minecraft-addon-toolchainopen in new window
as its dependence, so it can use scripts
$ npm run build
$ npm run watch
$ npm run installaddon
$ npm run uninstalladdon
$ npm run packageaddon
2
3
4
5
You can
use npm run build
to create the structure of a mcaddon,
use npm run installaddon
to install the addon for Win10,
use npm run uninstalladdon
to uninstall the addon for Win10,
use npm run packageaddon
to create a mcaddon package,
or do other things you want.