Skip to content
This repository has been archived by the owner on Jan 26, 2019. It is now read-only.

Commit

Permalink
Change decoration forced restart #441/#490, don't use client-side met…
Browse files Browse the repository at this point in the history
…hod (sorry about that)
  • Loading branch information
Sam committed Aug 15, 2016
1 parent 5923b8c commit 9d0865a
Show file tree
Hide file tree
Showing 3 changed files with 20 additions and 18 deletions.
2 changes: 1 addition & 1 deletion forge
Submodule forge updated from 30e296 to c6aa04
34 changes: 18 additions & 16 deletions patches/net/minecraft/world/biome/BiomeDecorator.java.patch
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@
private static final String __OBFID = "CL_00000164";

public BiomeDecorator()
@@ -92,12 +102,27 @@
@@ -92,12 +102,29 @@

public void decorateChunk(World p_150512_1_, Random p_150512_2_, BiomeGenBase p_150512_3_, int p_150512_4_, int p_150512_5_)
{
Expand All @@ -38,7 +38,9 @@
+ while(decorateLock.isLocked())
+ {
+ try { Thread.sleep(100L); } catch(Exception e) {} finally { ct++; }
+ if(ct > 100 ) { throw new RuntimeException("Generating a chunk in world " + this.currentWorld.getProviderName() + " took longer than 10 seconds, Thermos needs to crash so the server doesn't time out...sorry!"); } // Thermos - Decoration took too long, we'll have to crash the server at this point so it doesn't hang.
+ if(ct > 100 ) {
+ throw new RuntimeException("Generating a chunk in world " + this.currentWorld.getWorldInfo().getWorldName() +" took longer than 10 seconds, Thermos needs to crash so the server doesn't time out...sorry!");
+ } // Thermos - Decoration took too long, we'll have to crash the server at this point so it doesn't hang.
+ }
+ decorateLock.lock();
+
Expand All @@ -58,7 +60,7 @@
this.currentWorld = p_150512_1_;
this.randomGenerator = p_150512_2_;
this.chunk_X = p_150512_4_;
@@ -105,7 +130,7 @@
@@ -105,7 +132,7 @@
this.genDecorations(p_150512_3_);
this.currentWorld = null;
this.randomGenerator = null;
Expand All @@ -67,7 +69,7 @@
}

protected void genDecorations(BiomeGenBase p_150513_1_)
@@ -194,7 +219,7 @@
@@ -194,7 +221,7 @@
{
k = this.chunk_X + this.randomGenerator.nextInt(16) + 8;
l = this.chunk_Z + this.randomGenerator.nextInt(16) + 8;
Expand All @@ -76,7 +78,7 @@
WorldGenerator worldgenerator = p_150513_1_.getRandomWorldGenForGrass(this.randomGenerator);
worldgenerator.generate(this.currentWorld, this.randomGenerator, k, i1, l);
}
@@ -204,7 +229,7 @@
@@ -204,7 +231,7 @@
{
k = this.chunk_X + this.randomGenerator.nextInt(16) + 8;
l = this.chunk_Z + this.randomGenerator.nextInt(16) + 8;
Expand All @@ -85,7 +87,7 @@
(new WorldGenDeadBush(Blocks.deadbush)).generate(this.currentWorld, this.randomGenerator, k, i1, l);
}

@@ -214,7 +239,7 @@
@@ -214,7 +241,7 @@
k = this.chunk_X + this.randomGenerator.nextInt(16) + 8;
l = this.chunk_Z + this.randomGenerator.nextInt(16) + 8;

Expand All @@ -94,7 +96,7 @@
{
;
}
@@ -229,7 +254,7 @@
@@ -229,7 +256,7 @@
{
k = this.chunk_X + this.randomGenerator.nextInt(16) + 8;
l = this.chunk_Z + this.randomGenerator.nextInt(16) + 8;
Expand All @@ -103,7 +105,7 @@
this.mushroomBrownGen.generate(this.currentWorld, this.randomGenerator, k, i1, l);
}

@@ -237,7 +262,7 @@
@@ -237,7 +264,7 @@
{
k = this.chunk_X + this.randomGenerator.nextInt(16) + 8;
l = this.chunk_Z + this.randomGenerator.nextInt(16) + 8;
Expand All @@ -112,7 +114,7 @@
this.mushroomRedGen.generate(this.currentWorld, this.randomGenerator, k, i1, l);
}
}
@@ -246,7 +271,7 @@
@@ -246,7 +273,7 @@
{
j = this.chunk_X + this.randomGenerator.nextInt(16) + 8;
k = this.chunk_Z + this.randomGenerator.nextInt(16) + 8;
Expand All @@ -121,7 +123,7 @@
this.mushroomBrownGen.generate(this.currentWorld, this.randomGenerator, j, l, k);
}

@@ -254,7 +279,7 @@
@@ -254,7 +281,7 @@
{
j = this.chunk_X + this.randomGenerator.nextInt(16) + 8;
k = this.chunk_Z + this.randomGenerator.nextInt(16) + 8;
Expand All @@ -130,7 +132,7 @@
this.mushroomRedGen.generate(this.currentWorld, this.randomGenerator, j, l, k);
}

@@ -263,7 +288,7 @@
@@ -263,7 +290,7 @@
{
k = this.chunk_X + this.randomGenerator.nextInt(16) + 8;
l = this.chunk_Z + this.randomGenerator.nextInt(16) + 8;
Expand All @@ -139,7 +141,7 @@
this.reedGen.generate(this.currentWorld, this.randomGenerator, k, i1, l);
}

@@ -271,7 +296,7 @@
@@ -271,7 +298,7 @@
{
k = this.chunk_X + this.randomGenerator.nextInt(16) + 8;
l = this.chunk_Z + this.randomGenerator.nextInt(16) + 8;
Expand All @@ -148,7 +150,7 @@
this.reedGen.generate(this.currentWorld, this.randomGenerator, k, i1, l);
}

@@ -280,7 +305,7 @@
@@ -280,7 +307,7 @@
{
j = this.chunk_X + this.randomGenerator.nextInt(16) + 8;
k = this.chunk_Z + this.randomGenerator.nextInt(16) + 8;
Expand All @@ -157,7 +159,7 @@
(new WorldGenPumpkin()).generate(this.currentWorld, this.randomGenerator, j, l, k);
}

@@ -289,7 +314,7 @@
@@ -289,7 +316,7 @@
{
k = this.chunk_X + this.randomGenerator.nextInt(16) + 8;
l = this.chunk_Z + this.randomGenerator.nextInt(16) + 8;
Expand All @@ -166,15 +168,15 @@
this.cactusGen.generate(this.currentWorld, this.randomGenerator, k, i1, l);
}

@@ -313,6 +338,7 @@
@@ -313,6 +340,7 @@
}
}

+ this.unloadChunks(); // Spigot - unload chunks we force loaded
MinecraftForge.EVENT_BUS.post(new DecorateBiomeEvent.Post(currentWorld, randomGenerator, chunk_X, chunk_Z));
}

@@ -360,6 +386,33 @@
@@ -360,6 +388,33 @@
MinecraftForge.ORE_GEN_BUS.post(new OreGenEvent.Post(currentWorld, randomGenerator, chunk_X, chunk_Z));
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -95,7 +95,7 @@
+
+ public static boolean isOp(EntityPlayer ep)
+ {
+ return ep.canCommandSenderUseCommand(4, "stop");
+ return MinecraftServer.getServer().getConfigurationManager().func_152596_g(ep.getGameProfile());
+ }
+
+ public static boolean nonVanilla(EntityPlayer ep)
Expand Down

2 comments on commit 9d0865a

@Bogdan-G
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

throws an exception simply tell us or send the server in offline?

@Time6628
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If the server hangs on decoration, crash it.

Please sign in to comment.