The plugin is now affecting natural spawning only
This commit is contained in:
@@ -4,7 +4,7 @@ plugins {
|
|||||||
}
|
}
|
||||||
|
|
||||||
group = 'net.ardakaz'
|
group = 'net.ardakaz'
|
||||||
version = '1.0'
|
version = '1.1'
|
||||||
|
|
||||||
repositories {
|
repositories {
|
||||||
mavenCentral()
|
mavenCentral()
|
||||||
|
|||||||
@@ -30,11 +30,18 @@ public class SimpleMobSpawningOptimizer extends JavaPlugin implements Listener {
|
|||||||
@EventHandler
|
@EventHandler
|
||||||
public void onCreatureSpawn(CreatureSpawnEvent event) {
|
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 currentSimulationDistance = getSimulationDistance();
|
||||||
int normalSimulationDistance = 10;
|
int normalSimulationDistance = 10;
|
||||||
double mobPercentage = Math.pow(currentSimulationDistance, 2) / Math.pow(normalSimulationDistance, 2);
|
double mobPercentage = Math.pow(currentSimulationDistance, 2) / Math.pow(normalSimulationDistance, 2);
|
||||||
|
|
||||||
if (random.nextDouble() > mobPercentage) {
|
if (random.nextDouble() > mobPercentage) {
|
||||||
|
// Cancelling event
|
||||||
event.setCancelled(true);
|
event.setCancelled(true);
|
||||||
mobsNotSpawned += 1;
|
mobsNotSpawned += 1;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
name: SimpleMobSpawningOptimizer
|
name: SimpleMobSpawningOptimizer
|
||||||
version: '1.0'
|
version: '1.1'
|
||||||
main: net.ardakaz.simpleMobSpawningOptimizer.SimpleMobSpawningOptimizer
|
main: net.ardakaz.simpleMobSpawningOptimizer.SimpleMobSpawningOptimizer
|
||||||
api-version: '1.21'
|
api-version: '1.21'
|
||||||
|
|||||||
Reference in New Issue
Block a user