Force Load Chunks for Biome Decoration. May solve some random.nextInt() crashes people have been seeing.

This commit is contained in:
md_5 2013-12-21 20:08:42 +11:00
parent b42275d94c
commit 2549f4c043

View file

@ -0,0 +1,37 @@
From f67e97185382ed3e7cbfea25039c58dffb61486c Mon Sep 17 00:00:00 2001
From: md_5 <git@md-5.net>
Date: Sat, 21 Dec 2013 20:08:26 +1100
Subject: [PATCH] Force Load Chunks for Biome Decoration
diff --git a/src/main/java/net/minecraft/server/BiomeDecorator.java b/src/main/java/net/minecraft/server/BiomeDecorator.java
index b048d6c..a8bbe06 100644
--- a/src/main/java/net/minecraft/server/BiomeDecorator.java
+++ b/src/main/java/net/minecraft/server/BiomeDecorator.java
@@ -147,10 +147,23 @@ public class BiomeDecorator {
for (j = 0; j < this.z; ++j) {
k = this.c + this.b.nextInt(16) + 8;
l = this.d + this.b.nextInt(16) + 8;
+ // Spigot Start
+ boolean chunkWasLoaded = this.a.isChunkLoaded( i >> 4, j >> 4 );
+ if ( !chunkWasLoaded )
+ {
+ this.a.getChunkAt( i, j );
+ }
+ // Spigot End
i1 = this.b.nextInt(this.a.getHighestBlockYAt(k, l) * 2);
WorldGenerator worldgenerator = biomebase.b(this.b);
worldgenerator.a(this.a, this.b, k, i1, l);
+ // Spigot Start
+ if ( !chunkWasLoaded )
+ {
+ this.a.getWorld().unloadChunk( i >> 4, j >> 4 );
+ }
+ // Spigot End
}
for (j = 0; j < this.A; ++j) {
--
1.8.3.2