Fix #346
This commit is contained in:
parent
962807f835
commit
3b244893d9
@ -15,15 +15,40 @@
|
|||||||
public class BiomeDecorator
|
public class BiomeDecorator
|
||||||
{
|
{
|
||||||
public World currentWorld;
|
public World currentWorld;
|
||||||
@@ -61,6 +69,7 @@
|
@@ -61,6 +69,8 @@
|
||||||
public int clayPerChunk;
|
public int clayPerChunk;
|
||||||
public int bigMushroomsPerChunk;
|
public int bigMushroomsPerChunk;
|
||||||
public boolean generateLakes;
|
public boolean generateLakes;
|
||||||
+ private final List<Chunk> chunksToUnload = new ArrayList<Chunk>(); // Spigot
|
+ private final List<Chunk> chunksToUnload = new ArrayList<Chunk>(); // Spigot
|
||||||
|
+ private final java.util.concurrent.locks.Lock decorateLock = new java.util.concurrent.locks.ReentrantLock();
|
||||||
private static final String __OBFID = "CL_00000164";
|
private static final String __OBFID = "CL_00000164";
|
||||||
|
|
||||||
public BiomeDecorator()
|
public BiomeDecorator()
|
||||||
@@ -194,7 +203,7 @@
|
@@ -92,12 +102,8 @@
|
||||||
|
|
||||||
|
public void decorateChunk(World p_150512_1_, Random p_150512_2_, BiomeGenBase p_150512_3_, int p_150512_4_, int p_150512_5_)
|
||||||
|
{
|
||||||
|
- if (this.currentWorld != null)
|
||||||
|
- {
|
||||||
|
- throw new RuntimeException("Already decorating!!");
|
||||||
|
- }
|
||||||
|
- else
|
||||||
|
- {
|
||||||
|
+ decorateLock.lock();
|
||||||
|
+ try {
|
||||||
|
this.currentWorld = p_150512_1_;
|
||||||
|
this.randomGenerator = p_150512_2_;
|
||||||
|
this.chunk_X = p_150512_4_;
|
||||||
|
@@ -105,6 +111,8 @@
|
||||||
|
this.genDecorations(p_150512_3_);
|
||||||
|
this.currentWorld = null;
|
||||||
|
this.randomGenerator = null;
|
||||||
|
+ } finally {
|
||||||
|
+ decorateLock.unlock();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@@ -194,7 +202,7 @@
|
||||||
{
|
{
|
||||||
k = this.chunk_X + this.randomGenerator.nextInt(16) + 8;
|
k = this.chunk_X + this.randomGenerator.nextInt(16) + 8;
|
||||||
l = this.chunk_Z + this.randomGenerator.nextInt(16) + 8;
|
l = this.chunk_Z + this.randomGenerator.nextInt(16) + 8;
|
||||||
@ -32,7 +57,7 @@
|
|||||||
WorldGenerator worldgenerator = p_150513_1_.getRandomWorldGenForGrass(this.randomGenerator);
|
WorldGenerator worldgenerator = p_150513_1_.getRandomWorldGenForGrass(this.randomGenerator);
|
||||||
worldgenerator.generate(this.currentWorld, this.randomGenerator, k, i1, l);
|
worldgenerator.generate(this.currentWorld, this.randomGenerator, k, i1, l);
|
||||||
}
|
}
|
||||||
@@ -204,7 +213,7 @@
|
@@ -204,7 +212,7 @@
|
||||||
{
|
{
|
||||||
k = this.chunk_X + this.randomGenerator.nextInt(16) + 8;
|
k = this.chunk_X + this.randomGenerator.nextInt(16) + 8;
|
||||||
l = this.chunk_Z + this.randomGenerator.nextInt(16) + 8;
|
l = this.chunk_Z + this.randomGenerator.nextInt(16) + 8;
|
||||||
@ -41,7 +66,7 @@
|
|||||||
(new WorldGenDeadBush(Blocks.deadbush)).generate(this.currentWorld, this.randomGenerator, k, i1, l);
|
(new WorldGenDeadBush(Blocks.deadbush)).generate(this.currentWorld, this.randomGenerator, k, i1, l);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -214,7 +223,7 @@
|
@@ -214,7 +222,7 @@
|
||||||
k = this.chunk_X + this.randomGenerator.nextInt(16) + 8;
|
k = this.chunk_X + this.randomGenerator.nextInt(16) + 8;
|
||||||
l = this.chunk_Z + this.randomGenerator.nextInt(16) + 8;
|
l = this.chunk_Z + this.randomGenerator.nextInt(16) + 8;
|
||||||
|
|
||||||
@ -50,7 +75,7 @@
|
|||||||
{
|
{
|
||||||
;
|
;
|
||||||
}
|
}
|
||||||
@@ -229,7 +238,7 @@
|
@@ -229,7 +237,7 @@
|
||||||
{
|
{
|
||||||
k = this.chunk_X + this.randomGenerator.nextInt(16) + 8;
|
k = this.chunk_X + this.randomGenerator.nextInt(16) + 8;
|
||||||
l = this.chunk_Z + this.randomGenerator.nextInt(16) + 8;
|
l = this.chunk_Z + this.randomGenerator.nextInt(16) + 8;
|
||||||
@ -59,7 +84,7 @@
|
|||||||
this.mushroomBrownGen.generate(this.currentWorld, this.randomGenerator, k, i1, l);
|
this.mushroomBrownGen.generate(this.currentWorld, this.randomGenerator, k, i1, l);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -237,7 +246,7 @@
|
@@ -237,7 +245,7 @@
|
||||||
{
|
{
|
||||||
k = this.chunk_X + this.randomGenerator.nextInt(16) + 8;
|
k = this.chunk_X + this.randomGenerator.nextInt(16) + 8;
|
||||||
l = this.chunk_Z + this.randomGenerator.nextInt(16) + 8;
|
l = this.chunk_Z + this.randomGenerator.nextInt(16) + 8;
|
||||||
@ -68,7 +93,7 @@
|
|||||||
this.mushroomRedGen.generate(this.currentWorld, this.randomGenerator, k, i1, l);
|
this.mushroomRedGen.generate(this.currentWorld, this.randomGenerator, k, i1, l);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -246,7 +255,7 @@
|
@@ -246,7 +254,7 @@
|
||||||
{
|
{
|
||||||
j = this.chunk_X + this.randomGenerator.nextInt(16) + 8;
|
j = this.chunk_X + this.randomGenerator.nextInt(16) + 8;
|
||||||
k = this.chunk_Z + this.randomGenerator.nextInt(16) + 8;
|
k = this.chunk_Z + this.randomGenerator.nextInt(16) + 8;
|
||||||
@ -77,7 +102,7 @@
|
|||||||
this.mushroomBrownGen.generate(this.currentWorld, this.randomGenerator, j, l, k);
|
this.mushroomBrownGen.generate(this.currentWorld, this.randomGenerator, j, l, k);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -254,7 +263,7 @@
|
@@ -254,7 +262,7 @@
|
||||||
{
|
{
|
||||||
j = this.chunk_X + this.randomGenerator.nextInt(16) + 8;
|
j = this.chunk_X + this.randomGenerator.nextInt(16) + 8;
|
||||||
k = this.chunk_Z + this.randomGenerator.nextInt(16) + 8;
|
k = this.chunk_Z + this.randomGenerator.nextInt(16) + 8;
|
||||||
@ -86,7 +111,7 @@
|
|||||||
this.mushroomRedGen.generate(this.currentWorld, this.randomGenerator, j, l, k);
|
this.mushroomRedGen.generate(this.currentWorld, this.randomGenerator, j, l, k);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -263,7 +272,7 @@
|
@@ -263,7 +271,7 @@
|
||||||
{
|
{
|
||||||
k = this.chunk_X + this.randomGenerator.nextInt(16) + 8;
|
k = this.chunk_X + this.randomGenerator.nextInt(16) + 8;
|
||||||
l = this.chunk_Z + this.randomGenerator.nextInt(16) + 8;
|
l = this.chunk_Z + this.randomGenerator.nextInt(16) + 8;
|
||||||
@ -95,7 +120,7 @@
|
|||||||
this.reedGen.generate(this.currentWorld, this.randomGenerator, k, i1, l);
|
this.reedGen.generate(this.currentWorld, this.randomGenerator, k, i1, l);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -271,7 +280,7 @@
|
@@ -271,7 +279,7 @@
|
||||||
{
|
{
|
||||||
k = this.chunk_X + this.randomGenerator.nextInt(16) + 8;
|
k = this.chunk_X + this.randomGenerator.nextInt(16) + 8;
|
||||||
l = this.chunk_Z + this.randomGenerator.nextInt(16) + 8;
|
l = this.chunk_Z + this.randomGenerator.nextInt(16) + 8;
|
||||||
@ -104,7 +129,7 @@
|
|||||||
this.reedGen.generate(this.currentWorld, this.randomGenerator, k, i1, l);
|
this.reedGen.generate(this.currentWorld, this.randomGenerator, k, i1, l);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -280,7 +289,7 @@
|
@@ -280,7 +288,7 @@
|
||||||
{
|
{
|
||||||
j = this.chunk_X + this.randomGenerator.nextInt(16) + 8;
|
j = this.chunk_X + this.randomGenerator.nextInt(16) + 8;
|
||||||
k = this.chunk_Z + this.randomGenerator.nextInt(16) + 8;
|
k = this.chunk_Z + this.randomGenerator.nextInt(16) + 8;
|
||||||
@ -113,7 +138,7 @@
|
|||||||
(new WorldGenPumpkin()).generate(this.currentWorld, this.randomGenerator, j, l, k);
|
(new WorldGenPumpkin()).generate(this.currentWorld, this.randomGenerator, j, l, k);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -289,7 +298,7 @@
|
@@ -289,7 +297,7 @@
|
||||||
{
|
{
|
||||||
k = this.chunk_X + this.randomGenerator.nextInt(16) + 8;
|
k = this.chunk_X + this.randomGenerator.nextInt(16) + 8;
|
||||||
l = this.chunk_Z + this.randomGenerator.nextInt(16) + 8;
|
l = this.chunk_Z + this.randomGenerator.nextInt(16) + 8;
|
||||||
@ -122,7 +147,7 @@
|
|||||||
this.cactusGen.generate(this.currentWorld, this.randomGenerator, k, i1, l);
|
this.cactusGen.generate(this.currentWorld, this.randomGenerator, k, i1, l);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -313,6 +322,7 @@
|
@@ -313,6 +321,7 @@
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -130,7 +155,7 @@
|
|||||||
MinecraftForge.EVENT_BUS.post(new DecorateBiomeEvent.Post(currentWorld, randomGenerator, chunk_X, chunk_Z));
|
MinecraftForge.EVENT_BUS.post(new DecorateBiomeEvent.Post(currentWorld, randomGenerator, chunk_X, chunk_Z));
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -360,6 +370,31 @@
|
@@ -360,6 +369,31 @@
|
||||||
MinecraftForge.ORE_GEN_BUS.post(new OreGenEvent.Post(currentWorld, randomGenerator, chunk_X, chunk_Z));
|
MinecraftForge.ORE_GEN_BUS.post(new OreGenEvent.Post(currentWorld, randomGenerator, chunk_X, chunk_Z));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user