@SuppressWarnings("NumericCastThatLosesPrecision")
private TileEntityTickRegion getOrCreateRegion(TileEntity tileEntity) {
int regionX = tileEntity.xCoord >> regionSizePower;
int regionZ = tileEntity.zCoord >> regionSizePower;
int hashCode = getHashCodeFromRegionCoords(regionX, regionZ);
TileEntityTickRegion callable = tileEntityCallables.get(hashCode);
if (callable == null) {
synchronized (tickRegions) {
callable = tileEntityCallables.get(hashCode);
if (callable == null) {
callable = new TileEntityTickRegion(world, this, regionX, regionZ);
tileEntityCallables.put(hashCode, callable);
tickRegions.add(callable);
}
}
}