| 1 | package net.minecraft.world;
|
| 2 |
|
| 3 | import net.minecraft.profiler.Profiler;
|
| 4 | import net.minecraft.server.MinecraftServer;
|
| 5 | import net.minecraft.village.VillageCollection;
|
| 6 | import net.minecraft.world.border.IBorderListener;
|
| 7 | import net.minecraft.world.border.WorldBorder;
|
| 8 | import net.minecraft.world.storage.DerivedWorldInfo;
|
| 9 | import net.minecraft.world.storage.ISaveHandler;
|
| 10 |
|
| 11 | public class WorldServerMulti extends WorldServer
|
| 12 | {
|
| 13 | private WorldServer delegate;
|
| 14 |
|
| 15 | public WorldServerMulti(MinecraftServer server, ISaveHandler saveHandlerIn, int dimensionId, WorldServer delegate, Profiler profilerIn)
|
| 16 | {
|
| 17 | super(server, saveHandlerIn, new DerivedWorldInfo(delegate.getWorldInfo()), dimensionId, profilerIn);
|
| 18 | this.delegate = delegate;
|
| 19 | delegate.getWorldBorder().addListener(new IBorderListener()
|
| 20 | {
|
| 21 | public void onSizeChanged(WorldBorder border, double newSize)
|
| 22 | {
|
| 23 | WorldServerMulti.this.getWorldBorder().setTransition(newSize);
|
| 24 | }
|
| 25 | public void onTransitionStarted(WorldBorder border, double oldSize, double newSize, long time)
|
| 26 | {
|
| 27 | WorldServerMulti.this.getWorldBorder().setTransition(oldSize, newSize, time);
|
| 28 | }
|
| 29 | public void onCenterChanged(WorldBorder border, double x, double z)
|
| 30 | {
|
| 31 | WorldServerMulti.this.getWorldBorder().setCenter(x, z);
|
| 32 | }
|
| 33 | public void onWarningTimeChanged(WorldBorder border, int newTime)
|
| 34 | {
|
| 35 | WorldServerMulti.this.getWorldBorder().setWarningTime(newTime);
|
| 36 | }
|
| 37 | public void onWarningDistanceChanged(WorldBorder border, int newDistance)
|
| 38 | {
|
| 39 | WorldServerMulti.this.getWorldBorder().setWarningDistance(newDistance);
|
| 40 | }
|
| 41 | public void onDamageAmountChanged(WorldBorder border, double newAmount)
|
| 42 | {
|
| 43 | WorldServerMulti.this.getWorldBorder().setDamageAmount(newAmount);
|
| 44 | }
|
| 45 | public void onDamageBufferChanged(WorldBorder border, double newSize)
|
| 46 | {
|
| 47 | WorldServerMulti.this.getWorldBorder().setDamageBuffer(newSize);
|
| 48 | }
|
| 49 | });
|
| 50 | }
|
| 51 |
|
| 52 | /**
|
| 53 | * Saves the chunks to disk.
|
| 54 | */
|
| 55 | protected void saveLevel() throws MinecraftException
|
| 56 | {
|
| 57 | }
|
| 58 |
|
| 59 | public World init()
|
| 60 | {
|
| 61 | this.mapStorage = this.delegate.getMapStorage();
|
| 62 | this.worldScoreboard = this.delegate.getScoreboard();
|
| 63 | String s = VillageCollection.fileNameForProvider(this.provider);
|
| 64 | VillageCollection villagecollection = (VillageCollection)this.mapStorage.loadData(VillageCollection.class, s);
|
| 65 |
|
| 66 | if (villagecollection == null)
|
| 67 | {
|
| 68 | this.villageCollectionObj = new VillageCollection(this);
|
| 69 | this.mapStorage.setData(s, this.villageCollectionObj);
|
| 70 | }
|
| 71 | else
|
| 72 | {
|
| 73 | this.villageCollectionObj = villagecollection;
|
| 74 | this.villageCollectionObj.setWorldsForAll(this);
|
| 75 | }
|
| 76 |
|
| 77 | return this;
|
| 78 | }
|
| 79 | }
|
| 80 |
|