|
@@ -10,6 +10,7 @@ import me.km.utils.ReflectionUtils;
|
|
|
import net.minecraft.nbt.CompoundNBT;
|
|
|
import net.minecraft.nbt.ListNBT;
|
|
|
import net.minecraft.server.MinecraftServer;
|
|
|
+import net.minecraft.util.math.BlockPos;
|
|
|
import net.minecraft.world.GameRules;
|
|
|
import static net.minecraft.world.GameRules.*;
|
|
|
import net.minecraft.world.WorldType;
|
|
@@ -42,6 +43,9 @@ public class ModWorldInfo extends DerivedWorldInfo {
|
|
|
private int thunderTime;
|
|
|
private Difficulty difficulty;
|
|
|
private final GameRules gameRules = new GameRules();
|
|
|
+ private int spawnX;
|
|
|
+ private int spawnY;
|
|
|
+ private int spawnZ;
|
|
|
|
|
|
private Type type;
|
|
|
|
|
@@ -58,6 +62,9 @@ public class ModWorldInfo extends DerivedWorldInfo {
|
|
|
}
|
|
|
|
|
|
private void onLoad(WorldInfo info, MinecraftServer server) {
|
|
|
+ spawnX = config.getInt("spawnX", info.getSpawnX());
|
|
|
+ spawnY = config.getInt("spawnY", info.getSpawnY());
|
|
|
+ spawnZ = config.getInt("spawnZ", info.getSpawnZ());
|
|
|
gameTime = config.getLong("gameTime", info.getGameTime());
|
|
|
dayTime = config.getLong("dayTime", info.getDayTime());
|
|
|
clearWeatherTime = config.getInt("clearWeatherTime", info.getClearWeatherTime());
|
|
@@ -113,6 +120,9 @@ public class ModWorldInfo extends DerivedWorldInfo {
|
|
|
}
|
|
|
|
|
|
public void onSave() {
|
|
|
+ config.set("spawnX", spawnX);
|
|
|
+ config.set("spawnY", spawnY);
|
|
|
+ config.set("spawnZ", spawnZ);
|
|
|
config.set("gameTime", gameTime);
|
|
|
config.set("dayTime", dayTime);
|
|
|
config.set("clearWeatherTime", clearWeatherTime);
|
|
@@ -272,4 +282,26 @@ public class ModWorldInfo extends DerivedWorldInfo {
|
|
|
}
|
|
|
return super.getGeneratorOptions();
|
|
|
}
|
|
|
+
|
|
|
+ @Override
|
|
|
+ public void setSpawn(BlockPos spawnPoint) {
|
|
|
+ spawnX = spawnPoint.getX();
|
|
|
+ spawnY = spawnPoint.getY();
|
|
|
+ spawnZ = spawnPoint.getZ();
|
|
|
+ }
|
|
|
+
|
|
|
+ @Override
|
|
|
+ public int getSpawnX() {
|
|
|
+ return spawnX;
|
|
|
+ }
|
|
|
+
|
|
|
+ @Override
|
|
|
+ public int getSpawnY() {
|
|
|
+ return spawnY;
|
|
|
+ }
|
|
|
+
|
|
|
+ @Override
|
|
|
+ public int getSpawnZ() {
|
|
|
+ return spawnZ;
|
|
|
+ }
|
|
|
}
|