Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
private RegionFile a(ChunkCoordIntPair chunkcoordintpair) throws IOException {
long i = ChunkCoordIntPair.pair(chunkcoordintpair.getRegionX(), chunkcoordintpair.getRegionZ());
RegionFile regionfile = (RegionFile) this.cache.getAndMoveToFirst(i);
if (regionfile != null) {
return regionfile;
} else {
if (this.cache.size() >= 256) {
this.cache.removeLast(); // The relevant line.
}
if (!this.a.exists()) {
this.a.mkdirs();
}
File file = new File(this.a, "r." + chunkcoordintpair.getRegionX() + "." + chunkcoordintpair.getRegionZ() + ".mca");
RegionFile regionfile1 = new RegionFile(file);
this.cache.putAndMoveToFirst(i, regionfile1);
return regionfile1;
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.