Spawn Cake islands based off the mid capture point

This commit is contained in:
Sam 2017-11-21 20:48:34 +00:00 committed by Alexander Meech
parent f572007dad
commit 3aee4dc1f7

View File

@ -51,6 +51,7 @@ public class CakeIslandModule extends CakeModule
private final Map<Location, CakeIsland> _islands; private final Map<Location, CakeIsland> _islands;
private final Set<Pair<Location, Pair<Material, Byte>>> _schematic; private final Set<Pair<Location, Pair<Material, Byte>>> _schematic;
private Location _center;
private long _lastIsland; private long _lastIsland;
public CakeIslandModule(CakeWars game) public CakeIslandModule(CakeWars game)
@ -61,6 +62,12 @@ public class CakeIslandModule extends CakeModule
_schematic = new HashSet<>(200); _schematic = new HashSet<>(200);
} }
@Override
protected void setup()
{
_center = _game.WorldData.GetDataLocs("WHITE").get(0);
}
@Override @Override
public void cleanup() public void cleanup()
{ {
@ -244,7 +251,7 @@ public class CakeIslandModule extends CakeModule
attemptsLoop: attemptsLoop:
while (location == null || attempts++ < MAX_ATTEMPTS) while (location == null || attempts++ < MAX_ATTEMPTS)
{ {
location = UtilAlg.getRandomLocation(_game.GetSpectatorLocation().clone().subtract(0, 18, 0), MAX_XZ, 0, MAX_XZ); location = UtilAlg.getRandomLocation(_center, MAX_XZ, 0, MAX_XZ);
Chunk chunk = location.getChunk(); Chunk chunk = location.getChunk();
// Prevent islands spawning inside other blocks // Prevent islands spawning inside other blocks