diff --git a/src/ca/gibstick/discosheep/DiscoParty.java b/src/ca/gibstick/discosheep/DiscoParty.java index 624d0e5..6881282 100644 --- a/src/ca/gibstick/discosheep/DiscoParty.java +++ b/src/ca/gibstick/discosheep/DiscoParty.java @@ -142,13 +142,6 @@ public class DiscoParty { return this; } - void spawnSheep(World world, Location loc) { - Sheep newSheep = (Sheep) world.spawnEntity(loc, EntityType.SHEEP); - newSheep.setColor(discoColours[(int) (Math.random() * (discoColours.length - 1))]); - newSheep.setBreed(false); - getSheep().add(newSheep); - } - // Spawn some number of sheep next to given player void spawnSheep(int num, int sheepSpawnRadius) { Location loc; @@ -167,10 +160,21 @@ public class DiscoParty { y = world.getHighestBlockYAt((int) x, (int) z); loc = new Location(world, x, y, z); + //loc.setPitch((float) ((180f / Math.PI) * Math.atan((loc.getX() - player.getLocation().getX()) / (loc.getZ() - player.getLocation().getZ())))); + loc.setPitch((float) Math.random() * 360 - 180); + loc.setYaw(0); spawnSheep(world, loc); } } + void spawnSheep(World world, Location loc) { + Sheep newSheep = (Sheep) world.spawnEntity(loc, EntityType.SHEEP); + newSheep.setColor(discoColours[(int) (Math.random() * (discoColours.length - 1))]); + newSheep.setBreed(false); + newSheep.teleport(loc); // for sheep orientation + getSheep().add(newSheep); + } + // Mark all sheep in the sheep array for removal, then clear the array void removeAllSheep() { for (Sheep sheeple : getSheep()) {