mirror of https://github.com/Minestom/Minestom.git
Created Instances (markdown)
parent
37642ac56a
commit
b4001fc16d
|
@ -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);
|
||||
```
|
Loading…
Reference in New Issue