From 0aa187f151ad829adc0ec20b8bd662d625d561e7 Mon Sep 17 00:00:00 2001 From: t00thpick1 Date: Sun, 8 Dec 2013 21:50:18 -0500 Subject: [PATCH] [Bleeding] Ignore Block Physics in Chunk population. Fixes BUKKIT-4923 Suppressing physics updates during Chunk population prevents infinite recursion due to custom Block Populators editing border blocks on chunks. --- .../java/net/minecraft/server/ChunkProviderServer.java | 9 +++++++-- src/main/java/net/minecraft/server/World.java | 6 ++++++ 2 files changed, 13 insertions(+), 2 deletions(-) diff --git a/src/main/java/net/minecraft/server/ChunkProviderServer.java b/src/main/java/net/minecraft/server/ChunkProviderServer.java index a702fe82ce..2f842c3c02 100644 --- a/src/main/java/net/minecraft/server/ChunkProviderServer.java +++ b/src/main/java/net/minecraft/server/ChunkProviderServer.java @@ -237,8 +237,13 @@ public class ChunkProviderServer implements IChunkProvider { org.bukkit.World world = this.world.getWorld(); if (world != null) { - for (org.bukkit.generator.BlockPopulator populator : world.getPopulators()) { - populator.populate(world, random, chunk.bukkitChunk); + this.world.populating = true; + try { + for (org.bukkit.generator.BlockPopulator populator : world.getPopulators()) { + populator.populate(world, random, chunk.bukkitChunk); + } + } finally { + this.world.populating = false; } } BlockSand.instaFall = false; diff --git a/src/main/java/net/minecraft/server/World.java b/src/main/java/net/minecraft/server/World.java index f60368bf31..f850a0f136 100644 --- a/src/main/java/net/minecraft/server/World.java +++ b/src/main/java/net/minecraft/server/World.java @@ -70,6 +70,7 @@ public abstract class World implements IBlockAccess { public boolean callingPlaceEvent = false; public long ticksPerAnimalSpawns; public long ticksPerMonsterSpawns; + public boolean populating; // CraftBukkit end private ArrayList M; private boolean N; @@ -398,6 +399,11 @@ public abstract class World implements IBlockAccess { } public void update(int i, int j, int k, Block block) { + // CraftBukkit start + if (this.populating) { + return; + } + // CraftBukkit end this.applyPhysics(i, j, k, block); }