WorldInfo .java

net.minecraft.world.storage.WorldInfo (class, 929 lines): members: populateFromWorldSettings, getBorderWarningDistance, setBorderWarningDistance, spawnX.

net.minecraft.world.storageclass929 linescommon25.0 KB

API Surface (78)

void populateFromWorldSettings(WorldSettings settings)
NBTTagCompound getNBTTagCompound()
NBTTagCompound cloneNBTCompound(NBTTagCompound nbt)
long getSeed()
int getSpawnX()
int getSpawnY()
int getSpawnZ()
long getWorldTotalTime()
long getWorldTime()
long getSizeOnDisk()
NBTTagCompound getPlayerNBTTagCompound()
void setSpawnX(int x)
void setSpawnY(int y)
void setSpawnZ(int z)
void setWorldTotalTime(long time)
void setWorldTime(long time)
void setSpawn(BlockPos spawnPoint)
String getWorldName()
void setWorldName(String worldName)
int getSaveVersion()
void setSaveVersion(int version)
long getLastTimePlayed()
int getCleanWeatherTime()
void setCleanWeatherTime(int cleanWeatherTimeIn)
boolean isThundering()
void setThundering(boolean thunderingIn)
int getThunderTime()
void setThunderTime(int time)
boolean isRaining()
void setRaining(boolean isRaining)
int getRainTime()
void setRainTime(int time)
WorldSettings.GameType getGameType()
boolean isMapFeaturesEnabled()
void setMapFeaturesEnabled(boolean enabled)
void setGameType(WorldSettings.GameType type)
boolean isHardcoreModeEnabled()
void setHardcore(boolean hardcoreIn)
WorldType getTerrainType()
void setTerrainType(WorldType type)
String getGeneratorOptions()
boolean areCommandsAllowed()
void setAllowCommands(boolean allow)
boolean isInitialized()
void setServerInitialized(boolean initializedIn)
GameRules getGameRulesInstance()
double getBorderCenterX()
double getBorderCenterZ()
double getBorderSize()
void setBorderSize(double size)
long getBorderLerpTime()
void setBorderLerpTime(long time)
double getBorderLerpTarget()
void setBorderLerpTarget(double lerpSize)
void getBorderCenterZ(double posZ)
void getBorderCenterX(double posX)
double getBorderSafeZone()
void setBorderSafeZone(double amount)
double getBorderDamagePerBlock()
void setBorderDamagePerBlock(double damage)
int getBorderWarningDistance()
int getBorderWarningTime()
void setBorderWarningDistance(int amountOfBlocks)
void setBorderWarningTime(int ticks)
EnumDifficulty getDifficulty()
void setDifficulty(EnumDifficulty newDifficulty)
boolean isDifficultyLocked()
void setDifficultyLocked(boolean locked)
void addToCrashReport(CrashReportCategory category)
String call()
String call()
String call()
String call()
String call()
String call()
String call()
String call()
String call()

Fields & Constants (37)

DEFAULT_DIFFICULTY
randomSeed
terrainType
generatorOptions
spawnX
spawnY
spawnZ
totalTime
worldTime
lastTimePlayed
sizeOnDisk
playerTag
dimension
levelName
saveVersion
cleanWeatherTime
raining
rainTime
thundering
thunderTime
theGameType
mapFeaturesEnabled
hardcore
allowCommands
initialized

…and 12 more (see full source).

String literals (49)

"RandomSeed"
"generatorName"
"generatorVersion"
"generatorOptions"
"GameType"
"MapFeatures"
"SpawnX"
"SpawnY"
"SpawnZ"
"Time"
"DayTime"
"LastPlayed"
"SizeOnDisk"
"LevelName"
"version"
"clearWeatherTime"
"rainTime"
"raining"
"thunderTime"
"thundering"
"hardcore"
"initialized"
"allowCommands"
"Player"

Full Source

WorldInfo.java929 lines · MCP 1.8.9 · verbatimOriginal ↗
1
package net.minecraft.world.storage;
2
3
import java.util.concurrent.Callable;
4
import net.minecraft.crash.CrashReportCategory;
5
import net.minecraft.nbt.NBTTagCompound;
6
import net.minecraft.server.MinecraftServer;
7
import net.minecraft.util.BlockPos;
8
import net.minecraft.world.EnumDifficulty;
9
import net.minecraft.world.GameRules;
10
import net.minecraft.world.WorldSettings;
11
import net.minecraft.world.WorldType;
12
13
public class WorldInfo
14
{
15
    public static final EnumDifficulty DEFAULT_DIFFICULTY = EnumDifficulty.NORMAL;
16
17
    /** Holds the seed of the currently world. */
18
    private long randomSeed;
19
    private WorldType terrainType = WorldType.DEFAULT;
20
    private String generatorOptions = "";
21
22
    /** The spawn zone position X coordinate. */
23
    private int spawnX;
24
25
    /** The spawn zone position Y coordinate. */
26
    private int spawnY;
27
28
    /** The spawn zone position Z coordinate. */
29
    private int spawnZ;
30
31
    /** Total time for this world. */
32
    private long totalTime;
33
34
    /** The current world time in ticks, ranging from 0 to 23999. */
35
    private long worldTime;
36
37
    /** The last time the player was in this world. */
38
    private long lastTimePlayed;
39
40
    /** The size of entire save of current world on the disk, isn't exactly. */
41
    private long sizeOnDisk;
42
    private NBTTagCompound playerTag;
43
    private int dimension;
44
45
    /** The name of the save defined at world creation. */
46
    private String levelName;
47
48
    /** Introduced in beta 1.3, is the save version for future control. */
49
    private int saveVersion;
50
    private int cleanWeatherTime;
51
52
    /** True if it's raining, false otherwise. */
53
    private boolean raining;
54
55
    /** Number of ticks until next rain. */
56
    private int rainTime;
57
58
    /** Is thunderbolts failing now? */
59
    private boolean thundering;
60
61
    /** Number of ticks untils next thunderbolt. */
62
    private int thunderTime;
63
64
    /** The Game Type. */
65
    private WorldSettings.GameType theGameType;
66
67
    /**
68
     * Whether the map features (e.g. strongholds) generation is enabled or disabled.
69
     */
70
    private boolean mapFeaturesEnabled;
71
72
    /** Hardcore mode flag */
73
    private boolean hardcore;
74
    private boolean allowCommands;
75
    private boolean initialized;
76
    private EnumDifficulty difficulty;
77
    private boolean difficultyLocked;
78
    private double borderCenterX = 0.0D;
79
    private double borderCenterZ = 0.0D;
80
    private double borderSize = 6.0E7D;
81
    private long borderSizeLerpTime = 0L;
82
    private double borderSizeLerpTarget = 0.0D;
83
    private double borderSafeZone = 5.0D;
84
    private double borderDamagePerBlock = 0.2D;
85
    private int borderWarningDistance = 5;
86
    private int borderWarningTime = 15;
87
    private GameRules theGameRules = new GameRules();
88
89
    protected WorldInfo()
90
    {
91
    }
92
93
    public WorldInfo(NBTTagCompound nbt)
94
    {
95
        this.randomSeed = nbt.getLong("RandomSeed");
96
97
        if (nbt.hasKey("generatorName", 8))
98
        {
99
            String s = nbt.getString("generatorName");
100
            this.terrainType = WorldType.parseWorldType(s);
101
102
            if (this.terrainType == null)
103
            {
104
                this.terrainType = WorldType.DEFAULT;
105
            }
106
            else if (this.terrainType.isVersioned())
107
            {
108
                int i = 0;
109
110
                if (nbt.hasKey("generatorVersion", 99))
111
                {
112
                    i = nbt.getInteger("generatorVersion");
113
                }
114
115
                this.terrainType = this.terrainType.getWorldTypeForGeneratorVersion(i);
116
            }
117
118
            if (nbt.hasKey("generatorOptions", 8))
119
            {
120
                this.generatorOptions = nbt.getString("generatorOptions");
121
            }
122
        }
123
124
        this.theGameType = WorldSettings.GameType.getByID(nbt.getInteger("GameType"));
125
126
        if (nbt.hasKey("MapFeatures", 99))
127
        {
128
            this.mapFeaturesEnabled = nbt.getBoolean("MapFeatures");
129
        }
130
        else
131
        {
132
            this.mapFeaturesEnabled = true;
133
        }
134
135
        this.spawnX = nbt.getInteger("SpawnX");
136
        this.spawnY = nbt.getInteger("SpawnY");
137
        this.spawnZ = nbt.getInteger("SpawnZ");
138
        this.totalTime = nbt.getLong("Time");
139
140
        if (nbt.hasKey("DayTime", 99))
141
        {
142
            this.worldTime = nbt.getLong("DayTime");
143
        }
144
        else
145
        {
146
            this.worldTime = this.totalTime;
147
        }
148
149
        this.lastTimePlayed = nbt.getLong("LastPlayed");
150
        this.sizeOnDisk = nbt.getLong("SizeOnDisk");
151
        this.levelName = nbt.getString("LevelName");
152
        this.saveVersion = nbt.getInteger("version");
153
        this.cleanWeatherTime = nbt.getInteger("clearWeatherTime");
154
        this.rainTime = nbt.getInteger("rainTime");
155
        this.raining = nbt.getBoolean("raining");
156
        this.thunderTime = nbt.getInteger("thunderTime");
157
        this.thundering = nbt.getBoolean("thundering");
158
        this.hardcore = nbt.getBoolean("hardcore");
159
160
        if (nbt.hasKey("initialized", 99))
161
        {
162
            this.initialized = nbt.getBoolean("initialized");
163
        }
164
        else
165
        {
166
            this.initialized = true;
167
        }
168
169
        if (nbt.hasKey("allowCommands", 99))
170
        {
171
            this.allowCommands = nbt.getBoolean("allowCommands");
172
        }
173
        else
174
        {
175
            this.allowCommands = this.theGameType == WorldSettings.GameType.CREATIVE;
176
        }
177
178
        if (nbt.hasKey("Player", 10))
179
        {
180
            this.playerTag = nbt.getCompoundTag("Player");
181
            this.dimension = this.playerTag.getInteger("Dimension");
182
        }
183
184
        if (nbt.hasKey("GameRules", 10))
185
        {
186
            this.theGameRules.readFromNBT(nbt.getCompoundTag("GameRules"));
187
        }
188
189
        if (nbt.hasKey("Difficulty", 99))
190
        {
191
            this.difficulty = EnumDifficulty.getDifficultyEnum(nbt.getByte("Difficulty"));
192
        }
193
194
        if (nbt.hasKey("DifficultyLocked", 1))
195
        {
196
            this.difficultyLocked = nbt.getBoolean("DifficultyLocked");
197
        }
198
199
        if (nbt.hasKey("BorderCenterX", 99))
200
        {
201
            this.borderCenterX = nbt.getDouble("BorderCenterX");
202
        }
203
204
        if (nbt.hasKey("BorderCenterZ", 99))
205
        {
206
            this.borderCenterZ = nbt.getDouble("BorderCenterZ");
207
        }
208
209
        if (nbt.hasKey("BorderSize", 99))
210
        {
211
            this.borderSize = nbt.getDouble("BorderSize");
212
        }
213
214
        if (nbt.hasKey("BorderSizeLerpTime", 99))
215
        {
216
            this.borderSizeLerpTime = nbt.getLong("BorderSizeLerpTime");
217
        }
218
219
        if (nbt.hasKey("BorderSizeLerpTarget", 99))
220
        {
221
            this.borderSizeLerpTarget = nbt.getDouble("BorderSizeLerpTarget");
222
        }
223
224
        if (nbt.hasKey("BorderSafeZone", 99))
225
        {
226
            this.borderSafeZone = nbt.getDouble("BorderSafeZone");
227
        }
228
229
        if (nbt.hasKey("BorderDamagePerBlock", 99))
230
        {
231
            this.borderDamagePerBlock = nbt.getDouble("BorderDamagePerBlock");
232
        }
233
234
        if (nbt.hasKey("BorderWarningBlocks", 99))
235
        {
236
            this.borderWarningDistance = nbt.getInteger("BorderWarningBlocks");
237
        }
238
239
        if (nbt.hasKey("BorderWarningTime", 99))
240
        {
241
            this.borderWarningTime = nbt.getInteger("BorderWarningTime");
242
        }
243
    }
244
245
    public WorldInfo(WorldSettings settings, String name)
246
    {
247
        this.populateFromWorldSettings(settings);
248
        this.levelName = name;
249
        this.difficulty = DEFAULT_DIFFICULTY;
250
        this.initialized = false;
251
    }
252
253
    public void populateFromWorldSettings(WorldSettings settings)
254
    {
255
        this.randomSeed = settings.getSeed();
256
        this.theGameType = settings.getGameType();
257
        this.mapFeaturesEnabled = settings.isMapFeaturesEnabled();
258
        this.hardcore = settings.getHardcoreEnabled();
259
        this.terrainType = settings.getTerrainType();
260
        this.generatorOptions = settings.getWorldName();
261
        this.allowCommands = settings.areCommandsAllowed();
262
    }
263
264
    public WorldInfo(WorldInfo worldInformation)
265
    {
266
        this.randomSeed = worldInformation.randomSeed;
267
        this.terrainType = worldInformation.terrainType;
268
        this.generatorOptions = worldInformation.generatorOptions;
269
        this.theGameType = worldInformation.theGameType;
270
        this.mapFeaturesEnabled = worldInformation.mapFeaturesEnabled;
271
        this.spawnX = worldInformation.spawnX;
272
        this.spawnY = worldInformation.spawnY;
273
        this.spawnZ = worldInformation.spawnZ;
274
        this.totalTime = worldInformation.totalTime;
275
        this.worldTime = worldInformation.worldTime;
276
        this.lastTimePlayed = worldInformation.lastTimePlayed;
277
        this.sizeOnDisk = worldInformation.sizeOnDisk;
278
        this.playerTag = worldInformation.playerTag;
279
        this.dimension = worldInformation.dimension;
280
        this.levelName = worldInformation.levelName;
281
        this.saveVersion = worldInformation.saveVersion;
282
        this.rainTime = worldInformation.rainTime;
283
        this.raining = worldInformation.raining;
284
        this.thunderTime = worldInformation.thunderTime;
285
        this.thundering = worldInformation.thundering;
286
        this.hardcore = worldInformation.hardcore;
287
        this.allowCommands = worldInformation.allowCommands;
288
        this.initialized = worldInformation.initialized;
289
        this.theGameRules = worldInformation.theGameRules;
290
        this.difficulty = worldInformation.difficulty;
291
        this.difficultyLocked = worldInformation.difficultyLocked;
292
        this.borderCenterX = worldInformation.borderCenterX;
293
        this.borderCenterZ = worldInformation.borderCenterZ;
294
        this.borderSize = worldInformation.borderSize;
295
        this.borderSizeLerpTime = worldInformation.borderSizeLerpTime;
296
        this.borderSizeLerpTarget = worldInformation.borderSizeLerpTarget;
297
        this.borderSafeZone = worldInformation.borderSafeZone;
298
        this.borderDamagePerBlock = worldInformation.borderDamagePerBlock;
299
        this.borderWarningTime = worldInformation.borderWarningTime;
300
        this.borderWarningDistance = worldInformation.borderWarningDistance;
301
    }
302
303
    /**
304
     * Gets the NBTTagCompound for the worldInfo
305
     */
306
    public NBTTagCompound getNBTTagCompound()
307
    {
308
        NBTTagCompound nbttagcompound = new NBTTagCompound();
309
        this.updateTagCompound(nbttagcompound, this.playerTag);
310
        return nbttagcompound;
311
    }
312
313
    /**
314
     * Creates a new NBTTagCompound for the world, with the given NBTTag as the "Player"
315
     */
316
    public NBTTagCompound cloneNBTCompound(NBTTagCompound nbt)
317
    {
318
        NBTTagCompound nbttagcompound = new NBTTagCompound();
319
        this.updateTagCompound(nbttagcompound, nbt);
320
        return nbttagcompound;
321
    }
322
323
    private void updateTagCompound(NBTTagCompound nbt, NBTTagCompound playerNbt)
324
    {
325
        nbt.setLong("RandomSeed", this.randomSeed);
326
        nbt.setString("generatorName", this.terrainType.getWorldTypeName());
327
        nbt.setInteger("generatorVersion", this.terrainType.getGeneratorVersion());
328
        nbt.setString("generatorOptions", this.generatorOptions);
329
        nbt.setInteger("GameType", this.theGameType.getID());
330
        nbt.setBoolean("MapFeatures", this.mapFeaturesEnabled);
331
        nbt.setInteger("SpawnX", this.spawnX);
332
        nbt.setInteger("SpawnY", this.spawnY);
333
        nbt.setInteger("SpawnZ", this.spawnZ);
334
        nbt.setLong("Time", this.totalTime);
335
        nbt.setLong("DayTime", this.worldTime);
336
        nbt.setLong("SizeOnDisk", this.sizeOnDisk);
337
        nbt.setLong("LastPlayed", MinecraftServer.getCurrentTimeMillis());
338
        nbt.setString("LevelName", this.levelName);
339
        nbt.setInteger("version", this.saveVersion);
340
        nbt.setInteger("clearWeatherTime", this.cleanWeatherTime);
341
        nbt.setInteger("rainTime", this.rainTime);
342
        nbt.setBoolean("raining", this.raining);
343
        nbt.setInteger("thunderTime", this.thunderTime);
344
        nbt.setBoolean("thundering", this.thundering);
345
        nbt.setBoolean("hardcore", this.hardcore);
346
        nbt.setBoolean("allowCommands", this.allowCommands);
347
        nbt.setBoolean("initialized", this.initialized);
348
        nbt.setDouble("BorderCenterX", this.borderCenterX);
349
        nbt.setDouble("BorderCenterZ", this.borderCenterZ);
350
        nbt.setDouble("BorderSize", this.borderSize);
351
        nbt.setLong("BorderSizeLerpTime", this.borderSizeLerpTime);
352
        nbt.setDouble("BorderSafeZone", this.borderSafeZone);
353
        nbt.setDouble("BorderDamagePerBlock", this.borderDamagePerBlock);
354
        nbt.setDouble("BorderSizeLerpTarget", this.borderSizeLerpTarget);
355
        nbt.setDouble("BorderWarningBlocks", (double)this.borderWarningDistance);
356
        nbt.setDouble("BorderWarningTime", (double)this.borderWarningTime);
357
358
        if (this.difficulty != null)
359
        {
360
            nbt.setByte("Difficulty", (byte)this.difficulty.getDifficultyId());
361
        }
362
363
        nbt.setBoolean("DifficultyLocked", this.difficultyLocked);
364
        nbt.setTag("GameRules", this.theGameRules.writeToNBT());
365
366
        if (playerNbt != null)
367
        {
368
            nbt.setTag("Player", playerNbt);
369
        }
370
    }
371
372
    /**
373
     * Returns the seed of current world.
374
     */
375
    public long getSeed()
376
    {
377
        return this.randomSeed;
378
    }
379
380
    /**
381
     * Returns the x spawn position
382
     */
383
    public int getSpawnX()
384
    {
385
        return this.spawnX;
386
    }
387
388
    /**
389
     * Return the Y axis spawning point of the player.
390
     */
391
    public int getSpawnY()
392
    {
393
        return this.spawnY;
394
    }
395
396
    /**
397
     * Returns the z spawn position
398
     */
399
    public int getSpawnZ()
400
    {
401
        return this.spawnZ;
402
    }
403
404
    public long getWorldTotalTime()
405
    {
406
        return this.totalTime;
407
    }
408
409
    /**
410
     * Get current world time
411
     */
412
    public long getWorldTime()
413
    {
414
        return this.worldTime;
415
    }
416
417
    public long getSizeOnDisk()
418
    {
419
        return this.sizeOnDisk;
420
    }
421
422
    /**
423
     * Returns the player's NBTTagCompound to be loaded
424
     */
425
    public NBTTagCompound getPlayerNBTTagCompound()
426
    {
427
        return this.playerTag;
428
    }
429
430
    /**
431
     * Set the x spawn position to the passed in value
432
     */
433
    public void setSpawnX(int x)
434
    {
435
        this.spawnX = x;
436
    }
437
438
    /**
439
     * Sets the y spawn position
440
     */
441
    public void setSpawnY(int y)
442
    {
443
        this.spawnY = y;
444
    }
445
446
    /**
447
     * Set the z spawn position to the passed in value
448
     */
449
    public void setSpawnZ(int z)
450
    {
451
        this.spawnZ = z;
452
    }
453
454
    public void setWorldTotalTime(long time)
455
    {
456
        this.totalTime = time;
457
    }
458
459
    /**
460
     * Set current world time
461
     */
462
    public void setWorldTime(long time)
463
    {
464
        this.worldTime = time;
465
    }
466
467
    public void setSpawn(BlockPos spawnPoint)
468
    {
469
        this.spawnX = spawnPoint.getX();
470
        this.spawnY = spawnPoint.getY();
471
        this.spawnZ = spawnPoint.getZ();
472
    }
473
474
    /**
475
     * Get current world name
476
     */
477
    public String getWorldName()
478
    {
479
        return this.levelName;
480
    }
481
482
    public void setWorldName(String worldName)
483
    {
484
        this.levelName = worldName;
485
    }
486
487
    /**
488
     * Returns the save version of this world
489
     */
490
    public int getSaveVersion()
491
    {
492
        return this.saveVersion;
493
    }
494
495
    /**
496
     * Sets the save version of the world
497
     */
498
    public void setSaveVersion(int version)
499
    {
500
        this.saveVersion = version;
501
    }
502
503
    /**
504
     * Return the last time the player was in this world.
505
     */
506
    public long getLastTimePlayed()
507
    {
508
        return this.lastTimePlayed;
509
    }
510
511
    public int getCleanWeatherTime()
512
    {
513
        return this.cleanWeatherTime;
514
    }
515
516
    public void setCleanWeatherTime(int cleanWeatherTimeIn)
517
    {
518
        this.cleanWeatherTime = cleanWeatherTimeIn;
519
    }
520
521
    /**
522
     * Returns true if it is thundering, false otherwise.
523
     */
524
    public boolean isThundering()
525
    {
526
        return this.thundering;
527
    }
528
529
    /**
530
     * Sets whether it is thundering or not.
531
     */
532
    public void setThundering(boolean thunderingIn)
533
    {
534
        this.thundering = thunderingIn;
535
    }
536
537
    /**
538
     * Returns the number of ticks until next thunderbolt.
539
     */
540
    public int getThunderTime()
541
    {
542
        return this.thunderTime;
543
    }
544
545
    /**
546
     * Defines the number of ticks until next thunderbolt.
547
     */
548
    public void setThunderTime(int time)
549
    {
550
        this.thunderTime = time;
551
    }
552
553
    /**
554
     * Returns true if it is raining, false otherwise.
555
     */
556
    public boolean isRaining()
557
    {
558
        return this.raining;
559
    }
560
561
    /**
562
     * Sets whether it is raining or not.
563
     */
564
    public void setRaining(boolean isRaining)
565
    {
566
        this.raining = isRaining;
567
    }
568
569
    /**
570
     * Return the number of ticks until rain.
571
     */
572
    public int getRainTime()
573
    {
574
        return this.rainTime;
575
    }
576
577
    /**
578
     * Sets the number of ticks until rain.
579
     */
580
    public void setRainTime(int time)
581
    {
582
        this.rainTime = time;
583
    }
584
585
    /**
586
     * Gets the GameType.
587
     */
588
    public WorldSettings.GameType getGameType()
589
    {
590
        return this.theGameType;
591
    }
592
593
    /**
594
     * Get whether the map features (e.g. strongholds) generation is enabled or disabled.
595
     */
596
    public boolean isMapFeaturesEnabled()
597
    {
598
        return this.mapFeaturesEnabled;
599
    }
600
601
    public void setMapFeaturesEnabled(boolean enabled)
602
    {
603
        this.mapFeaturesEnabled = enabled;
604
    }
605
606
    /**
607
     * Sets the GameType.
608
     */
609
    public void setGameType(WorldSettings.GameType type)
610
    {
611
        this.theGameType = type;
612
    }
613
614
    /**
615
     * Returns true if hardcore mode is enabled, otherwise false
616
     */
617
    public boolean isHardcoreModeEnabled()
618
    {
619
        return this.hardcore;
620
    }
621
622
    public void setHardcore(boolean hardcoreIn)
623
    {
624
        this.hardcore = hardcoreIn;
625
    }
626
627
    public WorldType getTerrainType()
628
    {
629
        return this.terrainType;
630
    }
631
632
    public void setTerrainType(WorldType type)
633
    {
634
        this.terrainType = type;
635
    }
636
637
    public String getGeneratorOptions()
638
    {
639
        return this.generatorOptions;
640
    }
641
642
    /**
643
     * Returns true if commands are allowed on this World.
644
     */
645
    public boolean areCommandsAllowed()
646
    {
647
        return this.allowCommands;
648
    }
649
650
    public void setAllowCommands(boolean allow)
651
    {
652
        this.allowCommands = allow;
653
    }
654
655
    /**
656
     * Returns true if the World is initialized.
657
     */
658
    public boolean isInitialized()
659
    {
660
        return this.initialized;
661
    }
662
663
    /**
664
     * Sets the initialization status of the World.
665
     */
666
    public void setServerInitialized(boolean initializedIn)
667
    {
668
        this.initialized = initializedIn;
669
    }
670
671
    /**
672
     * Gets the GameRules class Instance.
673
     */
674
    public GameRules getGameRulesInstance()
675
    {
676
        return this.theGameRules;
677
    }
678
679
    /**
680
     * Returns the border center X position
681
     */
682
    public double getBorderCenterX()
683
    {
684
        return this.borderCenterX;
685
    }
686
687
    /**
688
     * Returns the border center Z position
689
     */
690
    public double getBorderCenterZ()
691
    {
692
        return this.borderCenterZ;
693
    }
694
695
    public double getBorderSize()
696
    {
697
        return this.borderSize;
698
    }
699
700
    /**
701
     * Sets the border size
702
     */
703
    public void setBorderSize(double size)
704
    {
705
        this.borderSize = size;
706
    }
707
708
    /**
709
     * Returns the border lerp time
710
     */
711
    public long getBorderLerpTime()
712
    {
713
        return this.borderSizeLerpTime;
714
    }
715
716
    /**
717
     * Sets the border lerp time
718
     */
719
    public void setBorderLerpTime(long time)
720
    {
721
        this.borderSizeLerpTime = time;
722
    }
723
724
    /**
725
     * Returns the border lerp target
726
     */
727
    public double getBorderLerpTarget()
728
    {
729
        return this.borderSizeLerpTarget;
730
    }
731
732
    /**
733
     * Sets the border lerp target
734
     */
735
    public void setBorderLerpTarget(double lerpSize)
736
    {
737
        this.borderSizeLerpTarget = lerpSize;
738
    }
739
740
    /**
741
     * Sets the border center Z position
742
     */
743
    public void getBorderCenterZ(double posZ)
744
    {
745
        this.borderCenterZ = posZ;
746
    }
747
748
    /**
749
     * Sets the border center X position
750
     */
751
    public void getBorderCenterX(double posX)
752
    {
753
        this.borderCenterX = posX;
754
    }
755
756
    /**
757
     * Returns the border safe zone
758
     */
759
    public double getBorderSafeZone()
760
    {
761
        return this.borderSafeZone;
762
    }
763
764
    /**
765
     * Sets the border safe zone
766
     */
767
    public void setBorderSafeZone(double amount)
768
    {
769
        this.borderSafeZone = amount;
770
    }
771
772
    /**
773
     * Returns the border damage per block
774
     */
775
    public double getBorderDamagePerBlock()
776
    {
777
        return this.borderDamagePerBlock;
778
    }
779
780
    /**
781
     * Sets the border damage per block
782
     */
783
    public void setBorderDamagePerBlock(double damage)
784
    {
785
        this.borderDamagePerBlock = damage;
786
    }
787
788
    /**
789
     * Returns the border warning distance
790
     */
791
    public int getBorderWarningDistance()
792
    {
793
        return this.borderWarningDistance;
794
    }
795
796
    /**
797
     * Returns the border warning time
798
     */
799
    public int getBorderWarningTime()
800
    {
801
        return this.borderWarningTime;
802
    }
803
804
    /**
805
     * Sets the border warning distance
806
     */
807
    public void setBorderWarningDistance(int amountOfBlocks)
808
    {
809
        this.borderWarningDistance = amountOfBlocks;
810
    }
811
812
    /**
813
     * Sets the border warning time
814
     */
815
    public void setBorderWarningTime(int ticks)
816
    {
817
        this.borderWarningTime = ticks;
818
    }
819
820
    public EnumDifficulty getDifficulty()
821
    {
822
        return this.difficulty;
823
    }
824
825
    public void setDifficulty(EnumDifficulty newDifficulty)
826
    {
827
        this.difficulty = newDifficulty;
828
    }
829
830
    public boolean isDifficultyLocked()
831
    {
832
        return this.difficultyLocked;
833
    }
834
835
    public void setDifficultyLocked(boolean locked)
836
    {
837
        this.difficultyLocked = locked;
838
    }
839
840
    /**
841
     * Adds this WorldInfo instance to the crash report.
842
     */
843
    public void addToCrashReport(CrashReportCategory category)
844
    {
845
        category.addCrashSectionCallable("Level seed", new Callable<String>()
846
        {
847
            public String call() throws Exception
848
            {
849
                return String.valueOf(WorldInfo.this.getSeed());
850
            }
851
        });
852
        category.addCrashSectionCallable("Level generator", new Callable<String>()
853
        {
854
            public String call() throws Exception
855
            {
856
                return String.format("ID %02d - %s, ver %d. Features enabled: %b", new Object[] {Integer.valueOf(WorldInfo.this.terrainType.getWorldTypeID()), WorldInfo.this.terrainType.getWorldTypeName(), Integer.valueOf(WorldInfo.this.terrainType.getGeneratorVersion()), Boolean.valueOf(WorldInfo.this.mapFeaturesEnabled)});
857
            }
858
        });
859
        category.addCrashSectionCallable("Level generator options", new Callable<String>()
860
        {
861
            public String call() throws Exception
862
            {
863
                return WorldInfo.this.generatorOptions;
864
            }
865
        });
866
        category.addCrashSectionCallable("Level spawn location", new Callable<String>()
867
        {
868
            public String call() throws Exception
869
            {
870
                return CrashReportCategory.getCoordinateInfo((double)WorldInfo.this.spawnX, (double)WorldInfo.this.spawnY, (double)WorldInfo.this.spawnZ);
871
            }
872
        });
873
        category.addCrashSectionCallable("Level time", new Callable<String>()
874
        {
875
            public String call() throws Exception
876
            {
877
                return String.format("%d game time, %d day time", new Object[] {Long.valueOf(WorldInfo.this.totalTime), Long.valueOf(WorldInfo.this.worldTime)});
878
            }
879
        });
880
        category.addCrashSectionCallable("Level dimension", new Callable<String>()
881
        {
882
            public String call() throws Exception
883
            {
884
                return String.valueOf(WorldInfo.this.dimension);
885
            }
886
        });
887
        category.addCrashSectionCallable("Level storage version", new Callable<String>()
888
        {
889
            public String call() throws Exception
890
            {
891
                String s = "Unknown?";
892
893
                try
894
                {
895
                    switch (WorldInfo.this.saveVersion)
896
                    {
897
                        case 19132:
898
                            s = "McRegion";
899
                            break;
900
901
                        case 19133:
902
                            s = "Anvil";
903
                    }
904
                }
905
                catch (Throwable var3)
906
                {
907
                    ;
908
                }
909
910
                return String.format("0x%05X - %s", new Object[] {Integer.valueOf(WorldInfo.this.saveVersion), s});
911
            }
912
        });
913
        category.addCrashSectionCallable("Level weather", new Callable<String>()
914
        {
915
            public String call() throws Exception
916
            {
917
                return String.format("Rain time: %d (now: %b), thunder time: %d (now: %b)", new Object[] {Integer.valueOf(WorldInfo.this.rainTime), Boolean.valueOf(WorldInfo.this.raining), Integer.valueOf(WorldInfo.this.thunderTime), Boolean.valueOf(WorldInfo.this.thundering)});
918
            }
919
        });
920
        category.addCrashSectionCallable("Level game mode", new Callable<String>()
921
        {
922
            public String call() throws Exception
923
            {
924
                return String.format("Game mode: %s (ID %d). Hardcore: %b. Cheats: %b", new Object[] {WorldInfo.this.theGameType.getName(), Integer.valueOf(WorldInfo.this.theGameType.getID()), Boolean.valueOf(WorldInfo.this.hardcore), Boolean.valueOf(WorldInfo.this.allowCommands)});
925
            }
926
        });
927
    }
928
}
929

Deobfuscated MCP 1.8.9 source of WorldInfo from Marcelektro/MavenMCP-1.8.9 (net/minecraft/world/storage/WorldInfo.java), stored verbatim.