use of com.flowpowered.math.vector.Vector2d in project Skree by Skelril.
the class SkyWarsInstance method spawnChickens.
private void spawnChickens() {
Vector3i bvMax = getRegion().getMaximumPoint();
Vector3i bvMin = getRegion().getMinimumPoint();
for (int i = 0; i < getPlayers(PARTICIPANT).size(); ++i) {
Location<World> testLoc = new Location<>(getRegion().getExtent(), Probability.getRangedRandom(bvMin.getX(), bvMax.getX()), bvMax.getY() - 10, Probability.getRangedRandom(bvMin.getZ(), bvMax.getZ()));
Vector2d testPos = new Vector2d(testLoc.getX(), testLoc.getZ());
Vector2d originPos = new Vector2d(startingLocation.getX(), startingLocation.getZ());
if (testPos.distanceSquared(originPos) >= 70 * 70) {
--i;
continue;
}
Chicken chicken = (Chicken) testLoc.getExtent().createEntity(EntityTypes.CHICKEN, testLoc.getPosition());
chicken.offer(Keys.PERSISTS, false);
testLoc.getExtent().spawnEntity(chicken, Cause.source(SpawnCause.builder().type(SpawnTypes.PLUGIN).build()).build());
}
}