Created
February 19, 2016 00:45
-
-
Save aikar/d1b632fb6ff16d9e439f to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public static int DISTANCE = 2000; | |
public static int LIMIT = DISTANCE * 2; | |
public static int SPAWN_SIZE = 26; | |
public static WastelandOutpost getCurrentRegion(Location loc) { | |
final int blockX = loc.getBlockX(); | |
final int blockZ = loc.getBlockZ(); | |
final int x = (int) Math.floor(blockX / DISTANCE); | |
final int z = (int) Math.floor(blockZ / DISTANCE); | |
final int val = (1000 * x) + z; | |
switch (val) { | |
case -1: | |
return WastelandOutpost.NORTH; | |
case 999: | |
return WastelandOutpost.NORTH_EAST; | |
case 1000: | |
return WastelandOutpost.EAST; | |
case 1001: | |
return WastelandOutpost.SOUTH_EAST; | |
case 1: | |
return WastelandOutpost.SOUTH; | |
case -999: | |
return WastelandOutpost.SOUTH_WEST; | |
case -1000: | |
return WastelandOutpost.WEST; | |
case -1001: | |
return WastelandOutpost.NORTH_WEST; | |
case 0: | |
return WastelandOutpost.CENTER; | |
default: | |
return WastelandOutpost.CENTER; | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment