Hey guys,
today I tried to use the org.spongepowered.common.world.DimensionManager (Dimension Manager).
Problem is, that it seems like the package common is not included, so I can’t use the DimensionManager class.
I added SpongeAPI like this:
<repositories>
<repository>
<id>sponge-maven-repo</id>
<name>Sponge maven repo</name>
<url>http://repo.spongepowered.org/maven</url>
<releases>
<enabled>true</enabled>
</releases>
<snapshots>
<enabled>true</enabled>
</snapshots>
</repository>
</repositories>
<dependencies>
<dependency>
<groupId>org.spongepowered</groupId>
<artifactId>spongeapi</artifactId>
<version>2.1-SNAPSHOT</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>ninja.leaping.configurate</groupId>
<artifactId>configurate-yaml</artifactId>
<version>2.0</version>
<!-- Update this with the most recent version -->
</dependency>
</dependencies>
Just curious, why do you suggest depending on a specific implementation rather then supporting both by depending on SpongeCommon? Or is it not possible to support both in this manner?
SpongeCommon is really just a source-set component of both implementations, it’s not a separate dependency and should not be seen as such. If you only use org.spongepowered.common in your usage of SpongeForge/Vanilla then yes it will work on both but again this is all very implementation specific and I don’t recommend using.
I was looking at the code of ProjectWorlds. To register a new (sponge) config (convert bukkit worlds to sponge worlds with /load), i need the dimension manager.
This is the code, where I need to use the manager. (code by @TrenTech - ProjectWorlds)
public void createNewConfig(String dimType) throws IOException{
int dimId = DimensionManager.getNextFreeDimId();
DimensionManager.registerDimension(dimId, 0);
CompoundTag compoundTag = new CompoundTag("SpongeData", null);
compoundTag.put(new IntegerTag("dimensionId", dimId));
compoundTag.put(new LongTag("uuid_least", -6732046318667659594L));
compoundTag.put(new LongTag("uuid_most", 9143053678590905554L));
compoundTag.put(new StringTag("dimensionType", dimType));
CompoundTag compoundPlayerId = new CompoundTag("", null);
compoundPlayerId.put(new LongTag("uuid_least", -7628444587550319768L));
compoundPlayerId.put(new LongTag("uuid_most", 4244735002832685980L));
List<NBTTag> listPlayerId = new ArrayList<>();
listPlayerId.add(compoundPlayerId);
compoundTag.put(new ListTag("PlayerIdTable", listPlayerId));
CompoundTag compoundRoot = new CompoundTag("", null);
compoundRoot.put(compoundTag);
List<NBTTag> list = new ArrayList<>();
list.add(compoundRoot);
XNBT.saveTags(list, dataFile);
this.compoundTag = compoundTag;
WorldData worldData = new WorldData(worldName);
if(!worldData.exists()){
return;
}
if(!worldData.isCorrectLevelName()){
worldData.setLevelName();
}
}
I think all the migrator does is move bukkit worlds to Sponges respected locations unless things have changed since I last looked. WorldProperties still needs to be created.