Skip to content

Commit

Permalink
Git is complaining about changes
Browse files Browse the repository at this point in the history
  • Loading branch information
Paul19988 committed Dec 29, 2020
1 parent f5bdab7 commit e988b7a
Show file tree
Hide file tree
Showing 3 changed files with 53 additions and 41 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,11 @@
import java.io.IOException;
import java.nio.file.Files;
import java.nio.file.Path;
import java.util.*;
import java.util.Arrays;
import java.util.Collections;
import java.util.Locale;
import java.util.Properties;
import java.util.UUID;

@Getter
public class v1_16_R1SlimeNMS implements SlimeNMS {
Expand Down Expand Up @@ -199,26 +203,29 @@ private World.Environment getEnvironment(SlimeWorld world) {
}

private WorldDataServer createWorldData(SlimeWorld world) {
String worldName = world.getName();
CompoundTag extraData = world.getExtraData();
WorldDataServer worldDataServer;
NBTTagCompound extraTag = (NBTTagCompound) Converter.convertTag(world.getExtraData());
NBTTagCompound extraTag = (NBTTagCompound) Converter.convertTag(extraData);
MinecraftServer mcServer = MinecraftServer.getServer();

SlimePropertyMap propertyMap = world.getPropertyMap();
Properties properties = new Properties();
String defaultBiome = propertyMap.getString(SlimeProperties.DEFAULT_BIOME);
String generatorString = "{\"structures\":{\"structures\":{}},\"biome\":\"" + defaultBiome + "\",\"layers\":[]}";

properties.put("generator-settings", generatorString);
properties.put("level-type", "FLAT");

GeneratorSettings generatorSettings = GeneratorSettings.a(properties);

if (extraTag.hasKeyOfType("LevelData", CraftMagicNumbers.NBT.TAG_COMPOUND)) {
NBTTagCompound levelData = extraTag.getCompound("LevelData");
int dataVersion = levelData.hasKeyOfType("DataVersion", 99) ? levelData.getInt("DataVersion") : -1;
Dynamic<NBTBase> dynamic = mcServer.getDataFixer().update(DataFixTypes.LEVEL.a(),
new Dynamic<>(DynamicOpsNBT.a, levelData), dataVersion, SharedConstants.getGameVersion()
.getWorldVersion());

SlimePropertyMap propertyMap = world.getPropertyMap();
Properties properties = new Properties();
String defaultBiome = propertyMap.getString(SlimeProperties.DEFAULT_BIOME);
String generatorString = "{\"structures\":{\"structures\":{}},\"biome\":\"" + defaultBiome + "\",\"layers\":[]}";

properties.put("generator-settings", generatorString);
properties.put("level-type", "FLAT");

GeneratorSettings generatorSettings = GeneratorSettings.a(properties);

Lifecycle lifecycle = Lifecycle.stable();
LevelVersion levelVersion = LevelVersion.a(dynamic);
WorldSettings worldSettings = WorldSettings.a(dynamic, mcServer.datapackconfiguration);
Expand All @@ -228,12 +235,13 @@ private WorldDataServer createWorldData(SlimeWorld world) {
} else {
EnumDifficulty difficulty = ((DedicatedServer) mcServer).getDedicatedServerProperties().difficulty;
EnumGamemode defaultGamemode = ((DedicatedServer) mcServer).getDedicatedServerProperties().gamemode;
WorldSettings worldSettings = new WorldSettings(world.getName(), defaultGamemode, false,
WorldSettings worldSettings = new WorldSettings(worldName, defaultGamemode, false,
difficulty, false, new GameRules(), mcServer.datapackconfiguration);
worldDataServer = new WorldDataServer(worldSettings, generatorSettings, Lifecycle.stable());
worldDataServer = new WorldDataServer(worldSettings, ((DedicatedServer) mcServer)
.getDedicatedServerProperties().generatorSettings, Lifecycle.stable());
}

worldDataServer.checkName(world.getName());
worldDataServer.checkName(worldName);
worldDataServer.a(mcServer.getServerModName(), mcServer.getModded().isPresent());
worldDataServer.c(true);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -168,26 +168,28 @@ private World.Environment getEnvironment(SlimeWorld world) {
}

private WorldDataServer createWorldData(SlimeWorld world) {
String worldName = world.getName();
CompoundTag extraData = world.getExtraData();
WorldDataServer worldDataServer;
NBTTagCompound extraTag = (NBTTagCompound) Converter.convertTag(world.getExtraData());
NBTTagCompound extraTag = (NBTTagCompound) Converter.convertTag(extraData);
MinecraftServer mcServer = MinecraftServer.getServer();

SlimePropertyMap propertyMap = world.getPropertyMap();
Properties properties = new Properties();
String defaultBiome = propertyMap.getString(SlimeProperties.DEFAULT_BIOME);
String generatorString = "{\"structures\":{\"structures\":{}},\"biome\":\"" + defaultBiome + "\",\"layers\":[]}";

properties.put("generator-settings", generatorString);
properties.put("level-type", "FLAT");

GeneratorSettings generatorSettings = GeneratorSettings.a(mcServer.getCustomRegistry(), properties);

if (extraTag.hasKeyOfType("LevelData", CraftMagicNumbers.NBT.TAG_COMPOUND)) {
NBTTagCompound levelData = extraTag.getCompound("LevelData");
int dataVersion = levelData.hasKeyOfType("DataVersion", 99) ? levelData.getInt("DataVersion") : -1;
Dynamic<NBTBase> dynamic = mcServer.getDataFixer().update(DataFixTypes.LEVEL.a(),
new Dynamic<>(DynamicOpsNBT.a, levelData), dataVersion, SharedConstants.getGameVersion()
.getWorldVersion());

SlimePropertyMap propertyMap = world.getPropertyMap();
Properties properties = new Properties();
String defaultBiome = propertyMap.getString(SlimeProperties.DEFAULT_BIOME);
String generatorString = "{\"structures\":{\"structures\":{}},\"biome\":\"" + defaultBiome + "\",\"layers\":[]}";

properties.put("generator-settings", generatorString);
properties.put("level-type", "FLAT");

GeneratorSettings generatorSettings = GeneratorSettings.a(mcServer.getCustomRegistry(), properties);
Lifecycle lifecycle = Lifecycle.stable();
LevelVersion levelVersion = LevelVersion.a(dynamic);
WorldSettings worldSettings = WorldSettings.a(dynamic, mcServer.datapackconfiguration);
Expand All @@ -197,13 +199,13 @@ private WorldDataServer createWorldData(SlimeWorld world) {
} else {
EnumDifficulty difficulty = ((DedicatedServer) mcServer).getDedicatedServerProperties().difficulty;
EnumGamemode defaultGamemode = ((DedicatedServer) mcServer).getDedicatedServerProperties().gamemode;
WorldSettings worldSettings = new WorldSettings(world.getName(), defaultGamemode, false,
WorldSettings worldSettings = new WorldSettings(worldName, defaultGamemode, false,
difficulty, false, new GameRules(), mcServer.datapackconfiguration);
worldDataServer = new WorldDataServer(worldSettings, ((DedicatedServer) mcServer)
.getDedicatedServerProperties().generatorSettings, Lifecycle.stable());
}

worldDataServer.checkName(world.getName());
worldDataServer.checkName(worldName);
worldDataServer.a(mcServer.getServerModName(), mcServer.getModded().isPresent());
worldDataServer.c(true);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -168,26 +168,28 @@ private World.Environment getEnvironment(SlimeWorld world) {
}

private WorldDataServer createWorldData(SlimeWorld world) {
String worldName = world.getName();
CompoundTag extraData = world.getExtraData();
WorldDataServer worldDataServer;
NBTTagCompound extraTag = (NBTTagCompound) Converter.convertTag(world.getExtraData());
NBTTagCompound extraTag = (NBTTagCompound) Converter.convertTag(extraData);
MinecraftServer mcServer = MinecraftServer.getServer();

SlimePropertyMap propertyMap = world.getPropertyMap();
Properties properties = new Properties();
String defaultBiome = propertyMap.getString(SlimeProperties.DEFAULT_BIOME);
String generatorString = "{\"structures\":{\"structures\":{}},\"biome\":\"" + defaultBiome + "\",\"layers\":[]}";

properties.put("generator-settings", generatorString);
properties.put("level-type", "FLAT");

GeneratorSettings generatorSettings = GeneratorSettings.a(mcServer.getCustomRegistry(), properties);

if (extraTag.hasKeyOfType("LevelData", CraftMagicNumbers.NBT.TAG_COMPOUND)) {
NBTTagCompound levelData = extraTag.getCompound("LevelData");
int dataVersion = levelData.hasKeyOfType("DataVersion", 99) ? levelData.getInt("DataVersion") : -1;
Dynamic<NBTBase> dynamic = mcServer.getDataFixer().update(DataFixTypes.LEVEL.a(),
new Dynamic<>(DynamicOpsNBT.a, levelData), dataVersion, SharedConstants.getGameVersion()
.getWorldVersion());

SlimePropertyMap propertyMap = world.getPropertyMap();
Properties properties = new Properties();
String defaultBiome = propertyMap.getString(SlimeProperties.DEFAULT_BIOME);
String generatorString = "{\"structures\":{\"structures\":{}},\"biome\":\"" + defaultBiome + "\",\"layers\":[]}";

properties.put("generator-settings", generatorString);
properties.put("level-type", "FLAT");

GeneratorSettings generatorSettings = GeneratorSettings.a(mcServer.getCustomRegistry(), properties);
Lifecycle lifecycle = Lifecycle.stable();
LevelVersion levelVersion = LevelVersion.a(dynamic);
WorldSettings worldSettings = WorldSettings.a(dynamic, mcServer.datapackconfiguration);
Expand All @@ -197,13 +199,13 @@ private WorldDataServer createWorldData(SlimeWorld world) {
} else {
EnumDifficulty difficulty = ((DedicatedServer) mcServer).getDedicatedServerProperties().difficulty;
EnumGamemode defaultGamemode = ((DedicatedServer) mcServer).getDedicatedServerProperties().gamemode;
WorldSettings worldSettings = new WorldSettings(world.getName(), defaultGamemode, false,
WorldSettings worldSettings = new WorldSettings(worldName, defaultGamemode, false,
difficulty, false, new GameRules(), mcServer.datapackconfiguration);
worldDataServer = new WorldDataServer(worldSettings, ((DedicatedServer) mcServer)
.getDedicatedServerProperties().generatorSettings, Lifecycle.stable());
}

worldDataServer.checkName(world.getName());
worldDataServer.checkName(worldName);
worldDataServer.a(mcServer.getServerModName(), mcServer.getModded().isPresent());
worldDataServer.c(true);

Expand Down

0 comments on commit e988b7a

Please sign in to comment.