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
+ public final LevelStorageSource.LevelStorageAccess convertable;
+ public final UUID uuid;
+
+ public LevelChunk getChunkIfLoaded(int x, int z) {
+ return this.chunkSource.getChunk(x, z, false);
+ }
@ -112,7 +112,7 @@
+ chunkgenerator = new FlatLevelSource(cpf.settings(), worldChunkManager);
+ }
+ }
+
+ if (gen != null) {
+ chunkgenerator = new org.bukkit.craftbukkit.generator.CustomChunkGenerator(this, chunkgenerator, gen);
+ }
@ -264,6 +264,15 @@
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 @@
entityhorseskeleton.setTrap(true);
entityhorseskeleton.setAge(0);
@ -455,21 +464,20 @@
- return this.addEntity(entity);
+ // CraftBukkit start
+ return this.addFreshEntity(entity, CreatureSpawnEvent.SpawnReason.DEFAULT);
}
- public boolean addWithUUID(Entity entity) {
- return this.addEntity(entity);
+ }
+
+ @Override
+ public boolean addFreshEntity(Entity entity, CreatureSpawnEvent.SpawnReason reason) {
+ return this.addEntity(entity, reason);
+ // CraftBukkit end
}
+ public boolean addWithUUID(Entity entity) {
public boolean addWithUUID(Entity entity) {
- return this.addEntity(entity);
+ // CraftBukkit start
+ return this.addWithUUID(entity, CreatureSpawnEvent.SpawnReason.DEFAULT);
+ }
+
}
+ public boolean addWithUUID(Entity entity, CreatureSpawnEvent.SpawnReason reason) {
+ return this.addEntity(entity, reason);
+ // CraftBukkit end

View File

@ -382,4 +382,10 @@ public class SpigotWorldConfig
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");
}
public int thunderChance;
private void thunderChance()
{
this.thunderChance = this.getInt("thunder-chance", 100000);
}
}