Created Instances (markdown)

TheMode 2020-05-03 17:02:11 +02:00
parent 37642ac56a
commit b4001fc16d
1 changed files with 26 additions and 0 deletions

26
Instances.md Normal file

@ -0,0 +1,26 @@
Instances are what replace "world" from Minecraft vanilla, those are lightweight and should offer similar properties
They can be accessed by using the InstanceManager or by getting an entity instance
```java
InstanceManager instanceManager = MinecraftServer.getInstanceManager()
// Or
Entity#getInstance
```
There are two kinds of instance: InstanceContainer and SharedInstance
An InstanceContainer contains both chunks and entities, a SharedInstance needs to share chunks with its container.
You can create an InstanceContainer by calling:
```java
InstanceContainer instanceContainer = instanceManager.createInstanceContainer();
```
And a SharedInstance using:
```java
SharedInstance sharedInstance = instanceManager.createSharedInstance(instanceContainer);
```
Instances do need to have a ChunkGenerator specified, without it no chunk can be generated.
```java
instance.setChunkGenerator(YOUR_GENERATOR);
```