The plugin is now affecting natural spawning only

This commit is contained in:
Ardakaz
2026-06-28 09:58:25 +03:00
parent 605a4ebfe2
commit 4163333b02
3 changed files with 9 additions and 2 deletions

View File

@@ -4,7 +4,7 @@ plugins {
}
group = 'net.ardakaz'
version = '1.0'
version = '1.1'
repositories {
mavenCentral()

View File

@@ -30,11 +30,18 @@ public class SimpleMobSpawningOptimizer extends JavaPlugin implements Listener {
@EventHandler
public void onCreatureSpawn(CreatureSpawnEvent event) {
// Return if the spawn was not natural
if (event.getSpawnReason() != CreatureSpawnEvent.SpawnReason.NATURAL) {
return;
}
// Defining variables
int currentSimulationDistance = getSimulationDistance();
int normalSimulationDistance = 10;
double mobPercentage = Math.pow(currentSimulationDistance, 2) / Math.pow(normalSimulationDistance, 2);
if (random.nextDouble() > mobPercentage) {
// Cancelling event
event.setCancelled(true);
mobsNotSpawned += 1;
}

View File

@@ -1,4 +1,4 @@
name: SimpleMobSpawningOptimizer
version: '1.0'
version: '1.1'
main: net.ardakaz.simpleMobSpawningOptimizer.SimpleMobSpawningOptimizer
api-version: '1.21'