
Originally Posted by
Patyosaurs
This way it's literally impossible to have any "accidental" noclips.
That's really inefficient and makes no sense. All you have to do is literally load the map data you need from the cache and clip the whole map that way. How can you have accidental no-clipping, when it's how it's supposed to be done?
Code:
/**
* Gets and returns the landscape archive data for the requested {@link Region}.
*
* @param region The {@link Region} to get the data from.
* @return The archive data.
*/
private int getLandscapeArchiveData(Region region) {
return Cache.getStore().getIndexes()[CacheContainer.LANDSCAPE_INDEX.getContainerId()].getArchiveId("l" + ((region.getRegionX() >> 3) / 8) + "_" + ((region.getRegionY() >> 3) / 8));
}
/**
* Gets and returns the landscape container data for the requested {@link Region}.
*
* @param region The {@link Region} to get the data from.
* @return The container data.
*/
private byte[] getLandscapeContainerData(Region region, int archive) {
return Cache.getStore().getIndexes()[CacheContainer.LANDSCAPE_INDEX.getContainerId()].getFile(archive, 0);
}
/**
* Gets and returns the map archive data for the requested {@link Region}.
*
* @param region The {@link Region} to get the data from.
* @return The archive data.
*/
private int getMapArchiveData(Region region) {
return Cache.getStore().getIndexes()[CacheContainer.LANDSCAPE_INDEX.getContainerId()].getArchiveId("m" + ((region.getRegionX() >> 3) / 8) + "_" + ((region.getRegionY() >> 3) / 8));
}
/**
* Gets and returns the map container data for the requested {@link Region}.
*
* @param region The {@link Region} to get the data from.
* @return The container data.
*/
private byte[] getMapContainerData(Region region, int archive) {
return Cache.getStore().getIndexes()[CacheContainer.LANDSCAPE_INDEX.getContainerId()].getFile(archive, 0);
}