0

Merge many branches into master.

Branches:
 * mioux/sensor-false #1359
 * bobfrankly/Terracotta_Texture_Fix #1408
 * bobfrankly/Documentation #1407
 * lyknode/fix-slime-algo #1400
 * 3decibels/uuidcache_expire #1359
This commit is contained in:
Aaron Griffith
2017-08-24 18:22:35 -04:00
4 changed files with 24 additions and 15 deletions

View File

@@ -258,13 +258,15 @@ class PlayerDict(dict):
sname = self._name.replace('-','')
try:
profile = PlayerDict.uuid_cache[sname]
return profile['name']
if profile['retrievedAt'] > time.mktime(self['time']):
return profile['name']
except (KeyError,):
pass
try:
profile = json.loads(urllib2.urlopen(UUID_LOOKUP_URL + sname).read())
if 'name' in profile:
profile['retrievedAt'] = time.mktime(time.localtime())
PlayerDict.uuid_cache[sname] = profile
return profile['name']
except (ValueError, urllib2.URLError):

View File

@@ -11,7 +11,7 @@
<link rel="stylesheet" href="overviewer.css" type="text/css" />
<script type="text/javascript" src="https://ajax.googleapis.com/ajax/libs/jquery/1.11.3/jquery.min.js"></script>
<script type="text/javascript" src="https://maps.google.com/maps/api/js?sensor=false"></script>
<script type="text/javascript" src="https://maps.google.com/maps/api/js"></script>
<script type="text/javascript" src="underscore.js"></script>
<script type="text/javascript" src="backbone.js"></script>

View File

@@ -59,10 +59,14 @@ static int random_next_int(long long *seed, int n) {
return val;
}
static int is_slime(long long map_seed, long chunkx, long chunkz) {
static int is_slime(long long map_seed, int chunkx, int chunkz) {
/* lots of magic numbers, but they're all correct! I swear! */
long long seed;
random_set_seed(&seed, map_seed + (chunkx * chunkx * 0x4c1906LL) + (chunkx * 0x5ac0dbLL) + (chunkz * chunkz * 0x4307a7LL) + (chunkz * 0x5f24fLL) ^ 0x3ad8025fLL);
random_set_seed(&seed, (map_seed +
(long long)(chunkx * chunkx * 0x4c1906) +
(long long)(chunkx * 0x5ac0db) +
(long long)(chunkz * chunkz * 0x4307a7LL) +
(long long)(chunkz * 0x5f24f)) ^ 0x3ad8025f);
return (random_next_int(&seed, 10) == 0);
}