@@ -1,8 +1,8 @@
|
||||
--- a/net/minecraft/server/World.java
|
||||
+++ b/net/minecraft/server/World.java
|
||||
@@ -14,6 +14,17 @@
|
||||
import org.apache.logging.log4j.LogManager;
|
||||
import org.apache.logging.log4j.Logger;
|
||||
import org.apache.logging.log4j.util.Supplier;
|
||||
|
||||
+// CraftBukkit start
|
||||
+import java.util.HashMap;
|
||||
@@ -18,11 +18,11 @@
|
||||
public abstract class World implements GeneratorAccess, AutoCloseable {
|
||||
|
||||
protected static final Logger LOGGER = LogManager.getLogger();
|
||||
@@ -40,7 +51,43 @@
|
||||
private final WorldBorder worldBorder;
|
||||
private final BiomeManager biomeManager;
|
||||
@@ -46,7 +57,39 @@
|
||||
private final ResourceKey<World> dimensionKey;
|
||||
private final ResourceKey<DimensionManager> typeKey;
|
||||
|
||||
- protected World(WorldData worlddata, DimensionManager dimensionmanager, BiFunction<World, WorldProvider, IChunkProvider> bifunction, GameProfilerFiller gameprofilerfiller, boolean flag) {
|
||||
- protected World(WorldDataMutable worlddatamutable, ResourceKey<World> resourcekey, ResourceKey<DimensionManager> resourcekey1, DimensionManager dimensionmanager, Supplier<GameProfilerFiller> supplier, boolean flag, boolean flag1, long i) {
|
||||
+ // CraftBukkit start Added the following
|
||||
+ private final CraftWorld world;
|
||||
+ public boolean pvpMode;
|
||||
@@ -48,11 +48,7 @@
|
||||
+ return (CraftServer) Bukkit.getServer();
|
||||
+ }
|
||||
+
|
||||
+ public Chunk getChunkIfLoaded(int x, int z) {
|
||||
+ return ((ChunkProviderServer) this.chunkProvider).getChunkAt(x, z, false);
|
||||
+ }
|
||||
+
|
||||
+ protected World(WorldData worlddata, DimensionManager dimensionmanager, BiFunction<World, WorldProvider, IChunkProvider> bifunction, GameProfilerFiller gameprofilerfiller, boolean flag, org.bukkit.generator.ChunkGenerator gen, org.bukkit.World.Environment env) {
|
||||
+ protected World(WorldDataMutable worlddatamutable, ResourceKey<World> resourcekey, ResourceKey<DimensionManager> resourcekey1, DimensionManager dimensionmanager, Supplier<GameProfilerFiller> supplier, boolean flag, boolean flag1, long i, org.bukkit.generator.ChunkGenerator gen, org.bukkit.World.Environment env) {
|
||||
+ this.generator = gen;
|
||||
+ this.world = new CraftWorld((WorldServer) this, gen, env);
|
||||
+ this.ticksPerAnimalSpawns = this.getServer().getTicksPerAnimalSpawns(); // CraftBukkit
|
||||
@@ -60,13 +56,28 @@
|
||||
+ this.ticksPerWaterSpawns = this.getServer().getTicksPerWaterSpawns(); // CraftBukkit
|
||||
+ this.ticksPerAmbientSpawns = this.getServer().getTicksPerAmbientSpawns(); // CraftBukkit
|
||||
+ // CraftBukkit end
|
||||
this.methodProfiler = gameprofilerfiller;
|
||||
this.worldData = worlddata;
|
||||
this.worldProvider = dimensionmanager.getWorldProvider(this);
|
||||
@@ -49,6 +96,35 @@
|
||||
this.worldBorder = this.worldProvider.getWorldBorder();
|
||||
this.methodProfiler = supplier;
|
||||
this.worldData = worlddatamutable;
|
||||
this.x = dimensionmanager;
|
||||
@@ -57,12 +100,12 @@
|
||||
this.worldBorder = new WorldBorder() {
|
||||
@Override
|
||||
public double getCenterX() {
|
||||
- return super.getCenterX() / 8.0D;
|
||||
+ return super.getCenterX(); // CraftBukkit
|
||||
}
|
||||
|
||||
@Override
|
||||
public double getCenterZ() {
|
||||
- return super.getCenterZ() / 8.0D;
|
||||
+ return super.getCenterZ(); // CraftBukkit
|
||||
}
|
||||
};
|
||||
} else {
|
||||
@@ -72,6 +115,35 @@
|
||||
this.serverThread = Thread.currentThread();
|
||||
this.biomeManager = new BiomeManager(this, flag ? worlddata.getSeed() : WorldData.c(worlddata.getSeed()), dimensionmanager.getGenLayerZoomer());
|
||||
this.biomeManager = new BiomeManager(this, i, dimensionmanager.getGenLayerZoomer());
|
||||
this.debugWorld = flag1;
|
||||
+ // CraftBukkit start
|
||||
+ getWorldBorder().world = (WorldServer) this;
|
||||
+ // From PlayerList.setPlayerFileData
|
||||
@@ -99,10 +110,10 @@
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -105,6 +181,17 @@
|
||||
@@ -176,6 +248,17 @@
|
||||
|
||||
@Override
|
||||
public boolean setTypeAndData(BlockPosition blockposition, IBlockData iblockdata, int i) {
|
||||
public boolean a(BlockPosition blockposition, IBlockData iblockdata, int i, int j) {
|
||||
+ // CraftBukkit start - tree generation
|
||||
+ if (this.captureTreeGeneration) {
|
||||
+ CapturedBlockState blockstate = capturedBlockStates.get(blockposition);
|
||||
@@ -116,8 +127,8 @@
|
||||
+ // CraftBukkit end
|
||||
if (isOutsideWorld(blockposition)) {
|
||||
return false;
|
||||
} else if (!this.isClientSide && this.worldData.getType() == WorldType.DEBUG_ALL_BLOCK_STATES) {
|
||||
@@ -112,9 +199,24 @@
|
||||
} else if (!this.isClientSide && this.isDebugWorld()) {
|
||||
@@ -183,9 +266,24 @@
|
||||
} else {
|
||||
Chunk chunk = this.getChunkAtWorldCoords(blockposition);
|
||||
Block block = iblockdata.getBlock();
|
||||
@@ -143,15 +154,15 @@
|
||||
return false;
|
||||
} else {
|
||||
IBlockData iblockdata2 = this.getType(blockposition);
|
||||
@@ -125,6 +227,7 @@
|
||||
this.methodProfiler.exit();
|
||||
@@ -196,6 +294,7 @@
|
||||
this.getMethodProfiler().exit();
|
||||
}
|
||||
|
||||
+ /*
|
||||
if (iblockdata2 == iblockdata) {
|
||||
if (iblockdata1 != iblockdata2) {
|
||||
this.b(blockposition, iblockdata1, iblockdata2);
|
||||
@@ -151,12 +254,65 @@
|
||||
@@ -222,12 +321,65 @@
|
||||
|
||||
this.a(blockposition, iblockdata1, iblockdata2);
|
||||
}
|
||||
@@ -217,19 +228,7 @@
|
||||
public void a(BlockPosition blockposition, IBlockData iblockdata, IBlockData iblockdata1) {}
|
||||
|
||||
@Override
|
||||
@@ -195,6 +351,11 @@
|
||||
@Override
|
||||
public void update(BlockPosition blockposition, Block block) {
|
||||
if (this.worldData.getType() != WorldType.DEBUG_ALL_BLOCK_STATES) {
|
||||
+ // CraftBukkit start
|
||||
+ if (populating) {
|
||||
+ return;
|
||||
+ }
|
||||
+ // CraftBukkit end
|
||||
this.applyPhysics(blockposition, block);
|
||||
}
|
||||
|
||||
@@ -243,6 +404,17 @@
|
||||
@@ -309,6 +461,17 @@
|
||||
IBlockData iblockdata = this.getType(blockposition);
|
||||
|
||||
try {
|
||||
@@ -247,7 +246,7 @@
|
||||
iblockdata.doPhysics(this, blockposition, block, blockposition1, false);
|
||||
} catch (Throwable throwable) {
|
||||
CrashReport crashreport = CrashReport.a(throwable, "Exception while updating neighbours");
|
||||
@@ -285,6 +457,14 @@
|
||||
@@ -351,6 +514,14 @@
|
||||
|
||||
@Override
|
||||
public IBlockData getType(BlockPosition blockposition) {
|
||||
@@ -262,21 +261,7 @@
|
||||
if (isOutsideWorld(blockposition)) {
|
||||
return Blocks.VOID_AIR.getBlockData();
|
||||
} else {
|
||||
@@ -306,11 +486,11 @@
|
||||
}
|
||||
|
||||
public boolean isDay() {
|
||||
- return this.worldProvider.getDimensionManager() == DimensionManager.OVERWORLD && this.c < 4;
|
||||
+ return this.worldProvider.getDimensionManager().getType() == DimensionManager.OVERWORLD && this.c < 4; // CraftBukkit
|
||||
}
|
||||
|
||||
public boolean isNight() {
|
||||
- return this.worldProvider.getDimensionManager() == DimensionManager.OVERWORLD && !this.isDay();
|
||||
+ return this.worldProvider.getDimensionManager().getType() == DimensionManager.OVERWORLD && !this.isDay(); // CraftBukkit
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -432,9 +612,11 @@
|
||||
@@ -498,9 +669,11 @@
|
||||
TileEntity tileentity1 = (TileEntity) this.tileEntityListPending.get(i);
|
||||
|
||||
if (!tileentity1.isRemoved()) {
|
||||
@@ -288,7 +273,7 @@
|
||||
|
||||
if (this.isLoaded(tileentity1.getPosition())) {
|
||||
Chunk chunk = this.getChunkAtWorldCoords(tileentity1.getPosition());
|
||||
@@ -442,6 +624,12 @@
|
||||
@@ -508,6 +681,12 @@
|
||||
|
||||
chunk.setTileEntity(tileentity1.getPosition(), tileentity1);
|
||||
this.notify(tileentity1.getPosition(), iblockdata, iblockdata, 3);
|
||||
@@ -301,7 +286,7 @@
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -606,12 +794,25 @@
|
||||
@@ -548,12 +727,25 @@
|
||||
|
||||
@Nullable
|
||||
@Override
|
||||
@@ -327,7 +312,7 @@
|
||||
TileEntity tileentity = null;
|
||||
|
||||
if (this.tickingTileEntities) {
|
||||
@@ -646,6 +847,13 @@
|
||||
@@ -588,6 +780,13 @@
|
||||
public void setTileEntity(BlockPosition blockposition, @Nullable TileEntity tileentity) {
|
||||
if (!isOutsideWorld(blockposition)) {
|
||||
if (tileentity != null && !tileentity.isRemoved()) {
|
||||
@@ -341,7 +326,7 @@
|
||||
if (this.tickingTileEntities) {
|
||||
tileentity.setLocation(this, blockposition);
|
||||
Iterator iterator = this.tileEntityListPending.iterator();
|
||||
@@ -670,7 +878,7 @@
|
||||
@@ -612,7 +811,7 @@
|
||||
}
|
||||
|
||||
public void removeTileEntity(BlockPosition blockposition) {
|
||||
@@ -349,4 +334,4 @@
|
||||
+ TileEntity tileentity = this.getTileEntity(blockposition, false); // CraftBukkit
|
||||
|
||||
if (tileentity != null && this.tickingTileEntities) {
|
||||
tileentity.ab_();
|
||||
tileentity.an_();
|
||||
|
||||
Reference in New Issue
Block a user