From bf15d90dcd60f095100abe8072caf14e1cc2920f Mon Sep 17 00:00:00 2001 From: Charlie Wang Date: Sun, 30 Jun 2013 14:27:46 -0400 Subject: [PATCH] added sheepSpawnRadius, configurable later --- src/gibstick/bukkit/discosheep/DiscoSheep.java | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/src/gibstick/bukkit/discosheep/DiscoSheep.java b/src/gibstick/bukkit/discosheep/DiscoSheep.java index deee971..44a4553 100644 --- a/src/gibstick/bukkit/discosheep/DiscoSheep.java +++ b/src/gibstick/bukkit/discosheep/DiscoSheep.java @@ -13,6 +13,8 @@ public final class DiscoSheep extends JavaPlugin { private ArrayList sheepArray = new ArrayList<>(); private DiscoUpdater updater = new DiscoUpdater(this); + // radius for random sheep spawns around player + private static int sheepSpawnRadius = 5; @Override public void onEnable() { @@ -41,11 +43,10 @@ public final class DiscoSheep extends JavaPlugin { // random x and z coordinates within a 5 block radius // safe y-coordinate - x = -5 + (Math.random() * ((5 - (-5)) + 1)) + player.getLocation().getX(); - z = -5 + (Math.random() * ((5 - (-5)) + 1)) + player.getLocation().getZ(); + x = -sheepSpawnRadius + (Math.random() * ((sheepSpawnRadius * 2) + 1)) + player.getLocation().getX(); + z = -sheepSpawnRadius + (Math.random() * ((sheepSpawnRadius * 2) + 1)) + player.getLocation().getZ(); y = world.getHighestBlockYAt((int) x, (int) z); loc = new Location(world, x, y, z); - spawnSheep(world, loc); } }