Configurable Thunder Chance

By: md_5 <git@md-5.net>
This commit is contained in:
CraftBukkit/Spigot
2021-10-24 20:29:25 +11:00
parent e81bcdf643
commit 7cfc37b17d
2 changed files with 23 additions and 9 deletions

View File

@@ -79,7 +79,7 @@
+ // CraftBukkit start + // CraftBukkit start
+ public final LevelStorageSource.LevelStorageAccess convertable; + public final LevelStorageSource.LevelStorageAccess convertable;
+ public final UUID uuid; + public final UUID uuid;
+
+ public LevelChunk getChunkIfLoaded(int x, int z) { + public LevelChunk getChunkIfLoaded(int x, int z) {
+ return this.chunkSource.getChunk(x, z, false); + return this.chunkSource.getChunk(x, z, false);
+ } + }
@@ -112,7 +112,7 @@
+ chunkgenerator = new FlatLevelSource(cpf.settings(), worldChunkManager); + chunkgenerator = new FlatLevelSource(cpf.settings(), worldChunkManager);
+ } + }
+ } + }
+
+ if (gen != null) { + if (gen != null) {
+ chunkgenerator = new org.bukkit.craftbukkit.generator.CustomChunkGenerator(this, chunkgenerator, gen); + chunkgenerator = new org.bukkit.craftbukkit.generator.CustomChunkGenerator(this, chunkgenerator, gen);
+ } + }
@@ -264,6 +264,15 @@
entityplayer.stopSleepInBed(false, false); entityplayer.stopSleepInBed(false, false);
}); });
} }
@@ -442,7 +507,7 @@
ProfilerFiller gameprofilerfiller = Profiler.get();
gameprofilerfiller.push("thunder");
- if (flag && this.isThundering() && this.random.nextInt(100000) == 0) {
+ if (flag && this.isThundering() && this.spigotConfig.thunderChance > 0 && this.random.nextInt(this.spigotConfig.thunderChance) == 0) { // Spigot
BlockPos blockposition = this.findLightningTargetAround(this.getBlockRandomPos(j, 0, k, 15));
if (this.isRainingAt(blockposition)) {
@@ -456,7 +521,7 @@ @@ -456,7 +521,7 @@
entityhorseskeleton.setTrap(true); entityhorseskeleton.setTrap(true);
entityhorseskeleton.setAge(0); entityhorseskeleton.setAge(0);
@@ -455,21 +464,20 @@
- return this.addEntity(entity); - return this.addEntity(entity);
+ // CraftBukkit start + // CraftBukkit start
+ return this.addFreshEntity(entity, CreatureSpawnEvent.SpawnReason.DEFAULT); + return this.addFreshEntity(entity, CreatureSpawnEvent.SpawnReason.DEFAULT);
} + }
+
- public boolean addWithUUID(Entity entity) {
- return this.addEntity(entity);
+ @Override + @Override
+ public boolean addFreshEntity(Entity entity, CreatureSpawnEvent.SpawnReason reason) { + public boolean addFreshEntity(Entity entity, CreatureSpawnEvent.SpawnReason reason) {
+ return this.addEntity(entity, reason); + return this.addEntity(entity, reason);
+ // CraftBukkit end + // CraftBukkit end
} }
+ public boolean addWithUUID(Entity entity) { public boolean addWithUUID(Entity entity) {
- return this.addEntity(entity);
+ // CraftBukkit start + // CraftBukkit start
+ return this.addWithUUID(entity, CreatureSpawnEvent.SpawnReason.DEFAULT); + return this.addWithUUID(entity, CreatureSpawnEvent.SpawnReason.DEFAULT);
+ } }
+
+ public boolean addWithUUID(Entity entity, CreatureSpawnEvent.SpawnReason reason) { + public boolean addWithUUID(Entity entity, CreatureSpawnEvent.SpawnReason reason) {
+ return this.addEntity(entity, reason); + return this.addEntity(entity, reason);
+ // CraftBukkit end + // CraftBukkit end

View File

@@ -382,4 +382,10 @@ public class SpigotWorldConfig
this.entityMaxTickTime = this.getInt("max-tick-time.entity", 50); this.entityMaxTickTime = this.getInt("max-tick-time.entity", 50);
this.log("Tile Max Tick Time: " + this.tileMaxTickTime + "ms Entity max Tick Time: " + this.entityMaxTickTime + "ms"); this.log("Tile Max Tick Time: " + this.tileMaxTickTime + "ms Entity max Tick Time: " + this.entityMaxTickTime + "ms");
} }
public int thunderChance;
private void thunderChance()
{
this.thunderChance = this.getInt("thunder-chance", 100000);
}
} }